[GRASS-user] i.atcorr with Sentinel2

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? Or is it necessary to apply the corrections to the entire scene? (In that case, do the latitude and longitude refer to the centre or to the corner of the scene?)

  • How can I estimate the value of visibility (aerosol model concentration)?

Thanks for any help!

Best regards,
Zofie

Zofie,

You could mask the area or set the region to include only the area you’re interested in

Tom

···

On Fri, Dec 15, 2017 at 9:53 AM, Žofie Cimburová <zoficimburova@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? Or is it necessary to apply the corrections to the entire scene? (In that case, do the latitude and longitude refer to the centre or to the corner of the scene?)

  • How can I estimate the value of visibility (aerosol model concentration)?

Thanks for any help!

Best regards,
Zofie


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Dec 15, 2017 3:54 PM, “Žofie Cimburová” <zoficimburova@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

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@osgeo.org> wrote:

On Dec 15, 2017 3:54 PM, “Žofie Cimburová” <zoficimburova@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

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.)

Thanks again.
Zofie

···

On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová <zoficimburova@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@osgeo.org> wrote:

On Dec 15, 2017 3:54 PM, “Žofie Cimburová” <zoficimburova@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

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@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&gt; 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@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&gt;&quot; o\
| utput="test_B02_atcorr2" rescale=0,255
|
+----------------------------------------------------------------------------+

On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová <zoficimburova@gmail.com <mailto:zoficimburova@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@osgeo.org
    <mailto:neteler@osgeo.org>> wrote:

        On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
        <zoficimburova@gmail.com <mailto:zoficimburova@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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

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@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@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> 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@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>” o\
utput=“test_B02_atcorr2” rescale=0,255
±---------------------------------------------------------------------------+

On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová <zoficimburova@gmail.com mailto:[zoficimburova@gmail.com](mailto:zoficimburova@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@osgeo.org
mailto:[neteler@osgeo.org](mailto:neteler@osgeo.org)> wrote:

On Dec 15, 2017 3:54 PM, “Žofie Cimburová”
<zoficimburova@gmail.com mailto:[zoficimburova@gmail.com](mailto:zoficimburova@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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

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 <mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
        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&gt;
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
          | utput="test_B02_atcorr2" rescale=0,255
          |
          +----------------------------------------------------------------------------+

        On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
        <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
        <mailto:zoficimburova@gmail.com
        <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
          <mailto:neteler@osgeo.org>> wrote:

          On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
          <zoficimburova@gmail.com
        <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
        <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
        https://lists.osgeo.org/mailman/listinfo/grass-user
        <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

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...

Cheers
Stefan

-----Original Message-----
From: grass-user [mailto:grass-user-bounces@lists.osgeo.org] On Behalf Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
        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&gt;
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
          | utput="test_B02_atcorr2" rescale=0,255
          |
         
+---------------------------------------------------------------------
-------+

        On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
        <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
        <mailto:zoficimburova@gmail.com
        <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
          <mailto:neteler@osgeo.org>> wrote:

          On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
          <zoficimburova@gmail.com
        <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
        <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
        https://lists.osgeo.org/mailman/listinfo/grass-user
        <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

P. S. Neither does it help to divide by 10000...
________________________________________
Von: grass-user [grass-user-bounces@lists.osgeo.org] im Auftrag von Stefan Blumentrath [Stefan.Blumentrath@nina.no]
Gesendet: Montag, 18. Dezember 2017 16:35
An: Moritz Lennert; Žofie Cimburová
Cc: GRASS user list
Betreff: Re: [GRASS-user] i.atcorr with Sentinel2

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...

Cheers
Stefan

-----Original Message-----
From: grass-user [mailto:grass-user-bounces@lists.osgeo.org] On Behalf Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
        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&gt;
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
        <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
           | utput="test_B02_atcorr2" rescale=0,255
           |

+---------------------------------------------------------------------
-------+

        On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
        <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
        <mailto:zoficimburova@gmail.com
        <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
             <mailto:neteler@osgeo.org>> wrote:

                 On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
                 <zoficimburova@gmail.com
        <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
        <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
        https://lists.osgeo.org/mailman/listinfo/grass-user
        <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

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:grass-user-bounces@lists.osgeo.org] On Behalf Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
         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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
           | utput="test_B02_atcorr2" rescale=0,255
           |
            +---------------------------------------------------------------------
-------+

         On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
         <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
         <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
           <mailto:neteler@osgeo.org>> wrote:

           On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
           <zoficimburova@gmail.com
         <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
         https://lists.osgeo.org/mailman/listinfo/grass-user
         <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

See also discussion here: http://forum.step.esa.int/t/the-quantification-value-has-a-true-value-dn-to-toa-reflectance/1220/

On 18/12/17 16:57, Moritz Lennert wrote:

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:grass-user-bounces@lists.osgeo.org] On Behalf Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
          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&gt;
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
            | utput="test_B02_atcorr2" rescale=0,255
            |
             +---------------------------------------------------------------------
-------+

          On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
          <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
          <mailto:zoficimburova@gmail.com
          <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
            <mailto:neteler@osgeo.org>> wrote:

            On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
            <zoficimburova@gmail.com
          <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
          <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
          https://lists.osgeo.org/mailman/listinfo/grass-user
          <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Dear Moritz,

Thanks so much for your help with trouble shooting! Very much appreciated!
We now tried all possible combinations of options and I rescaled the input band to 0-1 range. All without success.
Result is always just NULL (or nan without -i flag) for S2A.

However, changing the 6s parameters to some random Landsat band configuration worked with the provided input data and produced (of course incorrect but) result with content.

Now I think I was able to narrow it down to the last line in the 6s parameters, the sensor band configuration. i.atcorr with our input data worked with sensor band defined as e.g. 64 (Landsat 7 band 4) but everything we tested >= 166 for band definition returned empty raster (checking now all systematically).

Seems others had similar problems:
http://permalink.gmane.org/gmane.comp.gis.grass.user/53078
But I was not able to find a solution in existing posts, unfortunately...

Any idea what else we could try?

Cheers
Stefan

-----Original Message-----
From: Moritz Lennert [mailto:mlennert@club.worldonline.be]
Sent: mandag 18. desember 2017 17.06
To: Stefan Blumentrath <Stefan.Blumentrath@nina.no>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
Subject: Re: [GRASS-user] i.atcorr with Sentinel2

See also discussion here:
http://forum.step.esa.int/t/the-quantification-value-has-a-true-value-dn-to-toa-reflectance/1220/

On 18/12/17 16:57, Moritz Lennert wrote:

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:grass-user-bounces@lists.osgeo.org] On
Behalf Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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/produc
t- 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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
          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&gt;
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
          <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
            | utput="test_B02_atcorr2" rescale=0,255
            |
             
+-------------------------------------------------------------------
+--
-------+

          On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
          <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
          <mailto:zoficimburova@gmail.com
          <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
            <mailto:neteler@osgeo.org>> wrote:

            On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
            <zoficimburova@gmail.com
          <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
          <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
          https://lists.osgeo.org/mailman/listinfo/grass-user
          <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

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:mlennert@club.worldonline.be]
Sent: mandag 18. desember 2017 16.58
To: Stefan Blumentrath <Stefan.Blumentrath@nina.no>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:grass-user-bounces@lists.osgeo.org] On Behalf
Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
         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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
           | utput="test_B02_atcorr2" rescale=0,255
           |
            
+--------------------------------------------------------------------
+-
-------+

         On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
         <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
         <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
           <mailto:neteler@osgeo.org>> wrote:

           On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
           <zoficimburova@gmail.com
         <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
         https://lists.osgeo.org/mailman/listinfo/grass-user
         <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

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:grass-user-bounces@lists.osgeo.org] On Behalf Of Stefan Blumentrath
Sent: tirsdag 19. desember 2017 08.45
To: Moritz Lennert <mlennert@club.worldonline.be>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:mlennert@club.worldonline.be]
Sent: mandag 18. desember 2017 16.58
To: Stefan Blumentrath <Stefan.Blumentrath@nina.no>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:grass-user-bounces@lists.osgeo.org] On Behalf
Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
         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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
           | utput="test_B02_atcorr2" rescale=0,255
           |
            
+--------------------------------------------------------------------
+-
-------+

         On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
         <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
         <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
           <mailto:neteler@osgeo.org>> wrote:

           On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
           <zoficimburova@gmail.com
         <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
         https://lists.osgeo.org/mailman/listinfo/grass-user
         <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

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 <Stefan.Blumentrath@nina.no>; Moritz Lennert <mlennert@club.worldonline.be>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:grass-user-bounces@lists.osgeo.org] On Behalf Of Stefan Blumentrath
Sent: tirsdag 19. desember 2017 08.45
To: Moritz Lennert <mlennert@club.worldonline.be>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:mlennert@club.worldonline.be]
Sent: mandag 18. desember 2017 16.58
To: Stefan Blumentrath <Stefan.Blumentrath@nina.no>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:grass-user-bounces@lists.osgeo.org] On Behalf
Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be <mailto:mlennert@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> <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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;
         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&gt;
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt
         <http://NINA.NO/zofie.cimburova/Sentinel4Nature/DATA/6s.txt&gt;&gt;&quot; o\
           | utput="test_B02_atcorr2" rescale=0,255
           |
            
