-
Notifications
You must be signed in to change notification settings - Fork 180
Add importer for DWD radar data products and reprojection onto a regular grid as part of #464 #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Many thanks for this contribution, @m-rempel! Although we have discussed within the pysteps community to limit the number of new importers, I can imagine that this importer is a useful addition to allow for the ensemble Kalman filter blending setup, testing and possibly some gallery examples. I will have a quick look to see if there is any overlap with other HDF5 importers to see if we can shorten the code a bit. @dnerini, what do you think? Regarding the addition to the reprojection, the code looks good, but at this moment pysteps does not yet support xarray (we will from version 2). Is there a way to rewrite this approach without xarray? If not, we could consider these improvements as part of the pysteps v2 release. @dnerini, what is your take on this? |
pysteps/io/importers.py
Outdated
|
||
except: | ||
|
||
d[key] = value.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exception are you expecting here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this exception, since I had implemented this in my code for testing purposes. However, to read the HDF content np.array should be sufficient.
|
||
def _read_hdf5_cont(f, d): | ||
""" | ||
Recursively read nested dictionaries from a HDF5 file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to add some extra docstrings here about what the input variables are and what you expect to return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added here and in other functions the docstrings and have extended the descriptions.
|
||
|
||
def _identify_info_bits(data): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add some docstrings here?
pysteps/io/importers.py
Outdated
---------- | ||
filename: str | ||
Name of the file to import. | ||
product: {'WX','RX','EX','RY','RW','AY','RS','YW','WN'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to call this variable product_name
? Then the prod
variable can get a longer, more descriptive name as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed your suggestion and changed it in product_name.
Geodata for RADOLAN products. Hard-coded here, cause there is only basic | ||
information about the projection in the header of the binary RADOLAN | ||
files. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some more docstrings here, too (input parameters and output). I have already added much more docstrings, but feel free to edit them from here.
Almost forgot to mention it, but we will have to add some tests if we continue with this approach! :) |
Sure. This is the first version of the implementation. Also to see if you are happy with it. |
Perfect! I think the importer code looks good now. Could you add a data sample of the DWD data to https://github.com/pySTEPS/pysteps-data? Once it is there, we have a dataset we can use for setting up some simple tests. Other than that, and if @dnerini also agrees with this setup, we are good to go. :) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #483 +/- ##
==========================================
- Coverage 84.56% 83.50% -1.07%
==========================================
Files 162 162
Lines 13471 13670 +199
==========================================
+ Hits 11392 11415 +23
- Misses 2079 2255 +176
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:
|
hi @RubenImhoff and @m-rempel, apologies for the slow response... It's true that in principle we prefer to use plugins for importers instead of adding them into pysteps itself. This said, I'm personally OK with a few exceptions like in this case, especially if it can help implementing a new cool feature ;) but the new importers should come with some basic testing at least. Can we add some tests for the |
Hi @dnerini ! |
"varname": "PR_GSP", | ||
"grid_file_path": "./aux/grid_files/dwd/icon/R19B07/icon_grid_0047_R19B07_L.nc", | ||
} | ||
array_src, _, metadata_src = pysteps_nwp_importers.importer_dwd_nwp.import_dwd_nwp( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-rempel, pysteps
won't find pysteps_nwp_importers
as it is an optional additional package to pysteps
. Hence, this test would only work with dummy data, or if you can make a very simple reproduction of the data import here in the tests. As you can see in the reprojection test above for the RMI data, some dummy data is created an put on the grid and projection that this data has. Would something like that be feasible? Other than that, this PR is good to go!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this also yesterday. One option could be to have unstructured2regular()
within pysteps_nwp_importers
, since it is needed solely for the ICON-D2 data. On the other side, pysteps_nwp_importers
would then no longer be independent, since some regular grid is necessary for that test.
What do you think, @RubenImhoff and @dnerini?
Implementation of an importer for DWD radar data products and a reprojection onto a regular grid. These are necessary to test the implementation of the reduced-space EnKF combination approach (Nerini et al., 2019) and to compare the results with the already existing code base that uses DWD data.