pyart
pyart copied to clipboard
dealias_fourdd gives incorrect results or errors out when given a radar in which
The dealias_fourdd
function will give incorrect results or raises a ValueError when passed a radar instances in which the sweeps limits do no incorporate all of the rays in the volume (one or more rays are not included in any sweeps, typical when rays "in-transition" are included in the volume).
A minimal example is as follows:
import pyart
import numpy as np
radar = pyart.testing.make_velocity_aliased_radar()
radar.sweep_start_ray_index['data'][0] = 1
height = np.linspace(150, 250, 10).astype('float32')
speed = np.ones((10), dtype='float32') * 0.5
direction = np.ones((10), dtype='float32') * 5.
pyart.correct.dealias_fourdd(
radar, sounding_heights=height, sounding_wind_speeds=speed,
sounding_wind_direction=direction, keep_original=True)
Which produces:
Traceback (most recent call last):
File "minimal_bug.py", line 11, in <module>
sounding_wind_direction=direction, keep_original=True)
File "/home/jhelmus/dev/pyart/pyart/correct/dealias.py", line 250, in dealias_fourdd
data = np.where(is_bad_data, vel_array, data)
ValueError: operands could not be broadcast together with shapes (359,50) (360,50) (359,50)
This can be fixed by creating a new velocity data array which is completely masked and filling in dealiased data for each sweep.
This bug was originally discovered by @oue in #421.