Skip to content

Commit

Permalink
Merge pull request #885 from dstex/master
Browse files Browse the repository at this point in the history
Added option to ignore tilt angle in `plot_sweep_grid`
  • Loading branch information
scollis authored Dec 18, 2019
2 parents 121e9c6 + de289e8 commit c33a99b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions pyart/graph/radardisplay_airborne.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def plot(self, field, sweep=0, **kwargs):
return

def plot_sweep_grid(
self, field, sweep=0, mask_tuple=None,
self, field, sweep=0, ignoreTilt=False, mask_tuple=None,
vmin=None, vmax=None, cmap=None, norm=None, mask_outside=False,
title=None, title_flag=True,
axislabels=(None, None), axislabels_flag=True,
Expand All @@ -153,6 +153,13 @@ def plot_sweep_grid(
Other Parameters
----------------
ignoreTilt : bool
True to ignore tilt angle when running the
antenna_to_cartesian_track_relative coordinate transformation (by
setting tilt angle to 0), effectively plotting data relative to
slant range (the same plotting method utilized by the NCAR
soloii/3 software). False (default) plots relative to the aircraft
longitudinal axis.
mask_tuple : (str, float)
Tuple containing the field name and value below which to mask
field prior to plotting, for example to mask all data where
Expand Down Expand Up @@ -232,7 +239,7 @@ def plot_sweep_grid(
# get data for the plot
data = self._get_data(
field, sweep, mask_tuple, filter_transitions, gatefilter)
x, z = self._get_x_z(sweep, edges, filter_transitions)
x, z = self._get_x_z(sweep, edges, filter_transitions, ignoreTilt=ignoreTilt)

# mask the data where outside the limits
if mask_outside:
Expand Down Expand Up @@ -278,8 +285,13 @@ def label_yaxis_z(self, ax=None):
""" Label the yaxis with the default label for z units. """
ax = common.parse_ax(ax)
ax.set_ylabel('Distance Above ' + self.origin + ' (km)')

def _get_x_z(self, sweep, edges, filter_transitions, ignoreTilt=False):
""" Retrieve and return x and z coordinate in km. """
x, _, z = self._get_x_y_z(sweep, edges, filter_transitions, ignoreTilt=ignoreTilt)
return x, z

def _get_x_y_z(self, sweep, edges, filter_transitions):
def _get_x_y_z(self, sweep, edges, filter_transitions, ignoreTilt=False):
""" Retrieve and return x, y, and z coordinate in km. """
sweep_slice = self._radar.get_slice(sweep)

Expand Down Expand Up @@ -323,7 +335,10 @@ def _get_x_y_z(self, sweep, edges, filter_transitions):
drift = self.drift[sweep_slice]
tilt = self.tilt[sweep_slice]
pitch = self.pitch[sweep_slice]


if ignoreTilt:
tilt = tilt * 0.0

if edges:
if len(ranges) != 1:
ranges = transforms._interpolate_range_edges(ranges)
Expand Down

0 comments on commit c33a99b

Please sign in to comment.