-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Description
Is your feature request related to a problem? Please describe.
read_rainbow_wrl is unable to read rainbow file version 5.65.2(+?) because it assumes that metadata is stored in every slice:
pyart/pyart/aux_io/rainbow_wrl.py
Lines 286 to 292 in 99c78e2
| # range | |
| if not single_slice: | |
| # all sweeps have to have the same range resolution | |
| for i in range(nslices): | |
| slice_info = rbf["volume"]["scan"]["slice"][i] | |
| if slice_info["rangestep"] != common_slice_info["rangestep"]: | |
| raise ValueError("range resolution changes between sweeps") |
In this case, 'rangestep' (among other things) is not in slice_info.
e.g.
>>> import wradlib as wr
>>> wr.__version__
'2.4.0'
>>> rbf = wr.io.read_rainbow(fp)
>>> rbf["volume"]["@version"]
'5.65.2'
>>> "rangestep" in rbf["volume"]["scan"]["slice"][0]
True
>>> "rangestep" in rbf["volume"]["scan"]["slice"][1]
False
>>> "rangestep" in rbf["volume"]["scan"]["slice"][2]
False
>>> len(rbf["volume"]["scan"]["slice"][0].keys())
88
>>> len(rbf["volume"]["scan"]["slice"][1].keys())
6
>>> len(rbf["volume"]["scan"]["slice"][2].keys())
6
Describe the solution you'd like
I think we can change the library to only check if it's available:
# range
if not single_slice:
# all sweeps have to have the same range resolution
for i in range(nslices):
slice_info = rbf["volume"]["scan"]["slice"][i]
if (
"rangestep" in slice_info
and slice_info["rangestep"] != common_slice_info["rangestep"]
):
raise ValueError("range resolution changes between sweeps")Describe alternatives you've considered
Given my use case, this function is my preferred way to parse rainbow files. I will open a PR if this change is acceptable. Thanks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels