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

Support reading EO-SIP LAC data #125

Merged
merged 14 commits into from
Mar 19, 2024
Merged

Conversation

mraspaud
Copy link
Member

This PR adds support for the EO-SIP LAC formats.

In particular, the EBCDIC decoding for dataset names is implemented, and the fixed header type for POD data is added as an option.

@mraspaud mraspaud requested a review from sfinkens March 18, 2024 11:54
@mraspaud mraspaud self-assigned this Mar 18, 2024
Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 98.65772% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 77.04%. Comparing base (cbf2d7c) to head (2753057).
Report is 1 commits behind head on main.

Files Patch % Lines
pygac/pod_reader.py 88.88% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #125      +/-   ##
==========================================
+ Coverage   74.39%   77.04%   +2.64%     
==========================================
  Files          32       32              
  Lines        2882     3001     +119     
==========================================
+ Hits         2144     2312     +168     
+ Misses        738      689      -49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mraspaud mraspaud marked this pull request as ready for review March 18, 2024 14:07
Copy link
Member

@sfinkens sfinkens left a comment

Choose a reason for hiding this comment

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

Nice work! I had a couple inline refactoring ideas and two thoughts:

  1. I wonder what happens if PODReader.can_read (inherited from Reader) calls PODReader.read_header without the eosip_header argument. Would that work with EOSIP files?
  2. Would it make sense to make the signature format agnostic?
read_header(..., header="auto")  # determine based on timestamp
read_header(..., header=header3)  # use exactly this header

pygac/pod_reader.py Outdated Show resolved Hide resolved
pygac/reader.py Show resolved Hide resolved
pygac/tests/test_reader.py Show resolved Hide resolved
@mraspaud
Copy link
Member Author

Nice work! I had a couple inline refactoring ideas and two thoughts:

1. I wonder what happens if `PODReader.can_read` (inherited from `Reader`) calls `PODReader.read_header` without the `eosip_header` argument. Would that work with EOSIP files?

Yes, that is not a problem since the header isn't used for anything in that function, just check that is doesn't raise any errors...

2. Would it make sense to make the signature format agnostic?
read_header(..., header="auto")  # determine based on timestamp
read_header(..., header=header3)  # use exactly this header

That would be really nice, however how will satpy know what pygac header to use?

@sfinkens
Copy link
Member

how will satpy know what pygac header to use?

Good point... I tried, but I'm not sure this is better...

pygac:
EOSIP_HEADER = header3.copy()
satpy:
from pygac import EOSIP_HEADER
reader_kwargs["header"] = EOSIP_HEADER

@mraspaud
Copy link
Member Author

I just thought while cycling home that we could instead pass the header timstamp?
eg

read_header(..., header_timestamp="auto")  # for automatic, current behaviour, default
read_header(..., header_timestamp=datetime(2000, 1, 1))  # to choose a specific one

or is this too obscure?

how will satpy know what pygac header to use?

Good point... I tried, but I'm not sure this is better...

pygac:
EOSIP_HEADER = header3.copy()
satpy:
from pygac import EOSIP_HEADER
reader_kwargs["header"] = EOSIP_HEADER

@sfinkens
Copy link
Member

I like that!

Copy link
Member

@sfinkens sfinkens left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for adding a test with a real file! There are some codefactor warnings (E241), otherwise looks good to me. 👍

pygac/reader.py Show resolved Hide resolved
@mraspaud mraspaud merged commit 2ef1e10 into pytroll:main Mar 19, 2024
8 checks passed
@mraspaud mraspaud deleted the feature-eo-sip-support branch March 19, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants