asp_report#
The main CLI tool generates a comprehensive PDF report of ASP processing results.
What the report contains#
Each report opens with a title page of DEM metadata and a processing-parameters page that reconstructs the ASP commands from the logs, then one figure per page in processing order: input scenes, stereo geometry, match points, bundle adjustment residuals and camera changes (when --bundle-adjust-prefix is given), disparity, DEM results (DEM, triangulation intersection error, difference to the reference DEM), a hillshade with zoomed details, and the altimetry comparison — ICESat-2 on Earth, LOLA on the Moon, MOLA on Mars — before and after the optional pc_align step. On Earth the comparison is also broken down by land cover and by terrain slope. Seven complete reports are on the Example Reports page.
The “Detailed Hillshade” page of the WorldView Atlanta multi-view report: the DEM hillshade with three subsets picked automatically from low, medium, and high triangulation-intersection-error areas, so the reader sees the best and worst of the surface without choosing where to look.#
Files needed from ASP processing#
During the stereo or parallel_stereo steps, add this flag to retain the files needed for plotting:
--keep-only '.mask .txt .exr .match -L.tif -L_sub.tif -R_sub.tif -D_sub.tif -D.tif -RD.tif -F.tif -PC.tif'
Basic usage#
At its simplest, run from the ASP processing directory:
asp_report --directory ./ \
--stereo-directory stereo
This requires only the directory where ASP processing was done (--directory) and the subdirectory containing stereo outputs (--stereo-directory). The reference DEM used in processing is automatically searched for in the logs and used for difference maps if found.
With bundle adjustment and reference DEM#
asp_report --directory ./ \
--bundle-adjust-prefix ba \
--stereo-directory stereo \
--reference-dem ref_dem.tif
--bundle-adjust-prefix accepts either the directory containing the bundle adjustment outputs (ba) or the same ASP-style output prefix you passed to stereo/mapproject (ba/run). A prefix narrows the file search to that run’s outputs when several runs share a directory.
Running without internet#
If you don’t have internet access, disable basemap and altimetry fetching:
asp_report --directory ./ \
--stereo-directory stereo \
--no-basemap \
--no-altimetry
Otherwise, basemaps are fetched using contextily and ICESat-2 data (Earth only) is fetched via SlideRule.
Planetary altimetry (Moon/Mars)#
For planetary DEMs, altimetry data must be requested separately using request_planetary_altimetry, then passed via --altimetry-csv:
# Step 1: Request data (one-time)
request_planetary_altimetry --dem stereo/output-DEM.tif --email user@example.com
# Step 2: After downloading and unzipping the result
asp_report --directory ./ \
--stereo-directory stereo \
--altimetry-csv /path/to/MolaPEDR_*_pts_csv.csv \
--no-basemap \
--no-geometry
Altimetry comparisons are on by default (skip with --no-altimetry). If the DEM is non-Earth but no --altimetry-csv is provided, the tool prints instructions and skips altimetry plots.
Automatic pc_align with the altimetry#
Unless --no-altimetry or --no-pc-align is passed, the report aligns the DEM to the altimetry with pc_align before it draws the altimetry figures (ICESat-2 on Earth, LOLA or MOLA on the Moon or Mars). The aligned DEM is only retained on disk when pc_align reduces the median absolute error (p50) toward 0 by more than 5% and the translation magnitude exceeds the minimum threshold relative to the DEM GSD; otherwise the intermediate DEM file is removed so its presence is a truthy signal that the alignment is worth using.
The alignment page opens the altimetry pages. It gives the kwargs used for pc_align, a stats table (median, NMAD and RMSE before and after, or p16/p50/p84 from logs older than ASP 3.7.0, the N/E/D shifts and the translation magnitude, in meters), a description of each column, and a status line naming the aligned DEM or saying why none was kept.
Each altimetry figure then appears once. When the alignment succeeds, every figure that can show both DEMs does, and its title ends in “(Aligned DEM)”:
The map shows the differences before and after alignment side by side, each panel on its own color scale, with its number of points, median and NMAD in its title. A DEM is often offset by meters before alignment, and one scale for both panels would wash out the differences that remain after it.
The land-cover histogram overlays the distributions before and after alignment, with a statistics box for each.
The slope page shows the NMAD before and after alignment and the median after it.
The profile overlays the aligned DEM on the track, plots the differences against the aligned DEM, and gives the median and NMAD before and after alignment in its legend.
The agreement segments overlay the aligned DEM, with the median and NMAD before and after alignment in each title. The segments are chosen on the DEM before alignment, so they are the same segments whether or not the alignment succeeds.
On the Moon and Mars, the map and histogram show the differences before and after alignment in the same way, though the map uses one color scale for both panels.
When the alignment is turned off, is skipped or keeps no DEM, every figure shows the DEM before alignment.
Disable with --no-pc-align. Automatically skipped when --no-altimetry is set. The step also skips itself, with a note on the alignment page, when fewer than 500 ICESat-2 points fall on the DEM (20 for LOLA/MOLA); --pc-align-min-points N lowers or raises that count, for example --pc-align-min-points 150 on a DEM of about 1 km² that ICESat-2 crosses only a few times.
ICESat-2 statistics by slope#
On Earth the report includes one page with the median and NMAD of the ICESat-2 minus DEM height differences by terrain slope class (0–5°, 5–10°, 10–20°, 20–30° and 30–90°). When pc_align succeeds, the page shows the NMAD before and after alignment and the median after it (an unaligned DEM is often offset by meters, which the land-cover histogram already shows). Otherwise it shows the unaligned DEM.
A five-scene WorldView-3 DEM of the UCSD site against 26 330 ICESat-2 points, before and after pc_align, with slope from the Copernicus reference DEM. After alignment the median falls from 0.65 m at 0–5° to about 0 m at 20–30°, a bias that changes with slope. NMAD rises from about 1.3 m at 0–5° to about 2.3 m at 20–30°. The 30–90° class has 35 points on 9 beam tracks, and its intervals show that neither statistic is known well there.#
Slope is taken from, in order:
the DEM given with
--slope-dem;the reference DEM (
--reference-dem, or the one found in the logs), if the file exists;the report’s own DEM.
In every case slope is taken at a scale of about 30 m, the length of one ICESat-2 segment: a DEM with finer pixels is averaged over whole-pixel blocks of up to 30 m first, in memory. The reference DEM comes first because it is independent of the DEM being validated, whose own errors raise its slope where they are large. The x-axis label names the DEM and the pixel size used.
Read the figure with these points in mind:
Error bars are 95 % intervals from a bootstrap that resamples whole beam tracks within each class. The tick labels give the number of points and beam tracks. A class with fewer than 10 points is counted but not plotted.
NMAD rises with slope for reasons other than the DEM’s height error. A horizontal offset of Δx between the DEM and the ICESat-2 points adds about Δx · tan(slope) to a difference. Its sign depends on which way the ground faces, so across a class it mostly widens the spread and moves the median less.
A median that changes with slope is a bias that one
pc_aligntranslation cannot remove, since the translation shifts every class by the same amount.Slope and land cover are often related. Steep ground may be mostly forest and flat ground mostly built-up, so compare this page with the land-cover histogram.
In Python, Altimetry.sample_slope() adds the slope_deg column and Altimetry.dh_by_slope() draws the figure and returns the per-class table.
ICESat-2 time filtering#
The --atl06sr-time-range option controls which ICESat-2 data is requested from the SlideRule API. Requesting fewer granules speeds up processing but may miss useful data.
"all" (default) requests every ICESat-2 pass over the DEM footprint from mission start (2018-10-14) to present. This is recommended for most surfaces, as the full ~7 years of data provides the largest sample for validation.
"auto" activates date-buffered filtering. It attempts to detect the scene acquisition date from the stereopair XML metadata and requests data within ±1 year of that date. If no XML metadata is found, it falls back to requesting all data.
"START,END" (e.g. "2020-01-01,2024-12-31") requests data within an explicit date range.
For areas with known temporal surface change (e.g. ice sheets, glaciers), consider using "auto" or an explicit date range to restrict the ICESat-2 data to a time window that matches the DEM acquisition. Seasonal or multi-temporal filtering is also available via the Python API (predefined_temporal_filter_atl06sr, generic_temporal_filter_atl06sr).
ICESat-2 geolocation correction (--geoloc-corr)#
--geoloc-corr conus asks SlideRule to apply its ICESat-2 geolocation correction to the ATL03 photons before the ATL06-SR fit, so the segments the DEM is compared and aligned against come out corrected. The correction is one north/east/up shift per granule and beam, looked up from a table that covers the continental US only; SlideRule labels it a draft. Photons on a beam with no entry in the table are dropped, so a corrected request returns fewer points than an uncorrected one, and none outside the continental US. It needs a SlideRule server at version 5.7.0 or later.
The setting is stored with the request in the parquet cache, so a corrected request and an uncorrected one never reuse each other’s points. In Python, pass geoloc_corr="conus" to Altimetry.request_atl06sr_multi_processing.
Comparing re-processing runs (--reuse-selections)#
When you re-process the same scene with different ASP parameters, several diagnostic figures normally change what they show between runs: a fresh ICESat-2 request returns a slightly different point set, the “best” profile track flips, the best/worst agreement segments move, and the detailed-hillshade clip boxes are re-selected from the re-processed intersection-error raster. That makes a true before/after comparison impossible.
Every asp_report run now writes a small YAML sidecar next to the report — <report_stem>_figure_selections.yml — recording each of these selections: the ICESat-2 request settings and parquet cache locations, the chosen profile track (rgt/cycle/spot), the best/worst segment extents, and the detailed-hillshade clip boxes (as DEM-CRS bounding boxes).
To make a second run reproduce the first run’s figures exactly, pass that file back in:
# Run A (e.g. mapprojected stereo) — writes report + *_figure_selections.yml
asp_report --directory my_scene/ --stereo-directory stereo_mapproj/ \
--report-filename report_mapproj.pdf
# Run B (e.g. no-mapprojection variant) — reuses A's track, segments, points, and clips
asp_report --directory my_scene/ --stereo-directory stereo_no_mapproj/ \
--reuse-selections my_scene/stereo_mapproj/report_mapproj_figure_selections.yml \
--report-filename report_no_mapproj.pdf
--reuse-selections replays the exact ICESat-2 points (from the prior run’s parquet cache), pins the same profile track and best/worst segments, and clips the same ground areas for the detailed hillshade. Selections that can’t be applied to the new run (e.g. a clip box that falls outside a re-gridded DEM, or a track absent from freshly-loaded points) fall back to automatic selection with a warning rather than failing. The sidecar is human-readable, so you can also hand-edit it to force a particular track or clip.
The sidecar file#
A *_figure_selections.yml looks like this (paths shown as placeholders; clip boxes are in the DEM’s CRS and best/worst segments are pinned by absolute along-track distance start_xatc/end_xatc so they survive a re-gridded DEM and a shifted track start):
schema_version: 1
asp_plot_version: 1.16.0
dem_filename: <stereo_dir>/run-DEM.tif
map_crs: EPSG:32610
detailed_hillshade:
subset_km: 5.0
intersection_error_percentiles: [16, 50, 84]
dem_crs: EPSG:32610
clips:
- label: low # low / medium / high intersection-error uncertainty
bbox: [569428.22, 5210008.87, 574414.69, 5214995.33]
pixel_offset: [1710, 1140]
- label: medium
bbox: [594360.56, 5175103.60, 599347.02, 5180090.07]
pixel_offset: [3705, 2565]
- label: high
bbox: [589374.09, 5205022.40, 594360.56, 5210008.87]
pixel_offset: [1995, 2280]
icesat2: # omitted for planetary (LOLA/MOLA) DEMs
request: {processing_levels: [all], res: 20, len: 40, ats: 20,
time_range: all, t0: '2018-10-14T00:00:00Z', t1: '2024-06-01T00:00:00Z'}
parquet_cache: {all: <run_dir>/atl06sr_all.parquet}
profile_track: {rgt: 829, cycle: 20, spot: 3}
segments:
best: {start_xatc: 5245997.7, end_xatc: 5246997.7, start_km: 47.84, end_km: 48.84}
worst: {start_xatc: 5219817.7, end_xatc: 5220817.7, start_km: 21.66, end_km: 22.66}
Keeping the figures (--figures-directory)#
The report’s figures are plotted to a temporary directory and deleted once the PDF is written. To show them somewhere else, such as a notebook or slides, pass --figures-directory and a copy of each one is kept there:
asp_report --directory ./ \
--stereo-directory stereo \
--figures-directory stereo/report_figures
Each file is named NN_<title>.png, where NN is the figure number in the PDF and <title> is the page heading in lowercase with other characters replaced by _: 05_dem_results.png, 06_detailed_hillshade.png, 07_icesat_2_atl06_sr_map.png. The numbers shift when a section is skipped (with --no-geometry, for instance), so pick a figure by its title: glob("*_dem_results.png"). Figures are kept at the resolution they were plotted at, before the --figure-max-dpi cap that applies inside the PDF. A relative path is taken from the current directory, not from --directory. Files of the same name are overwritten and nothing else in the directory is touched.
In a Jupyter notebook:
from pathlib import Path
from IPython.display import Image, display
for fig in sorted(Path("stereo/report_figures").glob("*_dem_results.png")):
display(Image(filename=fig, width=900))
Full options#
Usage: asp_report [OPTIONS]
Generate a comprehensive report of ASP processing results.
Creates a series of diagnostic plots for stereo processing, bundle
adjustment, ICESat-2 comparisons, and more. All plots are combined into a
single PDF report with processing parameters and summary information.
Options:
--directory TEXT Required directory of ASP processing with
scenes and sub-directories for stereo and
optionally bundle adjustment. Default:
current directory.
--bundle-adjust-prefix TEXT Optional bundle adjustment output location,
relative to --directory. Accepts either a
directory (e.g. 'ba') or an ASP-style output
prefix as passed to --bundle-adjust-prefix in
stereo/mapproject (e.g. 'ba/run'). If
expected *residuals_pointmap.csv files are
not found there, no bundle adjustment plots
will be generated. Default: None.
--stereo-directory TEXT Required directory of stereo files. Default:
stereo.
--dem-filename TEXT Optional DEM filename in the stereo
directory. Default: None, which will search
for the *-DEM.tif file in the stereo
directory. Specify it as the basename with
extension, e.g. my-custom-dem-name.tif.
--dem-gsd TEXT Optional ground sample distance of the DEM.
Default: None, which will search for the
*-DEM.tif file in the stereo directory. If
there is a GSD in the name of the file,
specify it here as a float or integer, e.g.
1, 1.5, etc.
--map-crs TEXT Projection for altimetry and bundle
adjustment plots. As EPSG:XXXX. Default:
None, which will use the projection of the
ASP DEM, and fall back on EPSG:4326 if not
found.
--reference-dem TEXT Optional reference DEM used in ASP
processing. No default. If not supplied, the
logs will be examined to find it. If not
found, no difference plots will be generated.
--slope-dem TEXT Optional DEM to take terrain slope from for
the ICESat-2 statistics by slope class. If
not supplied, the reference DEM is used, and
if there is none, the report's own DEM
averaged to 30 m. A DEM finer than 30 m is
averaged to 30 m first.
--no-basemap Skip the figure basemaps (basemaps are added
by default, which requires an internet
connection).
--no-altimetry Skip the altimetry comparisons (plotted by
default: ICESat-2 for Earth, LOLA for Moon,
MOLA for Mars; planetary DEMs require
--altimetry-csv).
--altimetry-csv PATH Path to the *_pts_csv.csv file of a LOLA/MOLA
download from the ODE GDS API. Required for
planetary altimetry plots. Obtain via:
request_planetary_altimetry --dem <dem>
--email <email>, then download and unzip the
result. For Mars the *_topo_csv.csv in the
same download is rejected: its heights are
above the MOLA areoid, not the DEM's datum.
--no-pc-align Skip the pc_align step (run by default
against the reference altimetry -- ICESat-2
for Earth, MOLA for Mars, LOLA for Moon --
which adds an alignment page and, when the
alignment succeeds, draws the altimetry
figures with the aligned DEM too; skipped
automatically with --no-altimetry).
--pc-align-min-points INTEGER Fewest altimetry points on the DEM for the
pc_align step to run; below it the alignment
page says the step was skipped. Default: 500
for ICESat-2, 20 for LOLA/MOLA.
--no-geometry Skip the stereo geometry plots (plotted by
default).
--subset-km FLOAT Size in km of the subset to plot for the
detailed hillshade. Default: 1 km.
--atl06sr-time-range TEXT Time range for ICESat-2 ATL06-SR data
requests. "all" for all available data
(mission start to present), or "START,END"
for a custom range (e.g.
"2020-01-01,2024-12-31"), or "auto" for scene
metadata +/- 1 year. Default: all.
--geoloc-corr [conus] Have SlideRule apply an ICESat-2 geolocation
correction to the photons before the ATL06-SR
fit. "conus": one north/east/up shift per
granule and beam, continental US only;
photons on beams with no correction entry are
dropped. Corrected and uncorrected points are
cached separately. Default: None, no
correction.
--reuse-selections PATH Path to a *_figure_selections.yml written by
a previous run. When supplied, replays that
run's ICESat-2 points (parquet), profile
track, best/worst segments, and detailed-
hillshade clip boxes so figures are directly
comparable across re-processing runs.
Default: None.
--report-filename TEXT PDF report filename or path. A bare filename
(e.g. 'report.pdf') is saved in the stereo
directory. A path (e.g. 'reports/report.pdf'
or '/tmp/report.pdf') is used as-is. Default:
auto-generated from directory name.
--report-title TEXT Title for the report. Default: Directory name
of ASP processing.
--figure-max-dpi INTEGER Resolution ceiling for figures embedded in
the PDF, applied at the size each figure is
placed on the page. Figures are plotted at
220 dpi and then scaled down to the page, so
wide multi-panel figures otherwise land at
400+ effective dpi and inflate the file for
detail no screen or printer shows. Pass 0 to
embed the full-resolution figures. [default:
200]
--figures-directory TEXT Directory to keep a copy of each report
figure in, as NN_<title>.png (e.g.
05_dem_results.png), where NN is the figure
number in the PDF. A relative path is taken
from the current directory, not from
--directory. Use this to show figures in a
notebook or slides without extracting them
from the PDF. Files of the same name are
overwritten. Default: None, the figures are
not kept.
--help Show this message and exit.
During the stereo or parallel_stereo steps, add this flag to retain the files needed for plotting:
--keep-only '.mask .txt .exr .match -L.tif -L_sub.tif -R_sub.tif -D_sub.tif -D.tif -RD.tif -F.tif -PC.tif'