attitude_plotter: Module to visualize satellite instrument pointing direction

Plotting routines for 2D and 3D look directions of the instrument onboard spacecraft.

@author: ceren

class attitude_plotter.MyAxes3D(baseObject, sides_to_draw)

Class to draw 3D grids for the counter-clockwise angles of 3D plots.

draw(renderer)

Draw the Artist (and its children) using the given renderer.

This has no effect if the artist is not visible (.Artist.get_visible returns False).

renderer : .RendererBase subclass.

This method is overridden in the Artist subclasses.

set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, autoscalez_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, proj_type=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, some_features_visibility=<UNSET>, subplotspec=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xlim3d=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ylim3d=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zbound=<UNSET>, zlabel=<UNSET>, zlim=<UNSET>, zmargin=<UNSET>, zorder=<UNSET>, zscale=<UNSET>, zticklabels=<UNSET>, zticks=<UNSET>)

Set multiple properties at once.

Supported properties are

Properties:

adjustable: {‘box’, ‘datalim’} agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None anchor: (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} animated: bool aspect: {‘auto’, ‘equal’, ‘equalxy’, ‘equalxz’, ‘equalyz’} autoscale_on: bool autoscalex_on: unknown autoscaley_on: unknown autoscalez_on: unknown axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or ‘line’ box_aspect: 3-tuple of floats or None clip_box: .Bbox clip_on: bool clip_path: Patch or (Path, Transform) or None facecolor or fc: color figure: .Figure frame_on: bool gid: str in_layout: bool label: object mouseover: bool navigate: bool navigate_mode: unknown path_effects: .AbstractPathEffect picker: None or bool or float or callable position: [left, bottom, width, height] or ~matplotlib.transforms.Bbox proj_type: {‘persp’, ‘ortho’} prop_cycle: unknown rasterization_zorder: float or None rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None some_features_visibility: unknown subplotspec: unknown title: str transform: .Transform url: str visible: bool xbound: unknown xlabel: str xlim or xlim3d: (bottom: float, top: float) xlim3d: (bottom: float, top: float) xmargin: float greater than -0.5 xscale: unknown xticklabels: unknown xticks: unknown ybound: unknown ylabel: str ylim or ylim3d: (bottom: float, top: float) ylim3d: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: unknown yticklabels: unknown yticks: unknown zbound: unknown zlabel: unknown zlim or zlim3d: unknown zmargin: float greater than -0.5 zorder: float zscale: unknown zticklabels: unknown zticks: unknown

attitude_plotter.attitude_2d_altitude(time_array, extent, x, y, z, Px, V, inst_name, target_name, x_axis='lon', step=60)
time_arraydatetime.datetime

experiment time interval as datetime array.

extentlist

extent = [Lonmin, Lonmax, Altmin, Altmax].

xnumpy.ndarray[float]

spacecraft longitude(degrees).

ynumpy.ndarray[float]

spacecraft latitude (degrees).

znumpy.ndarray[float]

spacecraft altitude (km).

Pxfloat

Location of the target on the x_axis (lat or lon) (degrees).

Vnumpy.ndarray[float]

vectors to be plotted (need to be in ENU coordinate system).

inst_namestr

Instrument name for labels.

target_namestr

Target name for labels.

x_axisstr, optional

Parameter to be plotted on the x-axis (lat or lon). The default is ‘lon’.

stepint

Time in seconds between pointing direction vectors. The default is 60.

figfigure.Figure

Figure object of matplotlib.figure module.

axaxes

Axes object of matplotlib.

attitude_plotter.attitude_2d_on_map(time_array, extent, x, y, z, Px, Py, V, target_name, inst_name, index_ca, step=60)

Plots the spacecraft trajectory and instrument pointing direction vectors on map.

time_arraydatetime.datetime

experiment time interval as datetime array.

extentlist

extent = [Lonmin, Lonmax, Latmin, Latmax].

xnumpy.ndarray[float]

spacecraft longitude(degrees).

ynumpy.ndarray[float]

spacecraft latitude (degrees).

znumpy.ndarray[float]

spacecraft altitude (km).

Pxfloat

geodetic longitude of the target.

Pyfloat

geodetic latitude of the target.

Vnumpy.ndarray[float]

vectors to be plotted (need to be in ENU coordinate system).

inst_namestr

Instrument name for labels.

