asp_plot.stereo_geometry#

Attributes#

Classes#

StereoGeometryPlotter

Create visualizations of stereo geometry for satellite imagery.

Module Contents#

class asp_plot.stereo_geometry.StereoGeometryPlotter(directory, add_basemap=True, **kwargs)#

Bases: asp_plot.stereopair_metadata_parser.StereopairMetadataParser

Create visualizations of stereo geometry for satellite imagery.

This class extends StereopairMetadataParser to provide plotting capabilities for stereo geometry visualization, including skyplots showing satellite viewing angles and map views showing footprints and satellite positions.

directory#

Path to directory containing XML files

Type:

str

add_basemap#

Whether to add a basemap to map plots, default is True

Type:

bool

image_list#

List of XML files found in the directory (inherited from StereopairMetadataParser)

Type:

list

Examples

>>> plotter = StereoGeometryPlotter('/path/to/stereo/directory')
>>> plotter.dg_geom_plot(save_dir='/path/to/output', fig_fn='stereo_geom.png')
dg_geom_plot(save_dir=None, fig_fn=None)#

Create a comprehensive stereo geometry visualization.

Generates a figure with two subplots: 1. A skyplot showing satellite viewing angles (left) 2. A map view showing satellite paths and image footprints (right)

Parameters:
  • save_dir (str, optional) – Directory to save the figure, default is None (figure not saved)

  • fig_fn (str, optional) – Filename for the figure, default is None (figure not saved)

Returns:

The created figure object (not shown automatically)

Return type:

matplotlib.figure.Figure

Notes

If both save_dir and fig_fn are provided, the figure is saved using the save_figure utility function.

The map uses a local transverse Mercator projection centered on the intersection of the two image footprints to minimize distortion.

get_scene_string(p, key='catid1_dict')#

Format scene metadata as a string.

Creates a formatted string with key metadata for a scene, including catalog ID, GSD, viewing angles, and acquisition parameters.

Parameters:
  • p (dict) – Stereo pair dictionary containing scene metadata

  • key (str, optional) – Key for the scene dictionary within the pair dictionary, default is “catid1_dict”

Returns:

Formatted string with scene metadata

Return type:

str

get_title(p)#

Generate a comprehensive title for stereo geometry plots.

Creates a multi-line title string that includes stereo pair name, acquisition time information, stereo geometry parameters, and key metadata for both scenes.

Parameters:

p (dict) – Stereo pair dictionary containing metadata

Returns:

Formatted multi-line title string

Return type:

str

Notes

The title includes pairname, center datetime, time offset, convergence angle, base-to-height ratio, bisector elevation angle, asymmetry angle, intersection area, and metadata for both scenes.

map_plot(ax, p, map_crs='EPSG:3857', title=True, tight_layout=True)#

Create a map view of satellite paths and image footprints.

Plots the satellite ground tracks (ephemeris) and the image footprints for both images in a stereo pair on a map.

Parameters:
  • ax (matplotlib.axes.Axes) – Matplotlib axes object to plot on

  • p (dict) – Stereo pair dictionary with metadata from get_pair_dict()

  • map_crs (str, optional) – Coordinate reference system for the map, default is “EPSG:3857” (Web Mercator)

  • title (bool, optional) – Whether to add a title to the plot, default is True

  • tight_layout (bool, optional) – Whether to apply tight layout to the figure, default is True

Returns:

Modifies the provided axes object in-place

Return type:

None

Notes

  • Satellite footprints are shown as polygons

  • Satellite paths (ephemeris) are shown as point tracks

  • The start of each satellite path is marked with a white circle

  • A basemap is added if self.add_basemap is True

Credit#

Adapted from David Shean’s notebook: dshean/dgtools

satellite_position_orientation_plot(save_dir=None, fig_fn=None)#

Create a visualization of satellite position and orientation data.

Generates a 3-row x 2-column figure (one column per scene): - Row 0: Map of satellite positions colored by position covariance std - Row 1: Roll, pitch, yaw relative to orbital reference frame over time - Row 2: Attitude covariance trace std over time

Parameters:
  • save_dir (str, optional) – Directory to save the figure, default is None (figure not saved)

  • fig_fn (str, optional) – Filename for the figure, default is None (figure not saved)

Returns:

The created figure object (not shown automatically)

Return type:

matplotlib.figure.Figure

skyplot(ax, p, title=True, tight_layout=True)#

Create a polar plot showing satellite viewing geometry.

This plot shows the satellite azimuth and elevation angles for both images in a stereo pair on a polar plot, where azimuth is the angle and (90 - elevation) is the radius.

Parameters:
  • ax (matplotlib.axes.PolarAxes) – Polar axes object to plot the skyplot on

  • p (dict) – Stereo pair dictionary with metadata from get_pair_dict()

  • title (bool, optional) – Whether to add a title to the plot, default is True

  • tight_layout (bool, optional) – Whether to apply tight layout to the figure, default is True

Returns:

Modifies the provided axes object in-place

Return type:

None

Notes

In the polar plot: - The origin represents 90° elevation (satellite directly overhead) - The outer edge represents 40° elevation (50° from zenith) - Azimuth is measured clockwise from North (0°) - The symbols represent the satellite positions for each image - The dashed line connects the two satellite positions

add_basemap = True#
asp_plot.stereo_geometry.logger#