+--------------------------------------------------------------------
+-
-------+

         On Fri, Dec 15, 2017 at 5:12 PM, Žofie Cimburová
         <zoficimburova@gmail.com <mailto:zoficimburova@gmail.com>
         <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@osgeo.org <mailto:neteler@osgeo.org>
           <mailto:neteler@osgeo.org>> wrote:

           On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
           <zoficimburova@gmail.com
         <mailto:zoficimburova@gmail.com> <mailto:zoficimburova@gmail.com
         <mailto:zoficimburova@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@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
         https://lists.osgeo.org/mailman/listinfo/grass-user
         <https://lists.osgeo.org/mailman/listinfo/grass-user&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

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:

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:

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 <Stefan.Blumentrath@nina.no> 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 <Stefan.Blumentrath@nina.no>; Moritz Lennert <mlennert@club.worldonline.be>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>

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:grass-user-bounces@lists.osgeo.org] On Behalf Of Stefan Blumentrath
Sent: tirsdag 19. desember 2017 08.45
To: Moritz Lennert <mlennert@club.worldonline.be>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:mlennert@club.worldonline.be]
Sent: mandag 18. desember 2017 16.58
To: Stefan Blumentrath <Stefan.Blumentrath@nina.no>; Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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:grass-user-bounces@lists.osgeo.org] On Behalf
Of Moritz Lennert
Sent: mandag 18. desember 2017 16.26
To: Žofie Cimburová <zoficimburova@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
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
<mlennert@club.worldonline.be mailto:[mlennert@club.worldonline.be](mailto:mlennert@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> <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á
<zoficimburova@gmail.com mailto:[zoficimburova@gmail.com](mailto:zoficimburova@gmail.com)
<mailto:zoficimburova@gmail.com
mailto:[zoficimburova@gmail.com](mailto:zoficimburova@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@osgeo.org mailto:[neteler@osgeo.org](mailto:neteler@osgeo.org)
<mailto:neteler@osgeo.org mailto:[neteler@osgeo.org](mailto:neteler@osgeo.org)>> wrote:

On Dec 15, 2017 3:54 PM, “Žofie Cimburová”
<zoficimburova@gmail.com
mailto:[zoficimburova@gmail.com](mailto:zoficimburova@gmail.com) <mailto:zoficimburova@gmail.com
mailto:[zoficimburova@gmail.com](mailto:zoficimburova@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@lists.osgeo.org mailto:[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
https://lists.osgeo.org/mailman/listinfo/grass-user
<https://lists.osgeo.org/mailman/listinfo/grass-user>


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

To add, I have used the input as such with out applying the quantification
value.

>> ----------------------------------------
>> 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)

Just noticed, the last parameter should be 167 for Sentinel B2.

Sajid

Dear Sajid,

Thanks so much for your reply and confirming that the module works in principle!

Would you be able to provide me with the 1000 X 1000 clip of your data, so I can check if it is my installation?

I tried also two different boxes and GRASS versions (Ubunut 14.04 with GRASS 7.3 and 7.4 compiled from source and Ubuntu 16.04 with GRASS 7.4 from UbuntuGIS) and none of it worked.

Also, altering the terrain model from floating point with negative values to integer without negative values did not change a thing…

I still get only NULL pixels…

In case someone would be willing to test my data (which I would be very grateful for), you can get it directly here:

dem: http://www.filedropper.com/dem_1

S2 band 8: http://www.filedropper.com/s2aoperprdmsil1cpdmc20160907t044118r008v20160905t10402220160905t104245b08

62 params: http://www.filedropper.com/p6s

I also have it on FTP and can share username and password offlist…

Cheers

Stefan

···

To add, I have used the input as such with out applying the quantification value.


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)

Just noticed, the last parameter should be 167 for Sentinel B2.

Sajid

Forgot to mention, my test data is tiny (< 3MB)…

···

From: grass-user [mailto:grass-user-bounces@lists.osgeo.org] On Behalf Of Stefan Blumentrath
Sent: tirsdag 19. desember 2017 15.24
To: Sajid Pareeth spareeth@gmail.com
Cc: GRASS user list grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] i.atcorr with Sentinel2

Dear Sajid,

Thanks so much for your reply and confirming that the module works in principle!

Would you be able to provide me with the 1000 X 1000 clip of your data, so I can check if it is my installation?

I tried also two different boxes and GRASS versions (Ubunut 14.04 with GRASS 7.3 and 7.4 compiled from source and Ubuntu 16.04 with GRASS 7.4 from UbuntuGIS) and none of it worked.

Also, altering the terrain model from floating point with negative values to integer without negative values did not change a thing…

I still get only NULL pixels…

In case someone would be willing to test my data (which I would be very grateful for), you can get it directly here:

dem: http://www.filedropper.com/dem_1

S2 band 8: http://www.filedropper.com/s2aoperprdmsil1cpdmc20160907t044118r008v20160905t10402220160905t104245b08

62 params: http://www.filedropper.com/p6s

I also have it on FTP and can share username and password offlist…

Cheers

Stefan

From: Sajid Pareeth [mailto:spareeth@gmail.com]
Sent: tirsdag 19. desember 2017 12.51
To: Stefan Blumentrath <Stefan.Blumentrath@nina.no>
Cc: Moritz Lennert <mlennert@club.worldonline.be>; Žofie Cimburová <zoficimburova@gmail.com>; GRASS user list <grass-user@lists.osgeo.org>
Subject: Re: [GRASS-user] i.atcorr with Sentinel2

To add, I have used the input as such with out applying the quantification value.


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)

Just noticed, the last parameter should be 167 for Sentinel B2.

Sajid