target_namestr

Target name for labels.

index_caint

index of the point of closest approach. can be found by using miscellaneous.find_index

stepint

Time in seconds between pointing direction vectors. The default is 60.

figfigure.Figure

Figure object of matplotlib.figure module.

axaxes

Axes object of matplotlib.

attitude_plotter.attitude_3d_connect_to_subpoint(title, time_array, Px, Py, Pz, x, y, z, target_name, *V, step=60, vc=['red', '#12e193', 'red', '#12e193', 'black', '#0165fc'], arrlen=[0.25, 0.25, 0.25, 0.25, 0.75, 0.75], ls=['solid', 'solid', 'solid', 'solid', 'solid', 'solid'], labels=['$Dipole_{1}$', '$Dipole_{2}$', 'Boresight', '$Ray_{LOS}$'], markers=['_', '$--$', '$\\longrightarrow$', '$\\longrightarrow$', 'H', 'H'], legend_colors=['red', '#12e193', 'black', '#0165fc', 'None', 'black'], legend_edgecolors=['red', '#12e193', 'black', '#0165fc', 'black', 'black'], loc='upper center')

Plotting function to show projected look direction of RRI on the ground. The defaults for the keywords are based on RRI plots.

titlestr

plot title.

time_arraydatetime.datetime

experiment time interval as datetime array.

Pxfloat

geodetic longitude of the target.

Pyfloat

geodetic latitude of the target.

Pzfloat

altitude of the target.

xnumpy.ndarray[float]

spacecraft longitude.

ynumpy.ndarray[float]

spacecraft latitude.

znumpy.ndarray[float]

spacecraft altitude.

target_namestr

target name.

*Vnumpy.ndarray

vectors to be plotted (need to be in ENU coordinate system). vec_args = M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr

stepfloat, optional

Step in seconds to plot vectors. The default is 60.

vclist, optional

