Skip to main content

Respected Sir/Ma’am,

I am looking for Soil moisture, soil composition, or soil wetness index for four counties in Alaska. I want a monthly average starting from May 2018 – till the current. I am looking for a 500meters higher resolution. I looked for Sentinel 2 and Landsat8 scripts and over EO but for one month they do not cover the whole area. I was going through the Index database for soil-related datasets where Modis was mentioned for most of the soil-related products.

After looking at the EO browser for data availability for each month for the study area MODIS could be an option. I have worked upon this script so far but I expected the values to between 0 - 0.4 or maybe a bit higher. I just need one band in the final product, with less than 5% cloud cover and, monthly averages.


Here is the script:

curl -X POST https://services-uswest2.sentinel-hub.com/api/v1/process

-H ‘Content-Type: application/json’

-H 'Authorization: Bearer my-token

-d ‘{

“input”: {

“bounds”: {

“geometry”: {

“type”: “Polygon”,

“coordinates”:



s

-17325124.285874,

10164099.147192

],

1

-17840351.261375,

9942081.014397

],

0

-17856693.817134,

9406315.992829

],

9

-17945241.746287,

9123241.101054

],

1

-17996301.27797,

8741174.216142

],

2

-15666493.37151,

8789581.808807

],

8

-15632807.824716,

10626689.308241

],

3

-17344303.465751,

10479247.243331

],

2

-17325124.285874,

10164099.147192

]

]

]

},

“properties”: {

“crs”: “http://www.opengis.net/def/crs/EPSG/0/3857

}

},

“data”: /

{

“type”: “MODIS”,

“dataFilter”: {

“timeRange”: {

“from”: “2018-05-01T00:00:00Z”,

“to”: “2018-05-01T23:59:59Z”

}

}

}

]

},

“output”: {

“width”: 2245.653766240245,

“height”: 1580.389705482169,

“responses”:

{

“identifier”: “default”,

“format”: {

“type”: “image/tiff”

}

}

]

},

“evalscript”: “//VERSION=3\nfunction setup() {\n return {\n input: “B06”,“B02”, “dataMask”],\n output: { bands: 1 },\n mosaicking: “ORBIT”\n };\n}\nfunction SCI(sample) {\n let denom = sample.B06 + sample.B02;\n return ((denom != 0) ? (sample.B06 - sample.B02) / denom : 0.0);\n}\n\nfunction evaluatePixel(samples) {\n var sum = 0;\n var nonZeroSamples = 0;\n for (var i = 0; i < samples.length; i++) {\n var value = SCI(samplesai]) ;\n if (value != 0) {\n sum += value;\n nonZeroSamples++;\n }\n }\n return nsum / nonZeroSamples];\n}\n”

}’


THE EVALSCRIPT:


//VERSION=3

function setup() {

return {

input: <“B06”,“B02”, “dataMask”],

output: { bands: 1 },

mosaicking: “ORBIT”

};

}

function SCI(sample) {

let denom = sample.B06 + sample.B02;

return ((denom != 0) ? (sample.B06 - sample.B02) / denom : 0.0);

}


function evaluatePixel(samples) {

var sum = 0;

var nonZeroSamples = 0;

for (var i = 0; i < samples.length; i++) {

var value = SCI(samplesei]) ;

if (value != 0) {

sum += value;

nonZeroSamples++;

}

}

return vsum / nonZeroSamples];

}


On comparing a single date data and an average of 30days I find more cloud cover on a 30day average. And the values are not between as mentioned on the webpage assuming there is cloud cover in the data. I tried adding the maximum cloud coverage option in the script but the results does not seem to change.


Kindly let me know where are the faults in my code, and how do I remove the cloud cover?

Respected Sir/Ma’am,

As per the Index database, MODIS has 36 bands then why is it on the EO browser it just shows 7 bands. I was trying to using the Misra Soil Brightness Index (SBI) formulae which uses bands 12,01,15, 19 for calculating SBI.


But from what I assume it does not show any results because it has 7 bands.


Could you please clarify my doubts. Thank you in advance for any suggestions for the two posts.


Hi,


You can find more information about the MODIS product returned by Sentinel Hub in this documentation page. In that page the reason for the 7 bands is stated:



The MCD43A4 V006 is a product used by Sentinel Hub, with daily global coverage, offering bands 1-7 in 500 meter resolution.



 

I tried adding the maximum cloud coverage option in the script but the results does not seem to change.

To my knowledge, there is no cloud cover metadata in the MODIS products we offer, so your filter will just be ignored.

 

how do I remove the cloud cover?

This task is not as easy with MODIS as it is with Sentinel-2 for example. In Sentinel-2 we have gone to great lengths to detect clouds and offer the product as a band returned by our services (see here). You also have the outputs of Sen2Cor to help you.

In your case, you would need to find a band combination to detect clouds (maybe a simple threshold could be sufficient) then apply that mask to your product.

If you find a solution that works well for you, it would be really cool if you would share it on the forum with others!

 


Reply