Re: i.atcorr with Sentinel2

Sajid Pareeth <[email protected]>
Newsgroups gmane.comp.gis.grass.user
Message-ID <CAO7vHBES+cPzJQvBrBpMDRFqK51qF6taHnG4AgMZj318QH2rhA@mail.gmail.com>
Dear Stefan

I have applied i.atcorr to many S2A scenes last year and it worked. Today I
rechecked them again, and it worked on a older svn version (7.3) and also
on the latest trunk version.

All the steps I have taken is similar to what you have done, so I dont
really know whats going wrong with you.

Here is the command I used:

i.atcorr -r input="S2A_OPER_MSI_L1C_TL_MTI_20151012T101024457Z_T32TPR_B02"
> range=0,10000 elevation="eudem_euregio_utm32_10m"
> parameters="S2_B02_T32TPR.txt"
> output="S2A_OPER_MSI_L1C_TL_MTI_20151012T101024457Z_T32TPR_02_6S"
> rescale=0,10000
>


S2_B02_T32TPR.txt:
[image: Inline image 1]


The AOD value is coming from the output of Sen2cor (It was a trial approach
!). I tried with a visibility value of 15 and it works.

And the ouput of r.univar is:

[image: Inline image 2]


I also tried it on a smaller clip (1000 X 1000), and it is giving some
output.

Let me know if you need any more info.

Regards

Sajid


On Tue, Dec 19, 2017 at 11:33 AM, Stefan Blumentrath <
[email protected]> wrote:

