asp_plot.stereo_geometry
========================

.. py:module:: asp_plot.stereo_geometry


Attributes
----------

.. autoapisummary::

   asp_plot.stereo_geometry.logger


Classes
-------

.. autoapisummary::

   asp_plot.stereo_geometry.StereoGeometryPlotter


Module Contents
---------------

.. py:class:: StereoGeometryPlotter(directory, add_basemap=True, **kwargs)

   Bases: :py:obj:`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.

   .. attribute:: directory

      Path to directory containing XML files

      :type: str

   .. attribute:: add_basemap

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

      :type: bool

   .. attribute:: image_list

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

      :type: list

   .. rubric:: Examples

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


   .. py:method:: 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)

      :param save_dir: Directory to save the figure, default is None (figure not saved)
      :type save_dir: str, optional
      :param fig_fn: Filename for the figure, default is None (figure not saved)
      :type fig_fn: str, optional

      :returns: The created figure object (not shown automatically)
      :rtype: matplotlib.figure.Figure

      .. rubric:: 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.



   .. py:method:: 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.

      :param p: Stereo pair dictionary containing scene metadata
      :type p: dict
      :param key: Key for the scene dictionary within the pair dictionary,
                  default is "catid1_dict"
      :type key: str, optional

      :returns: Formatted string with scene metadata
      :rtype: str



   .. py:method:: 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.

      :param p: Stereo pair dictionary containing metadata
      :type p: dict

      :returns: Formatted multi-line title string
      :rtype: str

      .. rubric:: 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.



   .. py:method:: 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.

      :param ax: Matplotlib axes object to plot on
      :type ax: matplotlib.axes.Axes
      :param p: Stereo pair dictionary with metadata from get_pair_dict()
      :type p: dict
      :param map_crs: Coordinate reference system for the map, default is "EPSG:3857" (Web Mercator)
      :type map_crs: str, optional
      :param title: Whether to add a title to the plot, default is True
      :type title: bool, optional
      :param tight_layout: Whether to apply tight layout to the figure, default is True
      :type tight_layout: bool, optional

      :returns: Modifies the provided axes object in-place
      :rtype: None

      .. rubric:: 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:
      https://github.com/dshean/dgtools/blob/master/notebooks/dg_pair_geom_eph_analysis.ipynb



   .. py:method:: 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

      :param save_dir: Directory to save the figure, default is None (figure not saved)
      :type save_dir: str, optional
      :param fig_fn: Filename for the figure, default is None (figure not saved)
      :type fig_fn: str, optional

      :returns: The created figure object (not shown automatically)
      :rtype: matplotlib.figure.Figure



   .. py:method:: 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.

      :param ax: Polar axes object to plot the skyplot on
      :type ax: matplotlib.axes.PolarAxes
      :param p: Stereo pair dictionary with metadata from get_pair_dict()
      :type p: dict
      :param title: Whether to add a title to the plot, default is True
      :type title: bool, optional
      :param tight_layout: Whether to apply tight layout to the figure, default is True
      :type tight_layout: bool, optional

      :returns: Modifies the provided axes object in-place
      :rtype: None

      .. rubric:: 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



   .. py:attribute:: add_basemap
      :value: True



.. py:data:: logger

