<div dir="ltr"><div>Hi Robi,</div><div><br></div><div>So I found that i.sentinel.import fails for latlong locations. I moved to UTM as in the original data and all fine. I reached the cloud masking step, and I find a different problem now. </div><div><br></div><div>Here's the command and an extract of the output:</div><div>GRASS <a href="http://7.9.dev">7.9.dev</a> (dengue_cba):~/webgis > i.sentinel.mask -s \<br>>   blue=$blue \<br>>   green=$green \<br>>   red=$red \<br>>   swir11=$swir11 \<br>>   nir=$nir \<br>>   swir12=$swir12 \<br>>   nir8a=$nir8a \<br>>   cloud_raster=cloud \<br>>   shadow_raster=shadow \<br>>   mtd_file=`find $out_dir -name 'MTD_TL.xml'` \<br>>   scale_fac=10000<br>WARNING: All subsequent operations will be limited to the current<br>         computational region<br>--- Start rescaling bands ---<br>T21JYM_20200126T134201_B02_10m<br> 100%<br>T21JYM_20200126T134201_B03_10m<br> 100%<br>T21JYM_20200126T134201_B04_10m<br> 100%<br>T21JYM_20200126T134201_B08_10m<br> 100%<br>T21JYM_20200126T134201_B8A_20m<br> 100%<br>T21JYM_20200126T134201_B11_20m<br> 100%<br>T21JYM_20200126T134201_B12_20m<br> 100%<br><br>T21JYM_20200126T134201_B02_10m_double,T21JYM_20200126T134201_B03_10m_double,T21JYM_20200126T134201_B04_10m_double,T21JYM_20200126T134201_B08_10m_double,T21JYM_20200126T134201_B8A_20m_double,T21JYM_20200126T134201_B11_20m_double,T21JYM_20200126T134201_B12_20m_double<br>--- All bands have been rescaled ---<br>--- Start computing maximum values of bands ---<br>T21JYM_20200126T134201_B02_10m_double<br>T21JYM_20200126T134201_B03_10m_double<br>T21JYM_20200126T134201_B04_10m_double<br>T21JYM_20200126T134201_B08_10m_double<br>T21JYM_20200126T134201_B8A_20m_double<br>T21JYM_20200126T134201_B11_20m_double<br>T21JYM_20200126T134201_B12_20m_double<br>--- Computed maximum value: dict_values([0.9352, 1.168, 1.1056, 1.0704,<br>0.7023, 0.9381, 1.3597]) ---<br>--- Statistics have been computed! ---<br>--- Start clouds detection procedure ---<br>--- Computing cloud mask... ---<br> 100%<br>--- Converting raster cloud mask into vector map ---<br>Extracting areas...<br> 100%<br>Writing areas...<br> 100%<br>Building topology for vector map <cloud_v_5922@carla>...<br>Registering primitives...<br>Building areas...<br> 100%<br>Attaching islands...<br> 100%<br>Attaching centroids...<br> 100%<br>r.to.vect complete.<br>--- Cleaning geometries ---<br>[...]</div><div>--- Start removing misclassification from the shadow mask ---<br>--- Data preparation... ---<br>WARNING: Values in column <cat> will be overwritten<br>WARNING: Number of centroids exceeds number of areas: 24 > 22<br>WARNING: Number of duplicate centroids: 2<br>WARNING: Values in column <cat> will be overwritten<br>WARNING: Values in column <cat> will be overwritten<br>--- Reading mean sun zenith and azimuth from metadata file to compute<br>clouds shift ---<br>--- the mean sun Zenith is: 28.732 deg ---<br>--- the mean sun Azimuth is: 82.028 deg ---<br>--- Start computing the east and north clouds shift at steps of 100m of<br>clouds height---<br>Traceback (most recent call last):<br>  File "/home/veroandreo/.grass7/addons/scripts/i.sentinel.mask", line 638, in <module><br>    main()<br>  File "/home/veroandreo/.grass7/addons/scripts/i.sentinel.mask", line 561, in main<br>    quiet=True, stderr=subprocess.DEVNULL)<br>  File "/home/veroandreo/software/grass79-dev/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 499, in run_command<br>    return handle_errors(returncode, result=None, args=args, kwargs=kwargs)<br>  File "/home/veroandreo/software/grass79-dev/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 392, in handle_errors<br>    returncode=returncode)<br>grass.exceptions.CalledModuleError: Module run v.overlay v.overlay --o --q ainput=addcat_5922 binput=cl_shift_5922 operator=and output=overlay_5922 ended with error<br>Process ended with non-zero return code 1. See errors in the (error) output.</div><div><br></div><div>Where is this error output to inspect?</div><div><br></div><div>This is the UUID in case you want to test: 541021f8-63f5-4e9d-ba28-425c4c8451df <br></div><div><br></div><div>Thanks much in advance</div><div>Vero</div><div><br></div><div>ps: I use grass-dev with python 3.7.4 (because of the ctypes issue)<br></div><div><br></div><div>  <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 29 ene. 2020 a las 14:53, Veronica Andreo (<<a href="mailto:veroandreo@gmail.com">veroandreo@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Robi, <br></div><div><br></div><div>My bad, region was wrong... anyway, trying to replicate from the beginning I see that i.sentinel.import with -r is importing empty maps. However, the jp2 files have data. I can visualize them in QGIS. I'll report in a different thread. Once I can figure it out and reach this point again, I'll report back to you. Thanks for the clarification!</div><div><br></div><div>Cheers<br></div>Vero<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 29 ene. 2020 a las 9:08, roberta fagandini (<<a href="mailto:robifagandini@hotmail.it" target="_blank">robifagandini@hotmail.it</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Vero,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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?</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Can you send the <span style="color:rgb(50,49,48);font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255);display:inline">MTD_TL.xml file? I can download the image and make some tests</span><span style="color:rgb(50,49,48);font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255);display:inline">.</span></div>
<div>
<div id="gmail-m_300678788419327291gmail-m_7941873122284512215appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Roberta</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_300678788419327291gmail-m_7941873122284512215divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Da:</b> grass-user <<a href="mailto:grass-user-bounces@lists.osgeo.org" target="_blank">grass-user-bounces@lists.osgeo.org</a>> per conto di Veronica Andreo <<a href="mailto:veroandreo@gmail.com" target="_blank">veroandreo@gmail.com</a>><br>
<b>Inviato:</b> martedì 28 gennaio 2020 19:57<br>
<b>A:</b> grass-user <<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>><br>
<b>Oggetto:</b> [GRASS-user] error in i.sentinel.mask: nan values in xml file</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hello</div>
<div><br>
</div>
<div>I try to use i.sentinel.mask but I get the following error:</div>
<div><br>
</div>
<div>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'`</div>
<div><br>
ADVERTENCIA: All subsequent operations will be limited to the current<br>
             computational region<br>
