[GRASS-user] R: error in i.sentinel.mask: nan values in xml file

roberta fagandini robifagandini at hotmail.it
Wed Jan 29 04:08:53 PST 2020

Hi Vero,
i.sentinel.mask doesn't retrieve the maximum from the xml file but computes the value from the image using r.univar. The error could be due to the computational region..has the region been set correctly?
Can you send the MTD_TL.xml file? I can download the image and make some tests.


Da: grass-user <grass-user-bounces at lists.osgeo.org> per conto di Veronica Andreo <veroandreo at gmail.com>
Inviato: martedì 28 gennaio 2020 19:57
A: grass-user <grass-user at lists.osgeo.org>
Oggetto: [GRASS-user] error in i.sentinel.mask: nan values in xml file


I try to use i.sentinel.mask but I get the following error:

i.sentinel.mask blue=$blue green=$green red=$red swir11=$swir11 nir=$nir swir12=$swir12 nir8a=$nir8a cloud_mask=cloud shadow_mask=shadow mtd_file=`find $out_dir -name 'MTD_TL.xml'`

ADVERTENCIA: All subsequent operations will be limited to the current
             computational region
ADVERTENCIA: Any rescale factor has been applied
--- Start computing maximum values of bands ---
--- Computed maximum value: dict_values([nan, nan, nan, nan, nan, nan,
nan]) ---
--- Statistics have been computed! ---
--- Start clouds detection procedure ---
--- Computing cloud mask... ---
Mapa no válido <nan>
Parse error
ERROR: error al parsear
ERROR: An error occurred while running r.mapcalc with expression:
       cloud_def82115 = if((((T21JYM_20200126T134201_B02_10m > (0.08*nan))
       && (T21JYM_20200126T134201_B03_10m > (0.08*nan)) &&
       (T21JYM_20200126T134201_B04_10m > (0.08*nan))) == 1) &&
       (((T21JYM_20200126T134201_B04_10m < ((0.08*nan)*1.5)) &&
       (T21JYM_20200126T134201_B04_10m >
       T21JYM_20200126T134201_B12_20m*1.3)) == 0) &&
       (((T21JYM_20200126T134201_B11_20m < (0.1*nan)) &&
       (T21JYM_20200126T134201_B12_20m < (0.1*nan))) == 0) &&
       ((if(T21JYM_20200126T134201_B8A_20m ==
       max(T21JYM_20200126T134201_B8A_20m, 2 *
       T21JYM_20200126T134201_B02_10m, 2 * T21JYM_20200126T134201_B03_10m,
       2 * T21JYM_20200126T134201_B04_10m))) == 0) &&
       ((T21JYM_20200126T134201_B02_10m > 0.2) == 1), 0, null())

I checked the xml file and there are a lot of nan's yes, but there are also real values. Why doesn't the max function in this part: https://github.com/OSGeo/grass-addons/blob/master/grass7/imagery/i.sentinel/i.sentinel.mask/i.sentinel.mask.py#L321 recognize them? Isn't there a way to avoid nan while computing max?

Thanks much in advance

ps: I can provide the xml if needed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200129/b31c047a/attachment.html>

More information about the grass-user mailing list