Skip to content

read_rainbow_wrl version 5.65.2 support #1799

@philipmassouh

Description

@philipmassouh

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:

# 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions