Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion pysteps/io/importers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
+------------------+----------------------------------------------------------+
| ypixelsize | grid resolution in y-direction |
+------------------+----------------------------------------------------------+
| xsize | grid size in x-direction |
+------------------+----------------------------------------------------------+
| ysize | grid size in y-direction |
+------------------+----------------------------------------------------------+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including these would imply providing these two metedata for all available readers

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey. I now see your point more clearly. First, apologies for this incomplete idea, this is the first time I am using the pull request. This idea might have been better off as a suggestion under Issues probably. Sorry for that. As I am only using the ODIM importer, where this xsize and ysize is a mandatory variable, I thought it's easier to read that parameter from metadata (as it must be there anyway) than to calculate it. But sure, it might not be the case for all the other importer options that pysteps supports. I apparently only looked it from my narrow perspective. As I don't have good knowledge of all the other importers I am certainly not able to fix them all to proceed with this. Probably better to discard this idea at this point as the parameters can be found/calculated from the data itself.

| cartesian_unit | the physical unit of the cartesian x- and y-coordinates: |
| | e.g. 'm' or 'km' |
+------------------+----------------------------------------------------------+
Expand Down Expand Up @@ -1474,7 +1478,21 @@ def import_odim_hdf5(filename, qty="RATE", **kwargs):
else:
xpixelsize = None
ypixelsize = None


if "xsize" in where.attrs.keys() and "ysize" in where.attrs.keys():
xsize = where.attrs["xsize"]
ysize = where.attrs["ysize"]
elif (
"xsize" in dataset1["where"].attrs.keys()
and "ysize" in dataset1["where"].attrs.keys()
):
where = dataset1["where"]
xsize = where.attrs["xsize"]
ysize = where.attrs["ysize"]
else:
xsize = None
ysize = None

if qty == "ACRR":
unit = "mm"
transform = None
Expand Down
Loading