satpy icon indicating copy to clipboard operation
satpy copied to clipboard

Adapt reader mviri_l1b_fiduceo_nc

Open bkremmli opened this issue 1 year ago • 3 comments

[INFO] on hold until a new xarray release with this contribution is out which fixes the duplicate dimension problem: https://github.com/pydata/xarray/pull/9099


This PR fixes the mviri_l1b_fiduceo_nc reader when being used with a new xarray version (2024.3.0). When using the original reader, a ValueError about not being able to decode the times is thrown. The file is now opened without decoding. The decoding is now done in DatasetWrapper()._decode_cf(). The time is decoded separatly from the other data values. FillValues for the time are recognized to replace time values with NaT and time is decoded using the offset values included within the attributes.

Also, opening the dataset using chunks is deactivated because the input files contains dimensions of the same name which cannot be processed by xarray at the moment. The chunking as well as renaming the dimensions is also performed in DatsetWrapper().

  • [x ] Tests added
  • [ ] Fully documented --> this change should not be visible to users
  • [x ] Add your name to AUTHORS.md if not there already

bkremmli avatar May 17 '24 09:05 bkremmli

Also I noticed that space pixels now have some finite values (instead of NaN), because decode_cf=False. You can use decode_cf=True together with time.encoding["add_offset/_FillValue"], see https://github.com/sfinkens/satpy/commit/7045a87cc5e8066712df153ba4e9998c06df6265

sfinkens avatar May 17 '24 15:05 sfinkens

Codecov Report

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

Project coverage is 96.07%. Comparing base (6a4f2af) to head (484b723). Report is 367 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2802   +/-   ##
=======================================
  Coverage   96.06%   96.07%           
=======================================
  Files         373      373           
  Lines       54406    54467   +61     
=======================================
+ Hits        52267    52328   +61     
  Misses       2139     2139           
Flag Coverage Δ
behaviourtests 3.98% <0.00%> (-0.01%) :arrow_down:
unittests 96.16% <100.00%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

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

codecov[bot] avatar May 24 '24 06:05 codecov[bot]

The test for the duplicate dimensions still needs to be added.

bkremmli avatar Jun 04 '24 13:06 bkremmli

Let's see if we can make CodeScene happy

sfinkens avatar Sep 23 '24 13:09 sfinkens

Pull Request Test Coverage Report for Build 11122895363

Details

  • 75 of 75 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 96.169%

Totals Coverage Status
Change from base Build 11109706783: 0.005%
Covered Lines: 52562
Relevant Lines: 54656

💛 - Coveralls

coveralls avatar Oct 01 '24 08:10 coveralls

@mraspaud Do you want to have a final look? In the next PR we'll do a bit of refactoring and split "DatasetWrapper" into preprocessor and accessor

sfinkens avatar Oct 01 '24 10:10 sfinkens

I just had a quick look and this looks good to merge. In a future PR, you might want to ensure the sensor data is in float32 to increase performance.

mraspaud avatar Oct 17 '24 08:10 mraspaud

you might want to ensure the sensor data is in float32 to increase performance.

That's checked in the tests

https://github.com/pytroll/satpy/blob/main/satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py#L433 https://github.com/pytroll/satpy/blob/main/satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py#L77

sfinkens avatar Oct 18 '24 16:10 sfinkens