pytroll / satpy

Python package for earth-observing satellite data processing
http://satpy.readthedocs.org/en/latest/
GNU General Public License v3.0
1.06k stars 292 forks source link

Fix instrument name reading from attributes for VIIRS L2 data #2760

Closed pnuu closed 6 months ago

pnuu commented 6 months ago

The some of the attributes in the CSPP/ASCI files have been renamed between v3r0 and v3r2. The only on I've seen that affects Satpy is the instrument name. The original reader version was based on older data and works at least until v3r0 files, but the current one seems to handle only the newer files. With this PR both can be read.

pnuu commented 6 months ago

Any ideas what would be the best way to adapt the tests to check for both attribute versions? Dupplicating the fake filehandler class and the test class doesn't seem very attractive...

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.92%. Comparing base (85d9117) to head (2fff0d4). Report is 34 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2760 +/- ## ========================================== - Coverage 95.94% 95.92% -0.02% ========================================== Files 375 377 +2 Lines 53293 53502 +209 ========================================== + Hits 51130 51321 +191 - Misses 2163 2181 +18 ``` | [Flag](https://app.codecov.io/gh/pytroll/satpy/pull/2760/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pytroll) | Coverage Δ | | |---|---|---| | [behaviourtests](https://app.codecov.io/gh/pytroll/satpy/pull/2760/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pytroll) | `4.10% <0.00%> (-0.02%)` | :arrow_down: | | [unittests](https://app.codecov.io/gh/pytroll/satpy/pull/2760/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pytroll) | `96.02% <100.00%> (-0.02%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pytroll#carryforward-flags-in-the-pull-request-comment) to find out more.

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

pnuu commented 6 months ago

Ok, duplicated the minimal amount of test code I thought was necessary.

coveralls commented 6 months ago

Pull Request Test Coverage Report for Build 8264934533

Details


Totals Coverage Status
Change from base Build 8205996229: 0.003%
Covered Lines: 51193
Relevant Lines: 53325

💛 - Coveralls
djhoese commented 6 months ago

CC @wjsharpe, Does this look good to you?

djhoese commented 6 months ago

Posting the realization from slack here for the record: @pnuu was using the old "viirs_l2.py" reader that he had created a while ago. A couple months ago I reworked all the VIIRS EDR (note EDR, not L2) to be one viirs_edr reader. The new VIIRS L2 reader being modified here is from #2740 by @wjsharpe and is for the NASA VIIRS L2 products not the NOAA EDR products.

wjsharpe commented 6 months ago

Looks good to me

pnuu commented 6 months ago

I should've remembered that viirs_l2 -> viirs_edr change. I'll test the v3r2 and v3r0 files tomorrow with the current Satpy and close this if both already work.

pnuu commented 6 months ago

Yeah, this PR was a mixup with the old viirs_l2.py and the current viirs_edr.py for the ASCI files. Closing, viirs_edr already works with both of the versions I have.