[GRASS-user] i.atcorr with Sentinel2
Žofie Cimburová
zoficimburova at gmail.com
Mon Jan 22 04:01:01 PST 2018
Dear list,
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.
Example:
date in 6s file = 08 16
i.atcorr input=S2A_20160816.B02 range=0,10000 elevation=dem_10m
parameters=param_6s_20160816.txt output=S2A_20160816.B02_atcorr1
-> only -nans in output map
date in 6s file = 09 05
i.atcorr input=S2A_20160816.B02 range=0,10000 elevation=dem_10m
parameters=param_6s_20160905.txt output=S2A_20160816.B02_atcorr2
-> values in output map
date in 6s file = 08 16
i.atcorr input=S2A_20160905.B02 range=0,10000 elevation=dem_10m
parameters=param_6s_20160816.txt output=S2A_20160905.B02_atcorr3
-> only -nans in output map
date in 6s file = 09 05
i.atcorr input=S2A_20160905.B02 range=0,10000 elevation=dem_10m
parameters=param_6s_20160905.txt output=S2A_20160905.B02_atcorr4
-> values in output map
Version:
g.version -g
version=7.4.0svn
date=2017
revision=r71960M
build_date=2017-12-22
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
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.
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.
https://www.dropbox.com/sh/ntg46stpjhxyqov/AADVBHVHHI_ap1W32kqesaHna?dl=0
Thanks a lot.
Zofie
On Mon, Jan 8, 2018 at 9:01 AM, Stefan Blumentrath <
Stefan.Blumentrath at nina.no> wrote:
> Hi,
>
>
>
> This is how you can patch i.atcorr and compile into home dir.:
>
>
>
> svn checkout https://svn.osgeo.org/grass/grass/branches/releasebranch_7_4
> grass_74
>
> cd grass_74
>
> wget https://trac.osgeo.org/grass/raw-attachment/ticket/3469/i_
> atcorr_double.patch
>
> patch -p0 -i i_atcorr_double.patch
>
> CFLAGS=”-g -Wall -Wextra -Wpedantic -Wshadow -Wno-sign-compare -fno-common
> -fexceptions -Werror=implicit-function-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-declaration -Wp,-D_FORTIFY_SOURCE=2 -O3
> -fno-fast-math” ./configure --with-cxx --with-sqlite --with-postgres
> --with-postgres-includes=/usr/include/postgresql --with-odbc --with-cairo
> --with-proj-share=/usr/local/share/proj --with-tcltk-includes=/usr/include/tcl8.4/
> --with-freetype --with-freetype-includes=/usr/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/include/mysql --with-mysql --with-opencl
> --with-pdal --with-bzlib –prefix=~/
>
> make –j 20
>
> make install
>
>
>
> Cheers
>
> Stefan
>
>
>
> *From:* grass-user [mailto:grass-user-bounces at lists.osgeo.org] *On Behalf
> Of *Žofie Cimburová
> *Sent:* mandag 18. desember 2017 16.14
> *To:* Moritz Lennert <mlennert at club.worldonline.be>
> *Cc:* GRASS user list <grass-user at lists.osgeo.org>
> *Subject:* Re: [GRASS-user] i.atcorr with Sentinel2
>
>
>
> Dear Moritz,
>
>
>
> According to https://earth.esa.int/web/sentinel/user-guides/sentinel-
> 2-msi/product-types , the L1C product I am using already is in top of
> atmosphere reflectance, so this should not be the problem (?).
>
> I tried running i.atcorr both with and without the -r flag.
>
>
>
> Zofie
>
>
>
> On Mon, Dec 18, 2017 at 3:35 PM, Moritz Lennert <
> mlennert at club.worldonline.be> wrote:
>
> On 18/12/17 13:14, Žofie Cimburová wrote:
>
> Hi all,
> 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.)
>
>
> In the i.atcorr man page it says:
>
> "If flag -r is used, the input raster data are treated as reflectance.
> Otherwise, the input raster data are treated as radiance values"
>
> IIUC, your data is still in DN. You might want to try to transform this
> into radiance values before sending it into i.atcorr.
>
> Moritz
>
>
> Thanks again.
> Zofie
>
> ----------------------------------------
> Version:
> g.version -g
> version=7.4.0RC1
> date=2017
> revision=exported
> build_date=2017-11-18
> build_platform=x86_64-pc-linux-gnu
> build_off_t_size=8
>
> ----------------------------------------
> Region:
> g.region -p
> projection: 1 (UTM)
> zone: 33
> datum: etrs89
> ellipsoid: grs80
> north: 6653695
> south: 6643685
> west: 256495
> east: 266505
> nsres: 10
> ewres: 10
> rows: 1001
> cols: 1001
> cells: 1002001
>
> ----------------------------------------
> Input data: Sentinel2 L1C product B02 (tried with B01 too)
>
> r.info <http://r.info> map=test_B02 at p_Sentinel4Nature_S2_Oslo
> +---------------------------------------------------------
> -------------------+
> | Map: test_B02 at p_Sentinel4Nat Date: Wed Dec 6 12:06:39 2017
> | Mapset: p_Sentinel4Nature_S2_Oslo Login of Creator:
> stefan.blumentr
> | Location: ETRS_33N
> | DataBase: /data/grass
> | Title: S2A_OPER_PRD_MSIL1C_PDMC_20160907T044118_R008_
> V20160905T104022_2
> | Timestamp: none
> |---------------------------------------------------------
> -------------------|
> |
> | Type of Map: raster Number of Categories: 0
> | Data Type: CELL
> | Rows: 1001
> | Columns: 1001
> | Total Cells: 1002001
> | Projection: UTM (zone 33)
> | N: 6653695 S: 6643685 Res: 10
> | E: 266505 W: 256495 Res: 10
> | Range of data: min = 1 max = 28000
> |
> | Data Description:
> | generated by r.in.gdal
> +---------------------------------------------------------
> -------------------+
>
> ----------------------------------------
> 6s file:
> 25- geometrical conditions=Sentinel-2A
> 9 5 10.6728 10.73413 59.90647- month day hh.ddd longitude latitude
> 4 - atmospheric model=subarctic summer
> 3- aerosol model=urban
> 50- visibility [km] (aerosol model concentration) (this is estimated, I
> also tried with AOD specified)
> -0.055- mean target elevation above sea level [km]
> -1000- sensor height
> 166- Sentinel2A Blue band B2 (440nm - 535nm)
>
> ----------------------------------------
> Command:
> i.atcorr input=test_B02 at p_Sentinel4Nature_S2_Oslo range=1,28000
> elevation=dem_10m_25833 at p_Sentinel4Nature_S2_Oslo parameters=/home/
> NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt <http://NINA.NO/zofie.
> cimburova/Sentinel4Nature/DATA/6s.txt> output=test_B02_atcorr
> >Atmospheric correction...
> >Atmospheric correction complete.
>
> (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.)
>
> ----------------------------------------
> Output:
> r.info <http://r.info> map=test_B02_atcorr at p_Sentinel4Nature_S2_Oslo
> +---------------------------------------------------------
> -------------------+
> | Map: test_B02_atcorr at p_Sentinel4N Date: Mon Dec 18 13:10:14 2017
> | Mapset: p_Sentinel4Nature_S2_Oslo Login of Creator:
> zofie.cimburova
> | Location: ETRS_33N
> | DataBase: /data/grass
> | Title: test_B02_atcorr2
> | Timestamp: none
> |---------------------------------------------------------
> -------------------|
> |
> | Type of Map: raster Number of Categories: 0
> | Data Type: FCELL
> | Rows: 1001
> | Columns: 1001
> | Total Cells: 1002001
> | Projection: UTM (zone 33)
> | N: 6653695 S: 6643685 Res: 10
> | E: 266505 W: 256495 Res: 10
> | Range of data: min = -nan max = -nan
> |
> | Data Description:
> | generated by i.atcorr
> |
> | Comments:
> | i.atcorr input="test_B02 at p_Sentinel4Nature_S2_Oslo" range=1,28\
> | 000 elevation="dem_10m_25833 at p_Sentinel4Nature_S2_Oslo" para\
> | meters="/home/NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt <
> http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt>" o\
> | utput="test_B02_atcorr2" rescale=0,255
> |
> +---------------------------------------------------------
> -------------------+
>
>
>
> On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová <zoficimburova at gmail.com
> <mailto:zoficimburova at gmail.com>> wrote:
>
> Dear Markus,
> thanks for your reply, this is exactly what I need to know!
>
> Best, Zofie
>
> On Fri, Dec 15, 2017 at 5:09 PM, Markus Neteler <neteler at osgeo.org
> <mailto:neteler at osgeo.org>> wrote:
>
>
> On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
> <zoficimburova at gmail.com <mailto:zoficimburova at gmail.com>> wrote:
> >
> > Dear all,
> > 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 - >
> > - 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?
>
> I'd use the center coordinates of the clipped area.
>
> > Or is it necessary to apply the corrections to the entire scene?
>
> No since it is a pixel based algorithm.
>
> > - How can I estimate the value of visibility (aerosol model
> concentration)?
> There are AERONET data online somewhere which might be the best
> choice.
>
> Markus
>
>
>
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180122/ee5e2f2c/attachment-0001.html>
More information about the grass-user
mailing list