-
Hello! I am a geography student (not formally trained in meteorology) working with radar data and machine learning of radar objects. I've been using pyart to access, clean up, and then convert to netcdf (so that I may then read it into xarrays and do my machine learning stuff on the attributes I glean from the xarrays). I would just like some help understanding some
If I want to grid all, say 16, sweeps individually, I imagine I would change the def grid_radars(radars_list):
gatefilters = []
rangegate = []
gatez = []
gatey = []
gatex = []
radar_locs = []
for r in radars_list:
# remove ring around radar
r.fields['reflectivity']['data'][:, -10:] = np.ma.masked
# specify which gates to exclude
gatefilter = pyart.filters.GateFilter(r) # instantiate gate filer
gatefilter.exclude_transition() # ignore gates collected between sweeps
gatefilter.exclude_masked('reflectivity') # ring mask we created
gatefilter.exclude_below('reflectivity', 15) # ignore values below 15
# caclulate RhoHV
snr = pyart.retrieve.calculate_snr_from_reflectivity(r, toa=0)
r.add_field('snr', snr, replace_existing=True)
vtext = pyart.retrieve.calculate_velocity_texture(r,
vel_field='velocity',
wind_size=3,
nyq=r.instrument_parameters['nyquist_velocity']['data'][0])
r.add_field('vtext', vtext, replace_existing=True)
# append gatefilters to list and range gates to list
gatefilters.append(gatefilter)
rangegate.append(int(r.range['meters_between_gates']))
# append min/max gate coordinates to list
gatez = np.append(gatez, r.gate_z['data'])
gatey = np.append(gatey, r.gate_y['data'])
gatex = np.append(gatex, r.gate_x['data'])
# append radar location coordinates to list
rloc_tup = (r.latitude['data'][0], r.longitude['data'][0])
radar_locs.append(rloc_tup)
# create tuples where needed
gatefilters_tuple = tuple(gatefilters)
radars_tuple = tuple(radars_list)
# find centroid of all radars
points = MultiPoint(radar_locs)
centroid = points.centroid
# create grid
grid_obj = pyart.map.grid_from_radars(radars=radars_tuple,
gatefilters=gatefilters_tuple,
grid_shape=(1,
int(np.max(rangegate)),
int(np.max(rangegate))
),
grid_limits=((np.min(gatez), np.max(gatez)),
(np.min(gatex), np.max(gatex)),
(np.min(gatey), np.max(gatey))
),
grid_origin=(centroid.x, centroid.y)
)
return grid_obj |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @msteckle, the grid limits is essentially the domain of your points and how many interpolated points between them. So if you did, for example, 12 for shape for Z and 0, 6000 for Z grid limits, you would have a point every 500m. Same goes for x, and y. For the 16 sweeps, you would want to see what the max gate z is for the final sweep to capture it. radar.gate_z or radar.gate_altitude['data'].max(), and I believe how often you would like there to be points would be your shape. The algorithms used for gridding, barnes, cressman, nearest etc, finds all gates within a radius of influence for each grid point, and maps each radar gate onto the grid using a radius of influence. Cheers, |
Beta Was this translation helpful? Give feedback.
Hi @msteckle, the grid limits is essentially the domain of your points and how many interpolated points between them. So if you did, for example, 12 for shape for Z and 0, 6000 for Z grid limits, you would have a point every 500m. Same goes for x, and y. For the 16 sweeps, you would want to see what the max gate z is for the final sweep to capture it. radar.gate_z or radar.gate_altitude['data'].max(), and I believe how often you would like there to be points would be your shape. The algorithms used for gridding, barnes, cressman, nearest etc, finds all gates within a radius of influence for each grid point, and maps each radar gate onto the grid using a radius of influence.
Cheers,
Zach S.