<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> from . radardisplay import RadarDisplay <EOL> from . import common <EOL> from . . core . transforms import antenna_to_cartesian <EOL> from . . core . transforms import antenna_to_cartesian_track_relative <EOL> from . . core import transforms <EOL> class AirborneRadarDisplay ( RadarDisplay ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , radar , shift = ( <NUM_LIT:0.0> , <NUM_LIT:0.0> ) ) : <EOL> """<STR_LIT>""" <EOL> self . fixed_angle = radar . fixed_angle [ '<STR_LIT:data>' ] [ <NUM_LIT:0> ] <EOL> self . rotation = radar . rotation [ '<STR_LIT:data>' ] <EOL> self . roll = radar . roll [ '<STR_LIT:data>' ] <EOL> self . drift = radar . drift [ '<STR_LIT:data>' ] <EOL> self . tilt = radar . tilt [ '<STR_LIT:data>' ] <EOL> self . heading = radar . heading [ '<STR_LIT:data>' ] <EOL> self . pitch = radar . pitch [ '<STR_LIT:data>' ] <EOL> self . altitude = radar . altitude [ '<STR_LIT:data>' ] <EOL> super ( AirborneRadarDisplay , self ) . __init__ ( radar , shift ) <EOL> middle_lat = int ( radar . latitude [ '<STR_LIT:data>' ] . shape [ <NUM_LIT:0> ] / <NUM_LIT:2> ) <EOL> middle_lon = int ( radar . longitude [ '<STR_LIT:data>' ] . shape [ <NUM_LIT:0> ] / <NUM_LIT:2> ) <EOL> lat = float ( radar . latitude [ '<STR_LIT:data>' ] [ middle_lat ] ) <EOL> lon = float ( radar . longitude [ '<STR_LIT:data>' ] [ middle_lon ] ) <EOL> self . loc = ( lat , lon ) <EOL> def plot ( self , field , sweep = <NUM_LIT:0> , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if self . scan_type == '<STR_LIT>' : <EOL> self . plot_ppi ( field , sweep , ** kwargs ) <EOL> elif self . scan_type == '<STR_LIT>' : <EOL> self . plot_sweep_grid ( field , sweep , ** kwargs ) <EOL> elif self . scan_type == '<STR_LIT>' : <EOL> self . plot_sweep_grid ( field , sweep , ** kwargs ) <EOL> else : <EOL> raise ValueError ( '<STR_LIT>' % ( self . scan_type ) ) <EOL> return <EOL> def plot_sweep_grid ( <EOL> self , field , sweep = <NUM_LIT:0> , mask_tuple = None , <EOL> vmin = None , vmax = None , cmap = None , norm = None , mask_outside = False , <EOL> title = None , title_flag = True , <EOL> axislabels = ( None , None ) , axislabels_flag = True , <EOL> colorbar_flag = True , colorbar_label = None , <EOL> colorbar_orient = '<STR_LIT>' , edges = True , filter_transitions = True , <EOL> ax = None , fig = None , gatefilter = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> ax , fig = common . parse_ax_fig ( ax , fig ) <EOL> norm , vmin , vmax = common . parse_norm_vmin_vmax ( <EOL> norm , self . _radar , field , vmin , vmax ) <EOL> cmap = common . parse_cmap ( cmap , field ) <EOL> data = self . _get_data ( <EOL> field , sweep , mask_tuple , filter_transitions , gatefilter ) <EOL> x , z = self . _get_x_z ( sweep , edges , filter_transitions ) <EOL> if mask_outside : <EOL> data = np . ma . masked_invalid ( data ) <EOL> data = np . ma . masked_outside ( data , vmin , vmax ) <EOL> pm = ax . pcolormesh ( <EOL> x , z , data , vmin = vmin , vmax = vmax , cmap = cmap , norm = norm , ** kwargs ) <EOL> if title_flag : <EOL> self . _set_title ( field , sweep , title , ax ) <EOL> if axislabels_flag : <EOL> self . _label_axes_rhi ( axislabels , ax ) <EOL> self . plots . append ( pm ) <EOL> self . plot_vars . append ( field ) <EOL> if colorbar_flag : <EOL> self . plot_colorbar ( <EOL> mappable = pm , label = colorbar_label , orient = colorbar_orient , <EOL> field = field , ax = ax , fig = fig ) <EOL> def label_xaxis_x ( self , ax = None ) : <EOL> """<STR_LIT>""" <EOL> ax = common . parse_ax ( ax ) <EOL> ax . set_xlabel ( '<STR_LIT>' + self . origin + '<STR_LIT>' ) <EOL> def label_yaxis_y ( self , ax = None ) : <EOL> """<STR_LIT>""" <EOL> ax = common . parse_ax ( ax ) <EOL> ax . set_ylabel ( '<STR_LIT>' + self . origin + '<STR_LIT>' ) <EOL> def label_yaxis_z ( self , ax = None ) : <EOL> """<STR_LIT>""" <EOL> ax = common . parse_ax ( ax ) <EOL> ax . set_ylabel ( '<STR_LIT>' + self . origin + '<STR_LIT>' ) <EOL> def _get_x_y_z ( self , sweep , edges , filter_transitions ) : <EOL> """<STR_LIT>""" <EOL> sweep_slice = self . _radar . get_slice ( sweep ) <EOL> if self . _radar . metadata [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> if filter_transitions and self . antenna_transition is not None : <EOL> in_trans = self . antenna_transition [ sweep_slice ] <EOL> ranges = self . ranges <EOL> azimuths = self . azimuths [ in_trans == <NUM_LIT:0> ] <EOL> elevations = self . elevations [ in_trans == <NUM_LIT:0> ] <EOL> else : <EOL> ranges = self . ranges <EOL> azimuths = self . azimuths [ sweep_slice ] <EOL> elevations = self . elevations [ sweep_slice ] <EOL> if edges : <EOL> if len ( ranges ) != <NUM_LIT:1> : <EOL> ranges = transforms . _interpolate_range_edges ( ranges ) <EOL> if len ( elevations ) != <NUM_LIT:1> : <EOL> elevations = transforms . _interpolate_elevation_edges ( <EOL> elevations ) <EOL> if len ( azimuths ) != <NUM_LIT:1> : <EOL> azimuths = transforms . _interpolate_azimuth_edges ( azimuths ) <EOL> rg , azg = np . meshgrid ( ranges , azimuths ) <EOL> rg , eleg = np . meshgrid ( ranges , elevations ) <EOL> x , y , z = antenna_to_cartesian ( rg / <NUM_LIT> , azg , eleg ) <EOL> else : <EOL> if filter_transitions and self . antenna_transition is not None : <EOL> in_trans = self . antenna_transition [ sweep_slice ] <EOL> ranges = self . ranges <EOL> rotation = self . rotation [ in_trans == <NUM_LIT:0> ] <EOL> roll = self . roll [ in_trans == <NUM_LIT:0> ] <EOL> drift = self . drift [ in_trans == <NUM_LIT:0> ] <EOL> tilt = self . tilt [ in_trans == <NUM_LIT:0> ] <EOL> pitch = self . pitch [ in_trans == <NUM_LIT:0> ] <EOL> else : <EOL> ranges = self . ranges <EOL> rotation = self . rotation [ sweep_slice ] <EOL> roll = self . roll [ sweep_slice ] <EOL> drift = self . drift [ sweep_slice ] <EOL> tilt = self . tilt [ sweep_slice ] <EOL> pitch = self . pitch [ sweep_slice ] <EOL> if edges : <EOL> if len ( ranges ) != <NUM_LIT:1> : <EOL> ranges = transforms . _interpolate_range_edges ( ranges ) <EOL> if len ( rotation ) != <NUM_LIT:1> : <EOL> rotation = transforms . _interpolate_azimuth_edges ( rotation ) <EOL> roll = transforms . _interpolate_azimuth_edges ( roll ) <EOL> drift = transforms . _interpolate_azimuth_edges ( drift ) <EOL> tilt = transforms . _interpolate_azimuth_edges ( tilt ) <EOL> pitch = transforms . _interpolate_azimuth_edges ( pitch ) <EOL> rg , rotg = np . meshgrid ( ranges , rotation ) <EOL> rg , rollg = np . meshgrid ( ranges , roll ) <EOL> rg , driftg = np . meshgrid ( ranges , drift ) <EOL> rg , tiltg = np . meshgrid ( ranges , tilt ) <EOL> rg , pitchg = np . meshgrid ( ranges , pitch ) <EOL> x , y , z = antenna_to_cartesian_track_relative ( <EOL> rg / <NUM_LIT> , rotg , rollg , driftg , tiltg , pitchg ) <EOL> x = ( x + self . shift [ <NUM_LIT:0> ] ) / <NUM_LIT> <EOL> y = ( y + self . shift [ <NUM_LIT:1> ] ) / <NUM_LIT> <EOL> z = z / <NUM_LIT> <EOL> return x , y , z </s>
