pytroll / pygac

A python package to read and calibrate NOAA and Metop AVHRR GAC and LAC data
https://pygac.readthedocs.org/
GNU General Public License v3.0
20 stars 25 forks source link

Support reading EO-SIP LAC data #125

Closed mraspaud closed 5 months ago

mraspaud commented 5 months ago

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.

codecov[bot] commented 5 months ago

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 :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mraspaud commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

I like that!