-
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
Open
m-rempel
wants to merge
13
commits into
pySTEPS:master
Choose a base branch
from
m-rempel:add_enkf_combination
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c466b9c
Add importer for DWD radar products
m-rempel 1e98e4f
Update DWD HDF5 Importer
m-rempel 9d47508
Add reprojection of unstructured grids
m-rempel f4b1506
docs: add docstrings to function and run black
RubenImhoff a632102
Add suggestions of draft pull request in importer and reprojection
m-rempel 0a78666
Merge branch 'add_dwd_radar_data' into add_enkf_combination
m-rempel 1b063e0
Update doc strings in io/importers.py and utils/reprojection.py
m-rempel bd9bee1
fix: minor fixes because of codacy check
RubenImhoff df0956b
fix: run black
RubenImhoff 7bb934e
Add tests for import_dwd_hdf5 and unstructured2regular
m-rempel 29fae6f
Merge branch 'add_enkf_combination' of github.com:m-rempel/pysteps in…
m-rempel 18debf3
fix: minor fixes after review
RubenImhoff 9c341b6
run black
RubenImhoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
|
||
import pytest | ||
|
||
import pysteps | ||
from pysteps.tests.helpers import smart_assert | ||
|
||
pytest.importorskip("h5py") | ||
|
||
# Test for RADOLAN RY product | ||
|
||
root_path = pysteps.rcparams.data_sources["dwd"]["root_path"] | ||
|
||
filename = os.path.join(root_path, "RY", "2025", "06", "04", "20250604_1700_RY.h5") | ||
precip_ry, _, metadata_ry = pysteps.io.import_dwd_hdf5(filename, qty="RATE") | ||
|
||
|
||
def test_io_import_dwd_hdf5_ry_shape(): | ||
"""Test the importer DWD HDF5.""" | ||
assert precip_ry.shape == (1200, 1100) | ||
|
||
|
||
# Test_metadata | ||
# Expected projection definition | ||
expected_proj = ( | ||
"+proj=stere +lat_0=90 +lat_ts=60 " | ||
"'+lon_0=10 +a=6378137 +b=6356752.3142451802" | ||
"+no_defs +x_0=543196.83521776402 " | ||
"+y_0=3622588.8619310018 +units=m" | ||
) | ||
|
||
# List of (variable,expected,tolerance) tuples | ||
test_ry_attrs = [ | ||
("projection", expected_proj, None), | ||
("ll_lon", 3.566994635, 1e-10), | ||
("ll_lat", 45.69642538, 1e-10), | ||
("ur_lon", 18.73161645, 1e-10), | ||
("ur_lat", 55.84543856, 1e-10), | ||
("x1", -500.0, 1e-6), | ||
("y1", -1199500.0, 1e-10), | ||
("x2", 1099500.0, 1e-10), | ||
("y2", 500.0, 1e-6), | ||
("xpixelsize", 1000.0, 1e-10), | ||
("xpixelsize", 1000.0, 1e-10), | ||
("cartesian_unit", "m", None), | ||
("yorigin", "upper", None), | ||
("institution", "ORG:78,CTY:616,CMT:Deutscher Wetterdienst radolan@dwd.de", None), | ||
("accutime", 5.0, 1e-10), | ||
("unit", "mm/h", None), | ||
("transform", None, None), | ||
("zerovalue", 0.0, 1e-10), | ||
("threshold", 0.12, 1e-10), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("variable, expected, tolerance", test_ry_attrs) | ||
def test_io_import_opera_hdf5_odyssey_dataset_attrs(variable, expected, tolerance): | ||
"""Test the importer OPERA HDF5.""" | ||
smart_assert(metadata_ry[variable], expected, tolerance) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 findpysteps_nwp_importers
as it is an optional additional package topysteps
. 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()
withinpysteps_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?