diff --git a/doc/environment.yml b/doc/environment.yml index 0711041cb7..8469c1aef7 100644 --- a/doc/environment.yml +++ b/doc/environment.yml @@ -27,7 +27,7 @@ dependencies: - s3fs - pip - pip: - - pydata-sphinx-theme + - pydata-sphinx-theme<0.9.0 - sphinx_gallery - sphinx-copybutton - myst_nb diff --git a/pyart/core/transforms.py b/pyart/core/transforms.py index 046e9de8e0..3970dad84e 100644 --- a/pyart/core/transforms.py +++ b/pyart/core/transforms.py @@ -64,8 +64,8 @@ def antenna_to_cartesian(ranges, azimuths, elevations): Edition, 1993, p. 21. """ - theta_e = elevations * np.pi / 180.0 # elevation angle in radians. - theta_a = azimuths * np.pi / 180.0 # azimuth angle in radians. + theta_e = np.deg2rad(elevations) # elevation angle in radians. + theta_a = np.deg2rad(azimuths) # azimuth angle in radians. R = 6371.0 * 1000.0 * 4.0 / 3.0 # effective radius of earth in meters. r = ranges * 1000.0 # distances to gates in meters. diff --git a/pyart/graph/radardisplay.py b/pyart/graph/radardisplay.py index 001b66401a..53e74b520a 100644 --- a/pyart/graph/radardisplay.py +++ b/pyart/graph/radardisplay.py @@ -475,7 +475,7 @@ def plot_rhi( # check for negative values sweep_slice = self._radar.get_slice(sweep) az_mean = np.abs(np.mean(self._radar.azimuth['data'][sweep_slice])) - if 89.5 <= az_mean <= 90.0: + if (89.5 <= az_mean <= 90.0) or (269.5 <= az_mean <= 270.): R = np.sqrt(x ** 2 + y ** 2) * np.sign(x) else: R = np.sqrt(x ** 2 + y ** 2) * np.sign(y) @@ -1466,7 +1466,7 @@ def _get_data(self, field, sweep, mask_tuple, filter_transitions, # filter out antenna transitions if filter_transitions and self.antenna_transition is not None: in_trans = self.antenna_transition[sweep_slice] - data = data[in_trans == 0] + data = data[in_trans != 1] return data @@ -1489,7 +1489,7 @@ def _get_vpt_data(self, field, mask_tuple, filter_transitions, # filter out antenna transitions if filter_transitions and self.antenna_transition is not None: in_trans = self.antenna_transition - data = data[in_trans == 0] + data = data[in_trans != 1] return data.T diff --git a/pyart/util/xsect.py b/pyart/util/xsect.py index 3bc6f3c09a..4ce3918cc8 100644 --- a/pyart/util/xsect.py +++ b/pyart/util/xsect.py @@ -34,16 +34,22 @@ def cross_section_ppi(radar, target_azimuths, az_tol=None): """ # determine which rays from the ppi radar make up the pseudo RHI - prhi_rays = [] - valid_azimuths = [] - for target_azimuth in target_azimuths: + + prhi_rays = np.zeros((len(target_azimuths), radar.nsweeps)) + valid_azimuths = np.zeros((len(target_azimuths), radar.nsweeps)) + valid_elevations = np.zeros((len(target_azimuths), radar.nsweeps)) + i = 0 + for target_azimuth in sorted(target_azimuths): + j = 0 for sweep_slice in radar.iter_slice(): sweep_azimuths = radar.azimuth['data'][sweep_slice] + sweep_elevations = radar.azimuth["data"][sweep_slice] d_az = np.abs(sweep_azimuths - target_azimuth) if az_tol is None: ray_number = np.argmin(d_az) - prhi_rays.append(ray_number + sweep_slice.start) - valid_azimuths.append(target_azimuth) + prhi_rays[i, j] = ray_number + sweep_slice.start + valid_azimuths[i, j] = target_azimuth + valid_elevations[i, j] = sweep_elevations[ray_number] else: d_az_min = np.min(d_az) if d_az_min > az_tol: @@ -56,13 +62,20 @@ def cross_section_ppi(radar, target_azimuths, az_tol=None): ray_number = np.argmin(d_az) prhi_rays.append(ray_number + sweep_slice.start) valid_azimuths.append(target_azimuth) + valid_elevations.append(sweep_elevations[ray_number]) + + j+=1 + i+=1 - rhi_nsweeps = len(valid_azimuths) + rhi_nsweeps = len(np.unique(valid_azimuths)) if rhi_nsweeps == 0: raise ValueError('No azimuth found within tolerance') + + sorted_index = np.argsort(valid_azimuths, axis=1) + sorted_prhi_rays = list(np.ravel(np.take_along_axis(prhi_rays, sorted_index, axis=1)).astype(int)) radar_rhi = _construct_xsect_radar( - radar, 'rhi', prhi_rays, rhi_nsweeps, valid_azimuths) + radar, 'rhi', sorted_prhi_rays, rhi_nsweeps, list(np.unique(np.ravel(valid_azimuths)).astype(int))) return radar_rhi