Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.sentinel.import: Add option to add a band offset after importing S-2 data #23

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

griembauer
Copy link
Member

Since Sentinel-2 Processing Baseline 4.0.0 a systematic offset has been introduced to all reflectance values. This offset is currently 1000 and can be read from the scene metadata if available.

In this PR, an option to indicate an offset number is given to the user. The offset is then added to all imported bands, and via a small hack, the description.json that holds band metadata that is relevant for e.g. i.sentinel.mask is preserved.

Important:
An ideal solution would obviously be to automatically parse the offset from the scene metadata and implement the offset addition directly in i.sentinel.import. This is not done for the following reasons:

  • In the current structure of i.sentinel.import, the metadata is read after importing the data itself - changing this would be a major refactoring of the module
  • The offset is only to applied for actual reflectance bands. In this PR, it is ensured that it is not applied to cloud and cloud shadow bands, however for the remaining bands imported by pattern, it is up to the user to make sure that only relevant bands (and not quality layers etc.) are imported. For i.sentinel.import, a blind application of the offset would not be a valid solution, so an internal mechanism would have to make sure that only reflectance bands are affected - again this requires a major refactoring
  • as indicated in the corresponding grass addons issue, if a major refactoring of i.sentinel.import is foreseen, then it would make sense to directly make use of the GDAL Sentinel-2 driver.

--> in essence, this PR represents a small-effort workaround for an issue that would require much more effort for a sustainable solution

Comment on lines +6 to +7
Since Sentinel-2 <a href="https://forum.step.esa.int/t/info-introduction-of-additional-radiometric-offset-in-pb04-00-products/35431">Processing Baseline 4.0.0</a>, a systematic offset has been introduced to all reflectance values.
To account for this, the <b>offset</b> option allows the user to indicate how reflectance data should be corrected (e.g. -1000).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Since Sentinel-2 <a href="https://forum.step.esa.int/t/info-introduction-of-additional-radiometric-offset-in-pb04-00-products/35431">Processing Baseline 4.0.0</a>, a systematic offset has been introduced to all reflectance values.
To account for this, the <b>offset</b> option allows the user to indicate how reflectance data should be corrected (e.g. -1000).
Since Sentinel-2 <a href="https://forum.step.esa.int/t/info-introduction-of-additional-radiometric-offset-in-pb04-00-products/35431">Processing Baseline 4.0.0</a>, a systematic offset has been introduced
to all reflectance values.<br>
To account for this, the <b>offset</b> option allows the user to indicate how reflectance data should
be corrected (e.g. -1000).

(break long lines, see https://github.com/OSGeo/grass/blob/main/doc/development/style_guide.md#markup-style-guide - "More notes on markup")

# % key: offset
# % type: integer
# % required: no
# % description: Offset to add to the Sentinel bands to due to specific processing baseline (e.g. -1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# % description: Offset to add to the Sentinel bands to due to specific processing baseline (e.g. -1000)
# % description: Offset to add to the Sentinel-2 bands to due to specific processing baseline (e.g. -1000)

Perhaps only S2 related?

@griembauer griembauer merged commit 756b8fc into mundialis:main Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants