ropensci / MODIStsp

An "R" package for automatic download and preprocessing of MODIS Land Products Time Series
https://docs.ropensci.org/MODIStsp
GNU General Public License v3.0
154 stars 50 forks source link

Unstable values of NDII7 ? #157

Closed bipin79 closed 5 years ago

bipin79 commented 5 years ago

I tried to download and analyze NDII7 as an additional spectral indices using the MODIStsp package. However, I did not get NDII7 value in the range of -1 to +1 in the extracting tiff file. I think I had chosen the parameter in MODIStsp gui correctly. I also tried to resale the value to minus 1 to plus 1

but that was also not possible because in some image has two digits value while three digits in other images. I am asking what is this problem?

For the reference of chosen parameter, I have attached the screen shot.

Looking forward for the reply.

modistsp

error

lbusett commented 5 years ago

Hi @bipin79 ,

thanks for reporting this. MODIStsp usually saves Spectral Indexs with a x10000 scale factor, unless you override that (as I think you already tried) by setting the "Apply scale/offest" flag to "Yes".

I just did some tests, and saw that on the current 1.3.7 version that works properly (that is, setting the apply scale/offset" flag gives you non-multiplied values). I see that you are working with 1.3.6 currently, so I'd suggest you to upgrade to 1.3.7, which is on CRAN . The last MODIStso update may have unwillingly solved an unknown bug preventing application of scales/offsets on indexes - I should check the commit history ;-).

Nonetheless, be warned that you may still get "apparently" out of range values (e.g., -2). This is because sometimes b2 reflectance is (erroneously) below 0 in the original MODIS HDF layers (on sea or clouds / snow), which should be impossible. This leads to instability of the index ( see screenshot below, where I show values of one NDII7 pixels with -6.333 value, coming from computing (-0.0064 - 0.0088) / (-0.0064 + 0.0088) = -6.33

image

HTH,

Lorenzo

bipin79 commented 5 years ago

@lbusett Thank you so much for you prompt reply. According to your suggestion I upgraded the MODISTsp package to 1.3.7 version and it worked well as per your reply. However, I have one more question, Is it not possible to detect such unstable values of b2 reflectance ( below 0) before the computation of the spectral indices (NIID). or How can i implement method to detect and remove unstable value of the indices below -1 and above +1 using the MODIStsp. I am looking forward for your reply

thank you Bipin

lbusett commented 5 years ago

Hi @bipin79 , unfortunately, there is (currently) no way to do that using MODIStsp. You can however implement that easily using raster functions to set the offending values to NA. See for example: https://stackoverflow.com/a/49159943/6871135

lbusett commented 5 years ago

Closing here. Feel free to reopen if needed.