> Hi again,
>
> Even with constant spectral conditions and values for filter function from
> Sentinel-2, all combinations of input band ranges result in empty maps.
> Constant spectral conditions and values for filter function from  Landsat7
> however, give results in the expected scale (0-255) regardless input image
> and value ranges...
>
> Shall I open a ticket?
>
> Any idea/chance to get this new feature in G7.4 to work...?
>
> Any pointer/help would be very much appreciated!
>
> Cheers
> Stefan
>
> -----Original Message-----
> From: Stefan Blumentrath
> Sent: tirsdag 19. desember 2017 10.56
> To: Stefan Blumentrath <[email protected]>; Moritz Lennert <
> [email protected]>; Žofie Cimburová <[email protected]>
> Cc: GRASS user list <[email protected]>
> Subject: RE: [GRASS-user] i.atcorr with Sentinel2
>
> Hi again,
>
> Still trying to track down the issue...
> I now ran i.atcorr with constant spectral condition and manually defined
> "wl inf" and "wl sup".
>
> First I got those values for Sentinel-2 band 2:
> *                        spectral condition
>      *
> *                        ------------------
>      *
> *            sentinel2a blue b2
>      *
> *                value of filter function :
>      *
> *                 wl inf=    0.300 mic   wl sup=    2.600 mic
>     *
>
> Then for Landsat 7 band 4 (that was known to give results):
> *                        spectral condition
>      *
> *                        ------------------
>      *
> *            etm+ 4
>      *
> *                value of filter function :
>      *
> *                 wl inf=    0.740 mic   wl sup=    0.913 mic
>     *
>
>
> If I then feed those values into a filter function for constant spectral
> conditions, and again the Sentinel-2 values:
> *                        spectral condition
>      *
> *                        ------------------
>      *
> *            constant
>      *
> *                value of filter function :
>      *
> *                 wl inf=    0.300 mic   wl sup=    2.600 mic
>     *
> lead to empty maps, while Landsat7 values:
> *                        spectral condition
>      *
> *                        ------------------
>      *
> *            constant
>      *
> *                value of filter function :
>      *
> *                 wl inf=    0.740 mic   wl sup=    0.913 mic
>     *
> work fine (with all other settings being equal).
>
> That makes me suspect that the values of the Sentinel-2 filter function
> are actually causing the issue here...
> I am currently testing all thinkable combinations of input band ranges to
> see if any of them works with wl inf=0.300 mic and wl sup=2.600 mic and
> will report back from that exercise.
>
> Meanwhile, can anyone confirm that i.atcorr in GRASS 7.4.0RC1 actually
> works with Sentinel-2 data?
>
> Cheers
> Stefan
>
>
>
> -----Original Message-----
> From: grass-user [mailto:[email protected]] On Behalf Of
> Stefan Blumentrath
> Sent: tirsdag 19. desember 2017 08.45
> To: Moritz Lennert <[email protected]>; Žofie Cimburová <
> [email protected]>
> Cc: GRASS user list <[email protected]>
> Subject: Re: [GRASS-user] i.atcorr with Sentinel2
>
> Hi again,
>
> A little update on the problem:
> Now I ran i.atcorr with all possible band values for Sentinel-2 in the 6s
> parameters (166-178) with input maps ranges scaled to 0-1, 0-255, 0-10000
> All runs resulted in completely empty maps!
> Any ideas?
>
> Thanks for helping in advance!
>
> Kind regards,
> Stefan
>
> -----Original Message-----
> From: Moritz Lennert [mailto:[email protected]]
> Sent: mandag 18. desember 2017 16.58
> To: Stefan Blumentrath <[email protected]>; Žofie Cimburová <
> [email protected]>
> Cc: GRASS user list <[email protected]>
> Subject: Re: [GRASS-user] i.atcorr with Sentinel2
>
> On 18/12/17 16:35, Stefan Blumentrath wrote:
> > Hi Moritz,
> >
> > Thanks for helping with troubleshooting!
> > QUANTIFICATION_VALUE is 10000, Thus dividing with it gives a maximum
> value of 2.8...
> > Any idea how to figure out if it is 12 or 16 bit image. It is directly
> downloaded from ESA...
>
> Check which proportion of the image is > 1. AFAIR (which is a bit
> limited), you might have reflectances above 1 in saturated pixels. I just
> checked on a random image and I also have some pixels above 1, but only
> 0.25% of the pixels:
>
> GRASS 7.5.svn (UTM32N):/data/home/mlennert > r.mapcalc "test =
> if(b04_refl>1,1,0)"
>   100%
> GRASS 7.5.svn (UTM32N):/data/home/mlennert > r.stats -cp test
>   100%
> 0 120259106 99.75%
> 1 301294 0.25%
>
> And all the pixels with value 1 are in clouded areas.
>
> Moritz
>
> >
> > Cheers
> > Stefan
> >
> > -----Original Message-----
> > From: grass-user [mailto:[email protected]] On Behalf
> > Of Moritz Lennert
> > Sent: mandag 18. desember 2017 16.26
> > To: Žofie Cimburová <[email protected]>
> > Cc: GRASS user list <[email protected]>
> > Subject: Re: [GRASS-user] i.atcorr with Sentinel2
> >
> > On 18/12/17 16:13, Žofie Cimburová wrote:
> >> 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.
> >
> > Reflectance is the percentage of light that is reflected either from
> > the top of the atmosphere or from the surface. Reflectance values
> > should thus be real values between 0 and 1. Your data have
> >
> > Range of data:    min = 1  max = 28000
> >
> > This means that they are expressed in digital (integer) numbers. Try
> transforming these DN into real numbers. IIRC, in the metadata, you have a
> variable QUANTIFICATION_VALUE. Divide your pixel values by that value to
> get real TOA reflectance values.
> >
> > AFAIK, it also depends on whether you directly imported the original
> 12-bit file, or possibly a modified, e.g. 16-bit, version.
> >
> > Moritz
> >
> >> On Mon, Dec 18, 2017 at 3:35 PM, Moritz Lennert
> >> <[email protected] <mailto:[email protected]>>
> 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> <http://r.info>
> >>          map=test_B02@p_Sentinel4Nature_S2_Oslo
> >>             +---------------------------------------------------------
> -------------------+
> >>             | Map:      test_B02@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@p_Sentinel4Nature_S2_Oslo
> range=1,28000
> >>          elevation=dem_10m_25833@p_Sentinel4Nature_S2_Oslo
> >>          parameters=/home/NINA.NO/zofie.cimburova/
> Sentinel4Nature/DATA/6s.txt
> >>          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt>
> >>          <http://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> <http://r.info>
> >>          map=test_B02_atcorr@p_Sentinel4Nature_S2_Oslo
> >>             +---------------------------------------------------------
> -------------------+
> >>             | Map:      test_B02_atcorr@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@p_Sentinel4Nature_S2_Oslo"
> >>          range=1,28\
> >>             |    000 elevation="dem_10m_25833@p_
> Sentinel4Nature_S2_Oslo"
> >>          para\
> >>             |
> >>          meters="/home/NINA.NO/zofie.cimburova/Sentinel4Nature/
> DATA/6s.txt <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt>
> >>          <http://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á
> >>          <[email protected] <mailto:[email protected]>
> >>          <mailto:[email protected]
> >>          <mailto:[email protected]>>> 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
> >>          <[email protected] <mailto:[email protected]>
> >>               <mailto:[email protected] <mailto:[email protected]>>>
> wrote:
> >>
> >>
> >>                   On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
> >>                   <[email protected]
> >>          <mailto:[email protected]> <mailto:zoficimburova@gmail.
> com
> >>          <mailto:[email protected]>>> 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
> >>          [email protected] <mailto:[email protected]>
> >>          https://lists.osgeo.org/mailman/listinfo/grass-user
> >>          <https://lists.osgeo.org/mailman/listinfo/grass-user>
> >>
> >>
> >>
> >>
> >
> >
> > _______________________________________________
> > grass-user mailing list
> > [email protected]
> > https://lists.osgeo.org/mailman/listinfo/grass-user
> >
>
>
> _______________________________________________
> grass-user mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/grass-user
> _______________________________________________
> grass-user mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/grass-user
>

_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user
image.png (image/png, 46.8 KB) - not displayed
image.png (image/png, 8 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.