vector colors. The default is [‘red’,’#12e193’, ‘red’, ‘#12e193’, ‘black’, ‘#0165fc’].

arrlenTYPE, optional

DESCRIPTION. The default is [0.25, 0.25, 0.25, 0.25, 0.75, 0.75].

lslist, optional

linestyles for vectors. The default is [‘solid’, ‘solid’, ‘solid’, ‘solid’,’solid’, ‘solid’].

labelslist, optional

vector labels for legend. The default is [‘$Dipole_{1}$’,’$Dipole_{2}$’,’Boresight’’$Ray_{LOS}$’].

markerslist, optional

legend markers. The default is [‘_’,’$–$’,r’$longrightarrow$’, r’$longrightarrow$’,’H’,’H’].

legend_colorslist, optional

colors for labels in the legend. The default is [‘red’, ‘#12e193’,’black’,’#0165fc’ ,’None’, ‘black’].

legend_edgecolorslist, optional

edgecolors for labels in the legend. The default is [‘red’, ‘#12e193’,’black’,’#0165fc’ ,’black’, ‘black’].

locstr

legend location. uses same keywords as matplotlib legend. The default is ‘upper center’.

figfigure.Figure

Figure object of matplotlib.figure module.

V = M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr connect_to_subpoint= ap.attitude_3d_connect_to_subpoint(title, time_array, pLon, pLat, OH, Lon, Lat, Alt,

‘Ottawa’, *V, step = 60)

attitude_plotter.attitude_3d_connect_to_target(title, time_array, Px, Py, Pz, x, y, z, target_name, *V, step=60, vc=['red', '#12e193', 'red', '#12e193', 'black', 'blue'], ls=['solid', 'solid', 'solid', 'solid', 'solid', 'solid'], lw=[2.5, 2.5, 2.5, 2.5, 2, 2], arrlen=[0.5, 0.5, 0.5, 0.5, 1, 1], labels=['$Dipole_{1}$', '$Dipole_{2}$', 'Boresight', '$Ray_{LOS}$', 'N', 'S'], markers=['_', '_', '$\\longrightarrow$', '$\\longrightarrow$', 'H', 'H'], colors=['red', '#12e193', 'black', 'blue', 'None', 'black'], edgecolors=['red', '#12e193', 'black', 'blue', 'black', 'black'], arrowhead=[0.01, 0.01, 0.01, 0.01, 0.25, 0.25], sct_kwargs={'alpha': 1, 'c': 'lightgrey', 'edgecolor': 'black', 'marker': '*', 's': 180}, loc='upper center')

Plotting function in 3D to connect the spacecraft location with the target. The defaults for the keywords are based on RRI plots.

titlestr

plot title.

time_arraydatetime.datetime

experiment time interval as datetime array.

Pxfloat

geodetic longitude of the target.

Pyfloat

geodetic latitude of the target.

Pzfloat

altitude of the target (km).

xnumpy.ndarray

spacecraft longitude.

ynumpy.ndarray

spacecraft latitude.

znumpy.ndarray

spacecraft altitude.

target_namestr

target name.

*Vnumpy.ndarray

vectors to be plotted (need to be in ENU coordinate system). vec_args = M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr

stepint

time between the vectors. The default is 60. (60 seconds)

vclist, optional

vector colors. The default is [‘red’, ‘#12e193’, ‘red’, ‘#12e193’, ‘black’, ‘blue’].

lslist, optional

linestyles for vectors. The default is [‘solid’, ‘solid’, ‘solid’, ‘solid’, ‘solid’, ‘solid’].

lwlist, optional

linewidth of vectors. The default is [2.5, 2.5, 2.5, 2.5, 2, 2].

arrlenlist, optional

length for vectors. The default is [0.5, 0.5, 0.5, 0.5, 1, 1].

labelslist, optional

vector labels for legend. The default is [‘$Dipole_{1}$’, ‘$Dipole_{2}$’, ‘Boresight’, ‘$Ray_{LOS}$’].

markerslist, optional

legend markers. The default is [‘_’,’_’, r’$longrightarrow$’, r’$longrightarrow$’].

colorslist, optional

colors for labels in the legend. The default is [‘red’, ‘#12e193’, ‘black’, ‘blue’].

edgecolorslist, optional

edgecolors for labels in the legend. The default is [‘red’, ‘#12e193’, ‘black’,’blue’].

arrowheadlist, optional

how large is the arrow head. The default is [0.01, 0.01, 0.01, 0.01, 0.25, 0.25].

sct_kwargsdict, optional

target marker specifics.The default is {‘alpha’: 1, ‘edgecolor’:’black’, ‘c’: ‘lightgrey’, ‘marker’: ‘*’, ‘s’: 180}.

locstr, optional

Location of the legend. The default is ‘upper center’.

figfigure.Figure

Figure object of matplotlib.figure module.

axaxes

Axes object of matplotlib.

vec_args= M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr connected_plot, ax = ap.attitude_3d_connect_to_target(title_vec, time_array_1sec, pLon, pLat, pH, Lon, Lat, Alt, target_name, *vec_args, step = 45)

attitude_plotter.attitude_3d_ground_quiver(title, time_array, Px, Py, Pz, x, y, z, dir_vec, target_name, *V, step=60, vc=['red', '#12e193', 'red', '#12e193', 'black', '#0165fc'], arrlen=[0.25, 0.25, 0.25, 0.25, 0.75, 0.75], ls=['solid', 'solid', 'solid', 'solid', 'solid', 'solid'], labels=['$Dipole_{1}$', '$Dipole_{2}$', 'Boresight', '$Ray_{LOS}$'], markers=['_', '$--$', '$\\longrightarrow$', '$\\longrightarrow$', 'H', 'H'], legend_colors=['red', '#12e193', 'black', '#0165fc', 'None', 'black'], legend_edgecolors=['red', '#12e193', 'black', '#0165fc', 'black', 'black'], loc='upper center')

Plotting function to show projected look direction of RRI on the ground. The defaults for the keywords are based on RRI plots.

titlestr

plot title.

time_arraydatetime.datetime

experiment time interval as datetime array.

Pxfloat

geodetic longitude of the target.

Pyfloat

geodetic latitude of the target.

Pzfloat

altitude of the target.

xnumpy.ndarray[float]

spacecraft longitude.

ynumpy.ndarray[float]

spacecraft latitude.

znumpy.ndarray[float]

spacecraft altitude.

dir_vecnumpy.ndarray[float]

look direction vector in ENU.

target_namestr

target name.

*Vnumpy.ndarray

vectors to be plotted (need to be in ENU coordinate system). vec_args = M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr

stepfloat, optional

Step in seconds to plot vectors. The default is 60.

vclist, optional

vector colors. The default is [‘red’,’#12e193’, ‘red’, ‘#12e193’, ‘black’, ‘#0165fc’].

arrlenTYPE, optional

DESCRIPTION. The default is [0.25, 0.25, 0.25, 0.25, 0.75, 0.75].

lslist, optional

linestyles for vectors. The default is [‘solid’, ‘solid’, ‘solid’, ‘solid’,’solid’, ‘solid’].

labelslist, optional

vector labels for legend. The default is [‘$Dipole_{1}$’,’$Dipole_{2}$’,’Boresight’’$Ray_{LOS}$’].

markerslist, optional

legend markers. The default is [‘_’,’$–$’,r’$longrightarrow$’, r’$longrightarrow$’,’H’,’H’].

legend_colorslist, optional

colors for labels in the legend. The default is [‘red’, ‘#12e193’,’black’,’#0165fc’ ,’None’, ‘black’].

legend_edgecolorslist, optional

edgecolors for labels in the legend. The default is [‘red’, ‘#12e193’,’black’,’#0165fc’ ,’black’, ‘black’].

locstr

legend location. uses same keywords as matplotlib legend. The default is ‘upper center’.

figfigure.Figure

Figure object of matplotlib.figure module.

axaxes

Axes object of matplotlib.

V = M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr ground_quiver_3d = op.attitude_3d_ground_quiver(title, time_array, pLon, pLat, OH, Lon, Lat, Alt, RRI_enu,

‘Ottawa’, *V, step = 60)

attitude_plotter.display_observation_geometry(title, time_array, Px, Py, Pz, x, y, z, target_name, *V, step=60, vc=['red', '#12e193', 'red', '#12e193', 'black', 'blue'], ls=['solid', 'solid', 'solid', 'solid', 'solid', 'solid'], lw=[1.5, 1.5, 1.5, 1.5, 1.5, 1.5], arrlen=[0.5, 0.5, 0.5, 0.5, 0.75, 1], labels=['$Dipole_{1}$', '$Dipole_{2}$', 'Boresight', '$Ray_{LOS}$'], markers=['_', '_', '$\\longrightarrow$', '$\\longrightarrow$'], colors=['red', '#12e193', 'black', 'blue'], edgecolors=['red', '#12e193', 'black', 'blue'], arrowhead=[0.01, 0.01, 0.01, 0.01, 0.45, 0.45], sct_kwargs={'alpha': 1, 'c': 'lightgrey', 'edgecolor': 'black', 'marker': '*', 's': 180}, loc='upper center')

Plotting function to display observation geometry. The defaults for the keywords are based on RRI plots.

titlestr

plot title.

time_arraydatetime.datetime

experiment time interval as datetime array.

Pxfloat

geodetic longitude of the target.

Pyfloat

geodetic latitude of the target.

Pzfloat

altitude of the target.

xnumpy.ndarray[float]

spacecraft longitude(degrees).

ynumpy.ndarray[float]

spacecraft latitude (degrees).

znumpy.ndarray[float]

spacecraft altitude (km).

target_namestr

target name.

*Vnumpy.ndarray[float]

vectors to be plotted (need to be in ENU coordinate system). vec_args = M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr

stepint

time between the vectors. The default is 60. (60 seconds)

vclist, optional

vector colors. The default is [‘red’, ‘#12e193’, ‘red’, ‘#12e193’, ‘black’, ‘blue’].

lslist, optional

linestyles for vectors. The default is [‘solid’, ‘solid’, ‘solid’, ‘solid’, ‘solid’, ‘solid’].

lwlist, optional

linewidth of vectors. The default is [1.5, 1.5, 1.5, 1.5, 1.5, 1.5].

arrlenlist, optional

length for vectors. The default is [.5, .5, .5, .5, .75, 1].

labelslist, optional

vector labels for legend. The default is [‘$Dipole_{1}$’, ‘$Dipole_{2}$’, ‘Boresight’, ‘$Ray_{LOS}$’].

markerslist, optional

legend markers. The default is [‘_’,’_’, r’$longrightarrow$’, r’$longrightarrow$’].

colorslist, optional

colors for labels in the legend. The default is [‘red’, ‘#12e193’, ‘black’, ‘blue’].

edgecolorslist, optional

edgecolors for labels in the legend. The default is [‘red’, ‘#12e193’, ‘black’,’blue’].

arrowheadlist, optional

how large is the arrow head. The default is [0.01, 0.01, 0.01, 0.01, 0.45, 0.45].

sct_kwargsdict, optional

target marker specifics.The default is {‘alpha’: 1, ‘edgecolor’:’black’, ‘c’: ‘lightgrey’, ‘marker’: ‘*’, ‘s’: 180}.

locstr

legend location. uses same keywords as matplotlib legend. The default is ‘upper right’.

figfigure.Figure

Figure object of matplotlib.figure module.

axaxes

Axes object of matplotlib.

vec_args= M1_enu, M3_enu, M2_enu, M4_enu, RRI_enu, los_enu_arr connected_plot = op.display_observation_geometry(title_vec, time_array_1sec, pLon, pLat, OH, Lon, Lat, Alt, ‘Ottawa’, *vec_args, n=45)

attitude_plotter.earth_radius_at_latitude(latitude)

Function to calculate Earth radius at latitude to correctly scale the ellipse height for FOV plotter.

latitudefloat

Geodetic latitude (degrees).

Rfloat

Earth’s radius in meters.

attitude_plotter.fov_plotter(extent, time_array, x, y, z, fov_deg, px, py, step=90, inst_name='FAI', target_name='ICEBEAR')

Plot the FOV of the instrument for Nadir look directions. Caution: This code ONLY works for NADIR pointing instruments.

extentlist

[Lonmin, Lonmax, Latmin, Latmax].

time_arraynumpy.ndarray[datetime]

Experiment time interval.

xnumpy.ndarray[float]

Spacecraft longitude (degrees).

ynumpy.ndarray[float]

Spacecraft latitude (degrees).

znumpy.ndarray[float]

Spacecraft altitude (km).

fov_degfloat

Field-of-view angle (degrees).

pxfloat

Target longitude (degrees).

pyfloat

Target latitude (degrees).

step: float, optional

Time interval in seconds to plot the inst. vector.The default is 90.

inst_namestring

Name of the instrument. The default is ‘FAI’.

target_namestring

Target name. The default is ‘ICEBEAR’.

fig: figure.Figure

Figure object of matplotlib.figure module.

axTYPE

DESCRIPTION.

attitude_plotter.plot_attitude_accuracy(file_RRI)

Plots the attitude accuracy using the accuracy data in RRI data files. 0=Dropout, 1=Rough, 2=Coarse, 3=Moderate, 4=Fine, 9=NaN.

file_RRIstr

Filename of the RRI data file including the path.

figfigure.Figure

Figure object of matplotlib.figure module.

axaxes

Axes object of matplotlib.

attitude_plotter.plot_slew_rri(ax, ylim_min, ylim_max, panel_number, time_array, slew, slew_angle, cb_axis='no', time='no')

Function to plot the temporal change of slew accuracy for the criterion set by slew_angle.

axaxes

Axes object of matplotlib.

ylim_minfloat

DESCRIPTION.

ylim_maxfloat

DESCRIPTION.

panel_numberint

panel number in slew criteria plot.

time_arraydatetime.datetime

experiment time interval as datetime array.

slewnumpy.ndarray[float]

slew parameter. Can be [-2, -1, -0.5, 0, 0.5, 1, 2]

slew_anglefloat

criteria for slew (degrees).

cb_axisstr, optional

color bar axes display (‘yes’/’no’). The default is ‘no’.

timestr, optional

x-axis time display (‘yes’/’no’). The default is ‘no’.

None.

attitude_plotter.trajectory_plotter_2d_map(time_array, extent, x, y, z, Px, Py, XV, target_name, index_ca)

Plots the spacecraft trajectory on map. Prints the trajectory information on screen: altitude increasing/decreasing spacecraft going towards: NE, SW, NW, SE.

time_arraydatetime.datetime

experiment time interval as datetime array.

extentTYPE

DESCRIPTION.

xnumpy.ndarray[float]

spacecraft longitude(degrees).

ynumpy.ndarray[float]

spacecraft latitude (degrees).

znumpy.ndarray[float]

spacecraft altitude (km).

Pxfloat

geodetic longitude of the target.

Pyfloat

geodetic latitude of the target.

target_namestr

Target name for labels.

index_caint

index of the point of closest approach. can be found by using miscellaneous.find_index

figfigure.Figure

Figure object of matplotlib.figure module.

axaxes

Axes object of matplotlib.