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

Sentinel 2 new product version (msi_safe reader) #1847

Closed
RutgerK opened this issue Oct 5, 2021 · 3 comments · Fixed by #1850
Closed

Sentinel 2 new product version (msi_safe reader) #1847

RutgerK opened this issue Oct 5, 2021 · 3 comments · Fixed by #1850
Assignees
Labels
component:readers enhancement code enhancements, features, improvements hacktoberfest

Comments

@RutgerK
Copy link
Contributor

RutgerK commented Oct 5, 2021

The format of the Sentinel 2 products will change on October 26th, potentially causing some issues with the current reader (msi_safe).

https://sentinels.copernicus.eu/web/sentinel/-/copernicus-sentinel-2-major-products-upgrade-upcoming/1.9?redirect=%2Fweb%2Fsentinel%2Fmissions%2Fsentinel-2

I have never used Satpy with the Sentinel 2 products, so I'm not sure which changes are all relevant. But I think at least these two:

  1. The conversion from DN to toa reflectance changes due to the introduction of an offset. It could very well be that this wont break any code, but lead to incorrect reflectances if it's not properly taken into account, Making it a very tricky change.

    Currently the quantification value seems to be hard coded at:
    https://github.com/pytroll/satpy/blob/main/satpy/readers/msi_safe.py#L74

    image

    Changing the equation itself shouldn't be too hard, since for old versions an offset of zero can be used, and it will still work.

    Note that they mention a band dependent value. If it will actually be a different value per band, but constant over time, it could perhaps be added to the yaml. If it's not constant over time, it would need to be read from the xml each time, but that seems less likely to me.

  2. The change to the detector footprint masks might also be relevant regarding the sensor viewing angles. Although I couldn't figure out how this is done in Satpy by quickly skimming through the code. Each detector has it's own set of angles (in the xml), and in the old versions the footprints of these detectors are provided as GML files (vector). Combining those allows to create a single array with the angles of each relevant detector,

    In the new version these GML files will be replaced by a raster mask, So it should actually make things a lot easier, and it resolves a long standing issue where it wasn't clear what happened in the area where the detectors overlap (see this for example),

    This change definitely sounds like it would break existing code relying on the GML files, but as said, I can't really piece it together from looking at the reader itself. Most relevant code related to the angles seems in the SAFEMSIMDXML class at:
    https://github.com/pytroll/satpy/blob/main/satpy/readers/msi_safe.py#L94

If old versions also need to be supported, some sort of switch has to be made based on the product version. There's a PROCESSING_BASELINE tag in ones of the xml's which should contain the version.

The announcement mentions the release of some sample products becoming available, but I haven't seen those yet.

@mraspaud mraspaud added component:readers enhancement code enhancements, features, improvements hacktoberfest labels Oct 5, 2021
@mraspaud
Copy link
Member

mraspaud commented Oct 5, 2021

@RutgerK thanks a lot for the heads up! I totally missed this. I will try to have a look at it this week, let's hope they will release some sample files soon.

@mraspaud mraspaud self-assigned this Oct 5, 2021
@RutgerK
Copy link
Contributor Author

RutgerK commented Oct 11, 2021

@mraspaud
Copy link
Member

Perfect, thanks a lot for the info!

mraspaud added a commit to mraspaud/satpy that referenced this issue Oct 12, 2021
simonrp84 pushed a commit to simonrp84/satpy that referenced this issue Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers enhancement code enhancements, features, improvements hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants