Wradlib.util.cross_section_ppi - wrong altitude

Hi all,

I just figured out that my rays are plotted on a different altitude than I’d expect. I am not sure if I did something wrong or if this is a bug in the cross_section_ppi function. Here is what I have:

fname = "/file/to/h5path"

sweeps = []
for sn in np.arange(5):
    # load all sweeps and merge them
    swp = xr.open_dataset(fname, engine="odim", group="sweep_"+str(sn))
    sweeps.append(swp)
    
    # round the azimuths to avoid slight differences in the different sweep rounds
    sweeps[sn].coords["azimuth"] = sweeps[sn].coords["azimuth"].round(0)
    
    nodata_mask = swp.DBZH.values == -327.68
    swp.DBZH.values[nodata_mask] = np.nan

vol = xr.concat(sweeps, dim="sweep_fixed_angle")
vol = vol.set_coords(("sweep_mode", "sweep_number", "prt_mode", "follow_mode"))
vol["elevation"] = vol["elevation"].median("azimuth")
vol["time"] = vol["time"].min("azimuth")

azimuth = 84
rec_rhi = wradlib.util.cross_section_ppi(vol, azimuth)
rec_rhi.DBZH.plot(cmap='viridis', x="gr", y="z", ylim=(0,8000))

And if i zoom-in, the rays of the radar start in an altitude higher than given in the coordinate “altitude” in vol .

Best,
Julian

@lou How much is the height difference? If it is in the meter-range it could be related to the bin range. The height is sampled at bin center, not at bin start.

HTH,
Kai

@kmuehlbauer It seems like that it gets doubled. In my meta-data, altitude was at 150m, but the rays started at 300m. If I change altitude to a different value, the radar rays start always at an altitude of 2*alt.

@lou Yes, this looks like a bug. But I’m not sure where the error source actually is. Need to dive into this.

@JulianGiles could you please have a look here?

@lou, @JulianGiles

I’ve found the root cause here, and it’s no real bug, but some usage pattern from old ages.

Please add crs="None" (note the quotation marks) to the call to cross_section_ppi. This should fix the immediate problem.

HTH,
Kai

Hi @kmuehlbauer , how can this be fixed so the default behavior is the expected one? Should I just delete the crs keyword from the call to georeference?

@JulianGiles Thanks for looking into this!

No, we should keep it. But inside cross_section_ppi we would need to default the extraction of crs to "None".

crs = kwargs.get("crs", "None")

Thanks!
Kai

1 Like

@kmuehlbauer. Thanks! That works :slight_smile: