<div dir="ltr">Hi Vero,<br><br>On Thu, Nov 14, 2019 at 1:37 PM Veronica Andreo <<a href="mailto:veroandreo@gmail.com">veroandreo@gmail.com</a>> wrote:<br>><br>> Hi MarkusN<br>><br>> I accidentaly only answered to MarkusM, sorry... Below, I forward the emails for further reference. All in all, I understood that the range parameter is then the theoretical radiance range given that the input is expected to be radiance.<br>><br>> So, the example for S2 should say S2 level 1C that comes as scaled TOA and hence it is fine to use 1,10000 as range. But in the example for Landsat if that's a L1 product (L2 wouldn't need atmospheric correction at all), IIUC, the default range 0,255 is wrong, because those are DN. So, one should apply Gain and Bias coefficients to the DN range in order to get the radiance theoretical range required by i.atcorr.<br><div><br></div><div>For i.atcorr, it does not really matter if you apply gain and bias. For example wit S2, if you apply gain and bias with gain = 1/10000 and bias = 0, you get values in the range 0, 1 and for i.atcorr you would use range=0,1. If you do not apply gain and bias, you can let i.atcorr applay gain and bias by using range=1,10000 (0 is nodata in S2).</div><div><br></div><div>HTH,</div><div><br></div><div>Markus M<br></div><div>></div>> @MarkusM please correct me if I got it wrong<br>><br>> best,<br>> Vero<br>><br>> ---<br>> Hi Vero,<br>><br>> On Wed, Nov 13, 2019 at 4:05 PM Veronica Andreo <<a href="mailto:veroandreo@gmail.com">veroandreo@gmail.com</a>> wrote:<br>> ><br>> > Hi Markus<br>> ><br>> > Thanks for the answer :)<br>> ><br>> > El mié., 13 nov. 2019 a las 14:18, Markus Metz (<<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>>) escribió:<br>> >><br>> >> Hi Vero,<br>> >><br>> >> On Wed, Nov 13, 2019 at 12:59 PM Veronica Andreo <<a href="mailto:veroandreo@gmail.com">veroandreo@gmail.com</a>> wrote:<br>> >> ><br>> >> > Hi all,<br>> >> ><br>> >> > I'm using i.atcorr for atmospheric correction of Pleiades imagery. The data comes as DN in 12 bits.<br>> >><br>> >> That is, values can be in the range 0, 4095, but the full possible range is not necessarily used.<br>> ><br>> > Yes, that's clear. Metadata says 0 is for nodata and 4095 for bad values, so range would be 1,4094. But these are DN, not radiance and the manual of i.atcorr says that the module accepts radiance, this is what I don't understand... Shall I convert to radiance before i.atcorr or use raw data and the DN range?<br>><br>> Yes, I guess it's better to convert to radiance. So if you have gain and bias, you can apply them to 1 and 4094 to get the theoretical range of radiance, no?<br>><br>> Best,<br>> Markus<br>> >> > Reading the manual of i.atcorr, I get that I must provide radiance data. Hence I converted each band to radiance using gain and bias from the metadata. Now, for the range parameter in i.atcorr, I assume I must pass the min/max output of <a href="http://r.info">r.info</a> for each band. There's no extra info in the metadata about theoretical range for each band.<br>> >><br>> >> No, the range parameter in i.atcorr needs the theoretical range. For example for Landsat, values can be in the range 1, 255 (0 is reserved for nodata IIRC), but actual band values usually cover only a part of that range. Therefore min/max of a band is not correct.<br>> ><br>> > Theoretical range of radiance or the bits of DN?<br>> >><br>> >> Regarding Pleiades or other imagery, you need to get from documentation or metadata the valid range and use this as range for i.atcorr.<br>> ><br>> > I went through metadata file and user guide, but theoretical range for radiance I didn't find... only the gain and bias and radiometric resolution.<br>> ><br>> > Thanks again,<br>> > Vero<br>> ><br>> >><br>> >> HTH,<br>> >><br>> >> Markus M<br>> >><br>> >> ><br>> >> > In the i.atcorr manual and in some older emails, I read for example, that the range for Sentinel 2 is 1 to 10000. However here [1] it says: "Per-pixel radiometric measurements are provided in Top Of Atmosphere (TOA) reflectances along with the parameters to transform them into radiances". AFAIU, 1,10000 is TOA range.<br>> >> ><br>> >> > So, I'm a bit lost... What is really this range parameter representing?<br>> >> ><br>> >> > Thanks much in advance<br>> >> ><br>> >> > Vero<br>> >> ><br>> >> > [1] <a href="https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types/level-1c">https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types/level-1c</a><br>><br>><br>> El mié., 13 nov. 2019 a las 22:43, Markus Neteler (<<a href="mailto:neteler@osgeo.org">neteler@osgeo.org</a>>) escribió:<br>>><br>>> Hi,<br>>><br>>> On Wed, Nov 13, 2019 at 2:18 PM Markus Metz<br>>> <<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>> wrote:<br>>> > On Wed, Nov 13, 2019 at 12:59 PM Veronica Andreo <<a href="mailto:veroandreo@gmail.com">veroandreo@gmail.com</a>> wrote:<br>>> > ><br>>> > > Hi all,<br>>> > ><br>>> > > I'm using i.atcorr for atmospheric correction of Pleiades imagery. The data comes as DN in 12 bits.<br>>> ><br>>> > That is, values can be in the range 0, 4095, but the full possible range is not necessarily used.<br>>> ><br>>> > > Reading the manual of i.atcorr, I get that I must provide radiance data. Hence I converted each band to radiance using gain and bias from the metadata. Now, for the range parameter in i.atcorr, I assume I must pass the min/max output of <a href="http://r.info">r.info</a> for each band. There's no extra info in the metadata about theoretical range for each band.<br>>> ><br>>> > No, the range parameter in i.atcorr needs the theoretical range.<br>>><br>>> Since it isn't that obvious yet I'd suggest to reword the description at<br>>> <a href="https://github.com/OSGeo/grass/blob/master/imagery/i.atcorr/main.cpp#L496">https://github.com/OSGeo/grass/blob/master/imagery/i.atcorr/main.cpp#L496</a><br>>><br>>> from:<br>>>    opts.iscl->description = _("Input range");<br>>><br>>> to something like:<br>>>    opts.iscl->description = _("Input range (theoretical range)");<br>>><br>>> (feel free to submit a PR)<br>>><br>>> > For example for Landsat, values can be in the range 1, 255 (0 is reserved for nodata IIRC), but actual band values usually cover only a part of that range. Therefore min/max of a band is not correct.<br>>><br>>> This valuable hint might to into the manual.<br>>><br>>> best<br>>> markusN<br>>><br>>> > Regarding Pleiades or other imagery, you need to get from documentation or metadata the valid range and use this as range for i.atcorr.<br>>> ><br>>> > HTH,<br>>> ><br>>> > Markus M<br>>> ><br>>> > ><br>>> > > In the i.atcorr manual and in some older emails, I read for example, that the range for Sentinel 2 is 1 to 10000. However here [1] it says: "Per-pixel radiometric measurements are provided in Top Of Atmosphere (TOA) reflectances along with the parameters to transform them into radiances". AFAIU, 1,10000 is TOA range.<br>>> > ><br>>> > > So, I'm a bit lost... What is really this range parameter representing?<br>>> > ><br>>> > > Thanks much in advance<br>>> > ><br>>> > > Vero<br>>> > ><br>>> > > [1] <a href="https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types/level-1c">https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types/level-1c</a><br>>> > > _______________________________________________<br>>> > > grass-user mailing list<br>>> > > <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>>> > > <a href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>>> > _______________________________________________<br>>> > grass-user mailing list<br>>> > <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>>> > <a href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>>><br>>><br>>><br>>> --<br>>> Markus Neteler, PhD<br>>> <a href="https://www.mundialis.de">https://www.mundialis.de</a> - free data with free software<br>>> <a href="https://grass.osgeo.org">https://grass.osgeo.org</a><br>>> <a href="https://courses.neteler.org/blog">https://courses.neteler.org/blog</a></div>