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:mlenn...@club.worldonline.be] 
Sent: mandag 18. desember 2017 17.06
To: Stefan Blumentrath <stefan.blumentr...@nina.no>; Žofie Cimburová 
<zoficimbur...@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-boun...@lists.osgeo.org] On 
>> Behalf Of Moritz Lennert
>> Sent: mandag 18. desember 2017 16.26
>> To: Žofie Cimburová <zoficimbur...@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 
>>> <mlenn...@club.worldonline.be <mailto:mlenn...@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á
>>>           <zoficimbur...@gmail.com <mailto:zoficimbur...@gmail.com>
>>>           <mailto:zoficimbur...@gmail.com
>>>           <mailto:zoficimbur...@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
>>>           <nete...@osgeo.org <mailto:nete...@osgeo.org>
>>>                <mailto:nete...@osgeo.org <mailto:nete...@osgeo.org>>> wrote:
>>>
>>>
>>>                    On Dec 15, 2017 3:54 PM, "Žofie Cimburová"
>>>                    <zoficimbur...@gmail.com
>>>           <mailto:zoficimbur...@gmail.com> <mailto:zoficimbur...@gmail.com
>>>           <mailto:zoficimbur...@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>
>>>
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> 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

Reply via email to