ADVERTENCIA: Any rescale factor has been applied<br>
--- Start computing maximum values of bands ---<br>
T21JYM_20200126T134201_B02_10m<br>
T21JYM_20200126T134201_B03_10m<br>
T21JYM_20200126T134201_B04_10m<br>
T21JYM_20200126T134201_B08_10m<br>
T21JYM_20200126T134201_B8A_20m<br>
T21JYM_20200126T134201_B11_20m<br>
T21JYM_20200126T134201_B12_20m<br>
--- Computed maximum value: dict_values([nan, nan, nan, nan, nan, nan,<br>
nan]) ---<br>
--- Statistics have been computed! ---<br>
--- Start clouds detection procedure ---<br>
--- Computing cloud mask... ---<br>
Mapa no válido <nan><br>
Parse error<br>
ERROR: error al parsear<br>
ERROR: An error occurred while running r.mapcalc with expression:<br>
       cloud_def82115 = if((((T21JYM_20200126T134201_B02_10m > (0.08*nan))<br>
       && (T21JYM_20200126T134201_B03_10m > (0.08*nan)) &&<br>
       (T21JYM_20200126T134201_B04_10m > (0.08*nan))) == 1) &&<br>
       (((T21JYM_20200126T134201_B04_10m < ((0.08*nan)*1.5)) &&<br>
       (T21JYM_20200126T134201_B04_10m ><br>
       T21JYM_20200126T134201_B12_20m*1.3)) == 0) &&<br>
       (((T21JYM_20200126T134201_B11_20m < (0.1*nan)) &&<br>
       (T21JYM_20200126T134201_B12_20m < (0.1*nan))) == 0) &&<br>
       ((if(T21JYM_20200126T134201_B8A_20m ==<br>
       max(T21JYM_20200126T134201_B8A_20m, 2 *<br>
       T21JYM_20200126T134201_B02_10m, 2 * T21JYM_20200126T134201_B03_10m,<br>
       2 * T21JYM_20200126T134201_B04_10m))) == 0) &&<br>
       ((T21JYM_20200126T134201_B02_10m > 0.2) == 1), 0, null())<br>
</div>
<div><br>
</div>
<div>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:
<a href="https://github.com/OSGeo/grass-addons/blob/master/grass7/imagery/i.sentinel/i.sentinel.mask/i.sentinel.mask.py#L321" target="_blank">
https://github.com/OSGeo/grass-addons/blob/master/grass7/imagery/i.sentinel/i.sentinel.mask/i.sentinel.mask.py#L321</a> recognize them? Isn't there a way to avoid nan while computing max?<br>
</div>
<div><br>
</div>
<div>Thanks much in advance</div>
<div>Vero</div>
<div><br>
</div>
<div>ps: I can provide the xml if needed. <br>
</div>
</div>
</div>
</div>
</div>

</blockquote></div>
</blockquote></div>