<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 22, 2018 at 3:17 PM, Markus Metz <span dir="ltr"><<a href="mailto:markus.metz.giswork@gmail.com" target="_blank">markus.metz.giswork@gmail.com</a>></span> wrote:<br><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><div><span class="gmail-"><div><br><br>On Mon, Jan 22, 2018 at 1:01 PM, Žofie Cimburová <<a href="mailto:zoficimburova@gmail.com" target="_blank">zoficimburova@gmail.com</a>> wrote:<br>><br>> Dear list,<br>> I came across another strange behaviour in i.atcorr used for Sentinel 2A data - for most of the scenes I process, the output of i.atcorr (for each band) is correct (i.e. contains values), but for several scenes, the output (for each band) contains just -nans. I thought this is caused by the input scenes, but apparently, it is rather caused by the date (line 2, first two numbers) in the 6s file. Some days in the 6s file lead to a correct result, other days in the 6s file lead to -nans.<br>><br>> Example:<br>> date in 6s file = 08 16<br>> i.atcorr input=S2A_20160816.B02 range=0,10000 elevation=dem_10m parameters=param_6s_20160816.<wbr>txt output=S2A_20160816.B02_<wbr>atcorr1<br>> -> only -nans in output map<br><br></div></span>I get values in the output with Debian testing and G7.4 with latest i.atcorr r72101. Please update your GRASS version.<br></div></div></div></blockquote><div><br></div><div style="font-size:12.8px">Yes, in the latest version the problem doesn't occur. Thanks for testing Markus M!</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">There is one more thing I am not sure about - can the geometrical conditions parameter and sensor bands parameter used for Sentinel2-A (i.e. 25 and 166-178) be used for Sentinel2-B as well? <br></div><div style="font-size:12.8px"> </div><div style="font-size:12.8px"><div>Thanks,</div></div><div><span style="font-size:12.8px">Zofie</span> </div><div><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><div> <br></div></div></div></blockquote><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><div></div>BTW, the 6s file has 166 as band number which is band 1, but the example seems to be band 2 -> should be 167 in the 6s file.<br><br></div>Markus M<div><div class="gmail-h5"><br><br><div><div><div><div>><br>> date in 6s file = 09 05<br>> i.atcorr input=S2A_20160816.B02 range=0,10000 elevation=dem_10m parameters=param_6s_20160905.<wbr>txt output=S2A_20160816.B02_<wbr>atcorr2<br>> -> values in output map<br>><br>> date in 6s file = 08 16<br>> i.atcorr input=S2A_20160905.B02 range=0,10000 elevation=dem_10m parameters=param_6s_20160816.<wbr>txt output=S2A_20160905.B02_<wbr>atcorr3<br>> -> only -nans in output map<br>><br>> date in 6s file = 09 05<br>> i.atcorr input=S2A_20160905.B02 range=0,10000 elevation=dem_10m parameters=param_6s_20160905.<wbr>txt output=S2A_20160905.B02_<wbr>atcorr4<br>> -> values in output map<br>><br>> Version:<br>> g.version -g<br>> version=7.4.0svn<br>> date=2017<br>> revision=r71960M<br>> build_date=2017-12-22<br>> build_platform=x86_64-pc-<wbr>linux-gnu<br>> build_off_t_size=8<br>><br>> I checked the verbose module output, and the only difference is (obviously) in solar zenith angle, solar azimuth angle, view zenith angle etc., but these values look correct in all cases. <br>><br>> Could this be caused by numerical instability as in the previous problem? The data (two scenes, DEM and two 6s files) can be downloaded from here, it would be great if someone could check whether the issue occurs as well.<br>> <a href="https://www.dropbox.com/sh/ntg46stpjhxyqov/AADVBHVHHI_ap1W32kqesaHna?dl=0" target="_blank">https://www.dropbox.com/sh/<wbr>ntg46stpjhxyqov/AADVBHVHHI_<wbr>ap1W32kqesaHna?dl=0</a><br>><br>><br>> Thanks a lot.<br>> Zofie<br>><br>><br>><br>><br>><br>><br>><br>><br>><br>><br>> On Mon, Jan 8, 2018 at 9:01 AM, Stefan Blumentrath <<a href="mailto:Stefan.Blumentrath@nina.no" target="_blank">Stefan.Blumentrath@nina.no</a>> wrote:<br>>><br>>> Hi,<br>>><br>>>  <br>>><br>>> This is how you can patch i.atcorr and compile into home dir.:<br>>><br>>>  <br>>><br>>> svn checkout <a href="https://svn.osgeo.org/grass/grass/branches/releasebranch_7_4" target="_blank">https://svn.osgeo.org/grass/<wbr>grass/branches/releasebranch_<wbr>7_4</a> grass_74<br>>><br>>> cd grass_74<br>>><br>>> wget <a href="https://trac.osgeo.org/grass/raw-attachment/ticket/3469/i_atcorr_double.patch" target="_blank">https://trac.osgeo.org/grass/<wbr>raw-attachment/ticket/3469/i_<wbr>atcorr_double.patch</a><br>>><br>>> patch -p0 -i i_atcorr_double.patch<br>>><br>>> CFLAGS=”-g -Wall -Wextra -Wpedantic -Wshadow -Wno-sign-compare -fno-common -fexceptions -Werror=implicit-function-<wbr>declaration -Wp,-D_FORTIFY_SOURCE=2 -O3 -fno-fast-math” CXXFLAGS=”-g -Wall -Wextra -Wpedantic -Wshadow -Wno-sign-compare -fno-common -fexceptions -Werror=implicit-function-<wbr>declaration -Wp,-D_FORTIFY_SOURCE=2 -O3 -fno-fast-math” ./configure --with-cxx --with-sqlite --with-postgres --with-postgres-includes=/usr/<wbr>include/postgresql --with-odbc --with-cairo --with-proj-share=/usr/local/<wbr>share/proj --with-tcltk-includes=/usr/<wbr>include/tcl8.4/ --with-freetype --with-freetype-includes=/usr/<wbr>include/freetype2 --with-fftw --with-nls --with-python --with-tiff --with-geos --enable-largefile --with-readline --with-blas --with-glw --with-motif --with-openmp --with-wxwidgets --with-liblas --with-netcdf --with-lapack --with-mysql-includes=/usr/<wbr>include/mysql --with-mysql --with-opencl --with-pdal --with-bzlib –prefix=~/<br>>><br>>> make –j 20<br>>><br>>> make install<br>>><br>>>  <br>>><br>>> Cheers<br>>><br>>> Stefan<br>>><br>>>  <br>>><br>>> From: grass-user [mailto:<a href="mailto:grass-user-bounces@lists.osgeo.org" target="_blank">grass-user-bounces@<wbr>lists.osgeo.org</a>] On Behalf Of Žofie Cimburová<br>>> Sent: mandag 18. desember 2017 16.14<br>>> To: Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>><br>>> Cc: GRASS user list <<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>><br>>> Subject: Re: [GRASS-user] i.atcorr with Sentinel2<br>>><br>>>  <br>>><br>>> Dear Moritz,<br>>><br>>>  <br>>><br>>> According to <a href="https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types" target="_blank">https://earth.esa.int/web/<wbr>sentinel/user-guides/sentinel-<wbr>2-msi/product-types</a> , the L1C product I am using already is in top of atmosphere reflectance, so this should not be the problem (?). <br>>><br>>> I tried running i.atcorr both with and without the -r flag.<br>>><br>>>  <br>>><br>>> Zofie<br>>><br>>>  <br>>><br>>> On Mon, Dec 18, 2017 at 3:35 PM, Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>> wrote:<br>>><br>>> On 18/12/17 13:14, Žofie Cimburová wrote:<br>>><br>>> Hi all,<br>>> Now the 6S parameters are complete, but the output map contains only NULLs, no matter what combinations of input parameters and flags I use. Have anyone encountered the same issue? (Info below.)<br>>><br>>><br>>> In the i.atcorr man page it says:<br>>><br>>> "If flag -r is used, the input raster data are treated as reflectance. Otherwise, the input raster data are treated as radiance values"<br>>><br>>> IIUC, your data is still in DN. You might want to try to transform this into radiance values before sending it into i.atcorr.<br>>><br>>> Moritz<br>>><br>>><br>>> Thanks again.<br>>> Zofie<br>>><br>>> ------------------------------<wbr>----------<br>>> Version:<br>>> g.version -g<br>>> version=7.4.0RC1<br>>> date=2017<br>>> revision=exported<br>>> build_date=2017-11-18<br>>> build_platform=x86_64-pc-<wbr>linux-gnu<br>>> build_off_t_size=8<br>>><br>>> ------------------------------<wbr>----------<br>>> Region:<br>>> g.region -p<br>>> projection: 1 (UTM)<br>>> zone:       33<br>>> datum:      etrs89<br>>> ellipsoid:  grs80<br>>> north:      6653695<br>>> south:      6643685<br>>> west:       256495<br>>> east:       266505<br>>> nsres:      10<br>>> ewres:      10<br>>> rows:       1001<br>>> cols:       1001<br>>> cells:      1002001<br>>><br>>> ------------------------------<wbr>----------<br>>> Input data: Sentinel2 L1C product B02 (tried with B01 too)<br>>><br>>> <a href="http://r.info" target="_blank">r.info</a> <<a href="http://r.info" target="_blank">http://r.info</a>> map=test_B02@p_<wbr>Sentinel4Nature_S2_Oslo<br>>>   +-----------------------------<wbr>------------------------------<wbr>-----------------+<br>>>   | Map:      test_B02@p_Sentinel4Nat  Date: Wed Dec  6 12:06:39 2017<br>>>   | Mapset:   p_Sentinel4Nature_S2_Oslo      Login of Creator: stefan.blumentr<br>>>   | Location: ETRS_33N<br>>>   | DataBase: /data/grass<br>>>   | Title:    S2A_OPER_PRD_MSIL1C_PDMC_<wbr>20160907T044118_R008_<wbr>V20160905T104022_2<br>>>   | Timestamp: none<br>>>   |-----------------------------<wbr>------------------------------<wbr>-----------------|<br>>>   |<br>>>   |   Type of Map:  raster               Number of Categories: 0<br>>>   |   Data Type:    CELL<br>>>   |   Rows:         1001<br>>>   |   Columns:      1001<br>>>   |   Total Cells:  1002001<br>>>   |        Projection: UTM (zone 33)<br>>>   |            N:    6653695    S:    6643685   Res:    10<br>>>   |            E:     266505    W:     256495   Res:    10<br>>>   |   Range of data:    min = 1  max = 28000<br>>>   |<br>>>   |   Data Description:<br>>>   |    generated by r.in.gdal<br>>>   +-----------------------------<wbr>------------------------------<wbr>-----------------+<br>>><br>>> ------------------------------<wbr>----------<br>>> 6s file:<br>>> 25- geometrical conditions=Sentinel-2A<br>>> 9 5 10.6728 10.73413 59.90647- month day hh.ddd longitude latitude<br>>> 4 - atmospheric model=subarctic summer<br>>> 3- aerosol model=urban<br>>> 50- visibility [km] (aerosol model concentration) (this is estimated, I also tried with AOD specified)<br>>> -0.055- mean target elevation above sea level [km]<br>>> -1000- sensor height<br>>> 166- Sentinel2A Blue band B2 (440nm - 535nm)<br>>><br>>> ------------------------------<wbr>----------<br>>> Command:<br>>> i.atcorr input=test_B02@p_<wbr>Sentinel4Nature_S2_Oslo range=1,28000 elevation=dem_10m_25833@p_<wbr>Sentinel4Nature_S2_Oslo parameters=/home/<a href="http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt" target="_blank">NINA.NO/<wbr>zofie.cimburova/<wbr>Sentinel4Nature/DATA/6s.txt</a> <<a href="http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt" target="_blank">http://NINA.NO/zofie.<wbr>cimburova/Sentinel4Nature/<wbr>DATA/6s.txt</a>> output=test_B02_atcorr<br>>>  >Atmospheric correction...<br>>>  >Atmospheric correction complete.<br>>><br>>> (I am not sure about the range parameter, tried with 0,255 too. The DEM contains no NULLs. Also tried running with -r and -a flags.)<br>>><br>>> ------------------------------<wbr>----------<br>>> Output:<br>>> <a href="http://r.info" target="_blank">r.info</a> <<a href="http://r.info" target="_blank">http://r.info</a>> map=test_B02_atcorr@p_<wbr>Sentinel4Nature_S2_Oslo<br>>>   +-----------------------------<wbr>------------------------------<wbr>-----------------+<br>>>   | Map:      test_B02_atcorr@p_Sentinel4N  Date: Mon Dec 18 13:10:14 2017<br>>>   | Mapset:   p_Sentinel4Nature_S2_Oslo      Login of Creator: zofie.cimburova<br>>>   | Location: ETRS_33N<br>>>   | DataBase: /data/grass<br>>>   | Title:    test_B02_atcorr2<br>>>   | Timestamp: none<br>>>   |-----------------------------<wbr>------------------------------<wbr>-----------------|<br>>>   |<br>>>   |   Type of Map:  raster               Number of Categories: 0<br>>>   |   Data Type:    FCELL<br>>>   |   Rows:         1001<br>>>   |   Columns:      1001<br>>>   |   Total Cells:  1002001<br>>>   |        Projection: UTM (zone 33)<br>>>   |            N:    6653695    S:    6643685   Res:    10<br>>>   |            E:     266505    W:     256495   Res:    10<br>>>   |   Range of data:    min = -nan  max = -nan<br>>>   |<br>>>   |   Data Description:<br>>>   |    generated by i.atcorr<br>>>   |<br>>>   |   Comments:<br>>>   |    i.atcorr input="test_B02@p_<wbr>Sentinel4Nature_S2_Oslo" range=1,28\<br>>>   |    000 elevation="dem_10m_25833@p_<wbr>Sentinel4Nature_S2_Oslo" para\<br>>>   |    meters="/home/<a href="http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt" target="_blank">NINA.NO/zofie.<wbr>cimburova/Sentinel4Nature/<wbr>DATA/6s.txt</a> <<a href="http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt" target="_blank">http://NINA.NO/zofie.<wbr>cimburova/Sentinel4Nature/<wbr>DATA/6s.txt</a>>" o\<br>>>   |    utput="test_B02_atcorr2" rescale=0,255<br>>>   |<br>>>   +-----------------------------<wbr>------------------------------<wbr>-----------------+<br>>><br>>><br>>><br>>> On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová <<a href="mailto:zoficimburova@gmail.com" target="_blank">zoficimburova@gmail.com</a> <mailto:<a href="mailto:zoficimburova@gmail.com" target="_blank">zoficimburova@gmail.<wbr>com</a>>> wrote:<br>>><br>>>     Dear Markus,<br>>>     thanks for your reply, this is exactly what I need to know!<br>>><br>>>     Best, Zofie<br>>><br>>>     On Fri, Dec 15, 2017 at 5:09 PM, Markus Neteler <<a href="mailto:neteler@osgeo.org" target="_blank">neteler@osgeo.org</a><br>>>     <mailto:<a href="mailto:neteler@osgeo.org" target="_blank">neteler@osgeo.org</a>>> wrote:<br>>><br>>><br>>>         On Dec 15, 2017 3:54 PM, "Žofie Cimburová"<br>>>         <<a href="mailto:zoficimburova@gmail.com" target="_blank">zoficimburova@gmail.com</a> <mailto:<a href="mailto:zoficimburova@gmail.com" target="_blank">zoficimburova@gmail.<wbr>com</a>>> wrote:<br>>>         ><br>>>         > Dear all,<br>>>         > I am trying to use i.atcorr (GRASS 7.4) to apply atmospheric corrections for Sentinel 2 data. The documentation provides a great help, but there are two points I am not sure about -         ><br>>>         > - I don't need the atmospheric correction to be applied to the whole scene, so I only imported a small clip of the scene to GRASS. What longitude and latitude shall I then specify in the 6S parameters?<br>>><br>>>         I'd use the center coordinates of the clipped area.<br>>><br>>>         > Or is it necessary to apply the corrections to the entire scene?<br>>><br>>>         No since it is a pixel based algorithm.<br>>><br>>>         > - How can I estimate the value of visibility (aerosol model concentration)?<br>>>         There are AERONET data online somewhere which might be the best<br>>>         choice.<br>>><br>>>         Markus<br>>><br>>><br>>><br>>><br>>><br>>> ______________________________<wbr>_________________<br>>> grass-user mailing list<br>>> <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/grass-user</a><br>>><br>>>  <br>>><br>>>  <br>><br>><br>><br>> ______________________________<wbr>_________________<br>> grass-user mailing list<br>> <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/grass-user</a><br><br></div></div></div></div></div></div></div>
</blockquote></div><br></div></div>