Repository navigation
Add bz2 support to the metimage_l1b_nc reader - #3433
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3433 +/- ##
========================================
Coverage 96.34% 96.34%
========================================
Files 465 465
Lines 59151 59376 +225
========================================
+ Hits 56990 57208 +218
- Misses 2161 2168 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the PR! It looks like the tests are failing on Windows ☹. Unfortunately, I know very little about Windows coding myself. Maybe it would work with a pytest fixture for temporary files? |
djhoese
left a comment
There was a problem hiding this comment.
Unfortunately I think @gerritholl is right and it may be easiest to use pytest fixtures and use tmp_path to manage the creation and deletion of these files. Extra unfortunately is that this test class is a unittest TestCase so it can't use pytest fixtures directly. It would have to be converted. That would movstly involve changing the setUp and tearDown into fixtures so they can be used by the new fixture(s) needed for your tests.
|
Thanks for the pointer — makes sense. I converted the bz2-related tests (test_bz2_reading, test_corrupt_bz2_raises) to plain pytest functions with tmp_path fixtures, so there's no more manual filename/cleanup handling for those. Left the rest of the file (setUp/tearDown, existing TestCase methods) as-is for now — wasn't sure if a full conversion was expected here or as a separate change, happy to do it if you'd like. Also took your point on the On the Windows failures:
|
|
Thank you all for the input.
|
3010c0b to
e7e4efc
Compare
…e .nc and .nc.bz2 tests
e7e4efc to
95c65e9
Compare
…p test. Delete the decompressed temp file directly and call __del__() on it, instead of mocking os.remove to raise. FileNotFoundError is a real OSError subclass, so this exercises the same suppress(AttributeError, OSError) path in __del__ without depending on how os.remove happens to be imported in production code.
|
Regarding @Manny7717's comment on the numpy warning, Claude confirmed that is in the netcdf4-python library and has been fixed upstream. Side note: @Manny7717 I sent you an email. I'll make more comments about a few last changes... |
|
Last comment for now: Any interest in adding your name to the |
ca97ea2 to
bad8a19
Compare
ameraner
left a comment
There was a problem hiding this comment.
Looks good to me too, thank you for all the efforts!
Adds bz2-compressed (.nc.bz2) file support to the VII/metimage readers, so compressed granules from the EUMETSAT data hub can be read without manual decompression first.
ViiNCBaseFileHandler.__init__now decompresses via the existingunzip_file()helper (satpy.readers.core.utils) before opening the file, same approach used byahi_l1b_gridded_bin.py. This lives in the shared base class, so it also applies toViiL2NCFileHandler— L2 wasn't specifically tested here, but the change is in a code path both share identically.Also updates the
vii_l1b_nc.yamlfile pattern to match.nc.bz2filenames.Trade-off: decompression happens eagerly per-granule (~113MB temp disk per
file); see #3432 for more detail on why this was chosen over a streaming
approach.
AUTHORS.mdif not there already