Add a reader for NWC SAF GEO HRW data#3070
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3070 +/- ##
========================================
Coverage 96.14% 96.15%
========================================
Files 383 385 +2
Lines 55798 56021 +223
========================================
+ Hits 53649 53867 +218
- Misses 2149 2154 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I reduced the number of data rows that were written to the test data. With the original |
|
I'll have a look at adding a kwarg to merge the different channel observations, so the user could do something like scn = Scene(reader="nwcsaf-geo", filenames=filenames, reader_kwargs={"merge_channels": True})
scn.load(["wind_speed", "wind_from_direction"])instead of loading each of the channels ( |
|
Also some documentation added. |
Pull Request Test Coverage Report for Build 13971092899Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
| FILETYPE_INFO = {"file_type": "nc_nwcsaf_geo_hrw"} | ||
|
|
||
|
|
||
| @pytest.fixture |
There was a problem hiding this comment.
| @pytest.fixture | |
| @pytest.fixture(scope="module") |
Unless I misunderstand the fixture, this should make it so it is only created once for all of this module's tests.
There was a problem hiding this comment.
I agree with the scope, but this will break tmp_path, you need to use tmp_path_factory instead https://docs.pytest.org/en/stable/how-to/tmp_path.html#the-tmp-path-factory-fixture
djhoese
left a comment
There was a problem hiding this comment.
I had a suggestion or two, but I really don't think I should have final say on this as I have no experience with nwcsaf readers. I'm marking my review as approve even though I requested a few things. Not doing my suggestions does not mean this file handler is broken or that it can't be merged, but it isn't as good as it could be 😉
| with suppress(OSError): | ||
| self.h5f.close() | ||
|
|
||
| def available_datasets(self, configured_datasets=None): |
There was a problem hiding this comment.
The configured_datasets are not "forwarded on" as suggested in the base file handler:
satpy/satpy/readers/file_handlers.py
Lines 256 to 263 in f915074
Without this users will not be able to statically define datasets in the YAML.
mraspaud
left a comment
There was a problem hiding this comment.
Just a couple of small things, but otherwise LGTM
satpy/readers/nwcsaf_hrw_nc.py
Outdated
| scn = Scene(reader="nwcsaf-geo", filenames=[filename]) | ||
| pprint.pprint(scn.available_dataset_names()) | ||
|
|
||
| This print all the available datasets. The truncated output of this is:: |
There was a problem hiding this comment.
| This print all the available datasets. The truncated output of this is:: | |
| This prints all the available datasets. The truncated output of this is:: |
| FILETYPE_INFO = {"file_type": "nc_nwcsaf_geo_hrw"} | ||
|
|
||
|
|
||
| @pytest.fixture |
There was a problem hiding this comment.
I agree with the scope, but this will break tmp_path, you need to use tmp_path_factory instead https://docs.pytest.org/en/stable/how-to/tmp_path.html#the-tmp-path-factory-fixture
| except ValueError: | ||
| logger.warning("Reading %s is not supported.", dataset_name) |
There was a problem hiding this comment.
I would have thought this raises a KeyError...
There was a problem hiding this comment.
It raises ValueError when the data are there but the compound datatype is unreadable.
This PR adds a reader for the High Resolution Winds data from NWC SAF GEO.
The data structure is very complex, and due to the unsupported compound data type can't be opened with
xr.open_dataset(). Because there are 259 datasets, I've made the dataset definitions dynamic instead of putting them into the reader YAML. The code is in a separate file because the internal structure is completely different to the other NWC SAF GEO products (see the linked issue).By default the file handler reads the datasets separately for each imaging channel. That is, the datasets are named
wind_vis06_air_pressure,wind_hrvis_wind_speed, and so on. The prefix is the name of the channel within the files.The user can also supply
reader_kwargs={"merge_channels": True}to collect all the data together. In this case the datasets are named without the prefix, such asair_pressure,wind_speed, etc.