NasjonaltBakkeSegment / safe_to_netcdf

Python scripts for converting specific Copernicus Sentinel products in Standard Archive Format for Europe (SAFE) to NetCDF/CF
GNU General Public License v3.0
6 stars 5 forks source link

Add offset information for S2 products baseline N0400 #26

Closed ElodieFZ closed 1 year ago

ElodieFZ commented 1 year ago

NIBIO requested we add some information to the S2 L2A products. It could be useful for the S2 L1C too:

to be able to use products from both baseline N0400 and the previous ones, offsets need to be use. See ESA annoucement and step forum.

In particular:

Regarding the Sentinel-2 Level-2A products, the first five above-mentioned evolutions are directly inherited from the corresponding Level-1C product. Additional evolutions will be included as summarised hereafter:

Provision of negative radiometric values (implementing an offset): Similarly to Level-1C, the dynamic range will be shifted by a band-dependent constant, i.e. BOA_ADD_OFFSET. From the user’s point of view, the L2A Bottom of Atmosphere (BOA) reflectance (L2A_BOA) shall be retrieved from the output radiometry as follows: Digital Number DN=0 remains the “NO_DATA” value For a given DN in [1;215-1], the L2A BOA reflectance value will be: L2A_BOAi = (L2A_DNi + BOA_ADD_OFFSETi) / QUANTIFICATION_VALUEi The radiometric offset value will be consistent with the one applied to the Level-1C product and will be reported in a new field in the General_Info/Product_Image_Characteristics section of the Datastrip and User Product Metadata. It is also noted that the percentage of negative surface reflectance pixels per band will be also reported in the L2A_QUALITY report in the QI_DATA folder of the tile.

These offsets should be added to the nc products from now on, for both L1C and L2A if necessary.

ElodieFZ commented 1 year ago

For L1C products:

Provision of negative radiometric values (implementing an offset):A radiometric offset will be added up to the image reflectance at Level-1C. The dynamic range will be shifted by a band-dependent constant, i.e. RADIO_ADD_OFFSET. From the user’s point of view, the L1C Top of Atmosphere (TOA) reflectance (L1C_TOA) shall be retrieved from the output radiometry as follows: Digital Number DN=0 will remain the “NO_DATA” value For a given DN in [1;215-1], the L1C TOA reflectance value will be: L1C_TOAi = (L1C_DNi + RADIO_ADD_OFFSETi) / QUANTIFICATION_VALUEi The offset will be reported in a new field in the General_Info/Product_Image_Characteristics section of the Datastrip and User Product Metadata. This evolution allows avoiding the loss of information due to clamping of negative values in the predefined range [1-32767] occurring over dark surfaces.

QUANTIFICATION_VALUE is already available in the global attributes RADIO_ADD_OFFSET needs to be added, either as a global attribute too if it's identical for all bands or as a variable attribute for each band if it's band dependent

RADIO_ADD_OFFSET is defined in MTD_MSIL1C.xml and is identical for all bands.

ElodieFZ commented 1 year ago

For L2A products:

Provision of negative radiometric values (implementing an offset): Similarly to Level-1C, the dynamic range will be shifted by a band-dependent constant, i.e. BOA_ADD_OFFSET. From the user’s point of view, the L2A Bottom of Atmosphere (BOA) reflectance (L2A_BOA) shall be retrieved from the output radiometry as follows: Digital Number DN=0 remains the “NO_DATA” value For a given DN in [1;215-1], the L2A BOA reflectance value will be: L2A_BOAi = (L2A_DNi + BOA_ADD_OFFSETi) / QUANTIFICATION_VALUEi The radiometric offset value will be consistent with the one applied to the Level-1C product and will be reported in a new field in the General_Info/Product_Image_Characteristics section of the Datastrip and User Product Metadata. It is also noted that the percentage of negative surface reflectance pixels per band will be also reported in the L2A_QUALITY report in the QI_DATA folder of the tile.

BOA_QUANTIFICATION_VALUE is already available in the global attributes BOA_ADD_OFFSET needs to be added, either as a global attribute too if it's identical for all bands or as a variable attribute for each band if it's band dependent

BOA_ADD_OFFSET is defined in MTD_MSIL2A.xml. It seems to be identical for all bands.

ElodieFZ commented 1 year ago

Closed with PR #27