asp_plot.report
===============

.. py:module:: asp_plot.report


Attributes
----------

.. autoapisummary::

   asp_plot.report.logger


Classes
-------

.. autoapisummary::

   asp_plot.report.ASPReportPDF
   asp_plot.report.AlignmentReportPage
   asp_plot.report.ReportMetadata
   asp_plot.report.ReportSection


Functions
---------

.. autoapisummary::

   asp_plot.report.compile_report


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

.. py:class:: ASPReportPDF(report_title='ASP Output Quality Report')

   Bases: :py:obj:`fpdf.FPDF`


   FPDF subclass with custom header and footer for ASP reports.


   .. py:method:: footer()


   .. py:method:: header()


   .. py:attribute:: report_title
      :value: 'ASP Output Quality Report'



.. py:class:: AlignmentReportPage

   A PDF page for the pc_align-vs-ICESat-2 alignment workflow.

   Each page carries (optionally) a small kwargs table, a single-row
   alignment-stats table, a description paragraph, a status/message block,
   and an optional figure with caption below. Rendered by compile_report
   alongside ReportSection entries. Body text blocks are rendered
   left-aligned (not justified) to avoid large inter-word gaps.

   .. attribute:: title

      Page heading.

      :type: str

   .. attribute:: parameters

      Alignment kwargs passed to ``Altimetry.align_and_evaluate``. Rendered
      as a small two-column table above the stats table. Use an empty dict
      to skip.

      :type: dict

   .. attribute:: stats_row

      Single-row alignment statistics (e.g. p16_beg/p50_beg/... from
      ``pc_align_report``). Rendered as a horizontal 1-row table with
      column headers. Values are formatted to two significant figures.
      Use an empty dict to skip.

      :type: dict

   .. attribute:: description

      Long-form explanation of pc_align and the meaning of each column in
      the parameters and stats tables. Rendered between the stats table
      and the status message. Empty string to skip.

      :type: str

   .. attribute:: status_message

      Short status paragraph (e.g. path to aligned DEM, or a note that
      alignment was skipped / produced no significant improvement).

      :type: str

   .. attribute:: image_path

      Optional absolute path to a PNG figure rendered below the tables.

      :type: str or None

   .. attribute:: caption

      Optional caption shown below the figure when ``image_path`` is set.

      :type: str

   .. attribute:: figure_number

      Auto-assigned by compile_report().

      :type: int


   .. py:attribute:: caption
      :type:  str
      :value: ''



   .. py:attribute:: description
      :type:  str
      :value: ''



   .. py:attribute:: figure_number
      :type:  int
      :value: 0



   .. py:attribute:: image_path
      :type:  Optional[str]
      :value: None



   .. py:attribute:: parameters
      :type:  dict


   .. py:attribute:: stats_row
      :type:  dict


   .. py:attribute:: status_message
      :type:  str
      :value: ''



   .. py:attribute:: title
      :type:  str


.. py:class:: ReportMetadata

   Metadata about the output DEM for the report title page.

   .. attribute:: dem_dimensions

      (width, height) in pixels.

      :type: tuple

   .. attribute:: dem_gsd_m

      Ground sample distance in meters.

      :type: float

   .. attribute:: dem_crs

      Coordinate reference system string (e.g. "EPSG:32616").

      :type: str

   .. attribute:: dem_nodata_percent

      Percentage of nodata pixels.

      :type: float

   .. attribute:: dem_elevation_range

      (min, max) elevation in meters.

      :type: tuple

   .. attribute:: dem_filename

      DEM filename.

      :type: str

   .. attribute:: reference_dem

      Reference DEM path or description.

      :type: str

   .. attribute:: acquisition_dates

      Scene acquisition date strings (e.g. "2017-07-31 19:07:28 UTC") when
      recoverable from scene metadata. Empty list if not found.

      :type: list of str


   .. py:attribute:: acquisition_dates
      :type:  list
      :value: []



   .. py:attribute:: dem_crs
      :type:  str
      :value: ''



   .. py:attribute:: dem_dimensions
      :type:  tuple
      :value: (0, 0)



   .. py:attribute:: dem_elevation_range
      :type:  tuple
      :value: (0, 0)



   .. py:attribute:: dem_filename
      :type:  str
      :value: ''



   .. py:attribute:: dem_gsd_m
      :type:  float
      :value: 0.0



   .. py:attribute:: dem_nodata_percent
      :type:  float
      :value: 0.0



   .. py:attribute:: reference_dem
      :type:  str
      :value: ''



.. py:class:: ReportSection

   A section of the PDF report containing a figure with title and caption.

   .. attribute:: title

      Section heading displayed above the figure.

      :type: str

   .. attribute:: image_path

      Absolute path to the PNG image file.

      :type: str

   .. attribute:: caption

      Caption text displayed below the figure.

      :type: str

   .. attribute:: figure_number

      Auto-assigned by compile_report().

      :type: int


   .. py:attribute:: caption
      :type:  str
      :value: ''



   .. py:attribute:: figure_number
      :type:  int
      :value: 0



   .. py:attribute:: image_path
      :type:  str


   .. py:attribute:: title
      :type:  str


.. py:function:: compile_report(sections, processing_parameters_dict, report_pdf_path, report_title='ASP Output Quality Report', report_metadata=None, report_command=None)

   Compile a PDF report with ASP processing results and plots.

   Creates a structured PDF report with a title page, figure sections
   with captions, and a processing parameters appendix.

   :param sections: Ordered list of report sections, each containing a title,
                    image path, and optional caption.
   :type sections: list of ReportSection
   :param processing_parameters_dict: Dictionary containing processing parameters from ASP logs.
   :type processing_parameters_dict: dict
   :param report_pdf_path: Output path for the PDF report.
   :type report_pdf_path: str
   :param report_title: Title for the report. Default is "ASP Output Quality Report".
   :type report_title: str, optional
   :param report_metadata: DEM metadata for the title page summary table. Default is None.
   :type report_metadata: ReportMetadata, optional
   :param report_command: The asp_plot CLI command used to generate this report. Default is None.
   :type report_command: str, optional

   :returns: Generates a PDF report at the specified path.
   :rtype: None

   .. rubric:: Notes

   Required keys in processing_parameters_dict:
   - processing_timestamp: When the processing was performed
   - reference_dem: Path to reference DEM used
   - bundle_adjust: Bundle adjustment command
   - bundle_adjust_run_time: Time to run bundle adjustment
   - stereo: Stereo command
   - stereo_run_time: Time to run stereo
   - point2dem: Point2dem command
   - point2dem_run_time: Time to run point2dem


.. py:data:: logger

