asp_plot.altimetry_plots#
Altimetry plotting layer.
All figure rendering for asp_plot.altimetry.Altimetry, split out from
the data-source code so plot methods operate on already-prepared
dataframes. The coordinating Altimetry instance computes the dh columns
(atl06sr_to_dem_dh / planetary_to_dem_dh) and resolves the best track
before calling into this module, so no plot body triggers a SlideRule
request or re-samples a DEM for differencing. Reading a DEM purely to draw a
hillshade backdrop is a rendering concern and stays here.
The plotter reads scalar context (dem_fn, aligned_dem_fn, the request
time-range label) from the coordinator passed at construction; the
dataframes themselves arrive as method arguments.
Attributes#
Classes#
Render ICESat-2 and planetary altimetry figures from prepared data. |
Module Contents#
- class asp_plot.altimetry_plots.AltimetryPlotter(alt)#
Render ICESat-2 and planetary altimetry figures from prepared data.
- Parameters:
alt (Altimetry) – The coordinating
asp_plot.altimetry.Altimetryinstance. Used only to read scalar context (dem_fn,aligned_dem_fn, and the ICESat-2 request time-range label). All dataframes are passed explicitly to each plot method.
- histogram(atl06sr, key='all', title='Histogram', plot_aligned=False, save_dir=None, fig_fn=None)#
Plot histograms of height differences between ATL06-SR data and DEMs.
Creates histograms of the height differences between ICESat-2 ATL06-SR data and DEMs, with statistics including median and normalized median absolute deviation (NMAD).
- Parameters:
atl06sr (geopandas.GeoDataFrame) – Prepared ATL06-SR points with the dh column already computed.
key (str, optional) – Processing level label, default is “all”
title (str, optional) – Plot title, default is “Histogram”
plot_aligned (bool, optional) – Whether to include differences with aligned DEM, default is False
save_dir (str or None, optional) – Directory to save figure, default is None (don’t save)
fig_fn (str or None, optional) – Filename for saved figure, default is None
Notes
NMAD is a robust measure of dispersion that is less sensitive to outliers than standard deviation, calculated as 1.4826 * median(abs(x - median(x))).
- histogram_by_landcover(atl06sr, key='all', top_n=4, title='ICESat-2 ATL06-SR vs DEM', xlim=None, plot_aligned=False, save_dir=None, fig_fn=None)#
Plot histogram of dh with per-landcover-class statistics.
Creates a histogram of the height differences between ICESat-2 ATL06-SR data and the DEM, with a text annotation showing overall and per-landcover-class statistics (count, median, NMAD).
When
plot_aligned=Trueand an aligned DEM is available, overlays the pre- and post-alignment distributions and renders two vertically stacked stats text boxes whose outline colors match the bar colors (color serves as the legend).- Parameters:
atl06sr (geopandas.GeoDataFrame) – Prepared ATL06-SR points with the dh column already computed.
key (str, optional) – Processing level label, default is “all”
top_n (int, optional) – Number of top landcover classes to report, default is 4
title (str, optional) – Plot title, default is “ICESat-2 ATL06-SR vs DEM”
xlim (tuple or None, optional) – Symmetric x-axis limits as (min, max). If None, uses ±3σ range (data is already 3σ-filtered in atl06sr_to_dem_dh).
plot_aligned (bool, optional) – Whether to overlay the aligned-DEM distribution alongside the unaligned one. Requires
self.alt.aligned_dem_fnand theicesat_minus_aligned_demcolumn. Default is False.save_dir (str or None, optional) – Directory to save figure, default is None
fig_fn (str or None, optional) – Filename for saved figure, default is None
- histogram_planetary_to_dem(planetary_points, save_dir=None, fig_fn=None, title=None, plot_aligned=False)#
Histogram of planetary altimetry vs DEM height differences.
- Parameters:
planetary_points (geopandas.GeoDataFrame) – Prepared planetary points with
altimetry_minus_dem(and, when available,altimetry_minus_aligned_dem) columns.save_dir (str or None, optional) – Directory to save figure.
fig_fn (str or None, optional) – Filename for saved figure.
title (str or None, optional) – Custom plot title. Auto-detected if None.
plot_aligned (bool, optional) – Overlay the post-alignment dh distribution on the same axes. Requires that pc_align has been run successfully.
- mapview_plot_atl06sr_to_dem(atl06sr, key='all', clim=None, plot_aligned=False, save_dir=None, fig_fn=None, map_crs=None, **ctx_kwargs)#
Plot height differences between ATL06-SR data and DEMs.
Creates a map visualization of the height differences between ICESat-2 ATL06-SR data and either the original or aligned DEM.
- Parameters:
atl06sr (geopandas.GeoDataFrame) – Prepared ATL06-SR points with the dh column already computed.
key (str, optional) – Processing level label, default is “all”
clim (tuple or None, optional) – Color limits as (min, max), default is None (auto)
plot_aligned (bool, optional) – Whether to plot differences with aligned DEM, default is False
save_dir (str or None, optional) – Directory to save figure, default is None (don’t save)
fig_fn (str or None, optional) – Filename for saved figure, default is None
map_crs (str or None, optional) – Coordinate reference system for mapping, default is None (use DEM’s CRS)
**ctx_kwargs (dict, optional) – Additional arguments for contextily basemap
Notes
The plot uses a divergent colormap (RdBu) to highlight positive and negative differences.
- mapview_plot_planetary_to_dem(planetary_points, clim=None, save_dir=None, fig_fn=None, title=None, plot_aligned=False)#
Map view of planetary altimetry vs DEM height differences.
Plots the DEM hillshade as background with altimetry dh points overlaid using a divergent colourmap. When
plot_aligned=Trueandself.alt.aligned_dem_fnis set, renders pre/post panels side by side.- Parameters:
planetary_points (geopandas.GeoDataFrame) – Prepared planetary points with
altimetry_minus_dem(and, when available,altimetry_minus_aligned_dem) columns.clim (tuple or None, optional) – Colour limits
(min, max)for dh. Default auto (symmetric ±|max| around zero).save_dir (str or None, optional) – Directory to save figure.
fig_fn (str or None, optional) – Filename for saved figure.
title (str or None, optional) – Custom plot title. Auto-detected if None.
plot_aligned (bool, optional) – Add a second panel showing dh against the aligned DEM. Requires that pc_align has been run successfully.
- plot_atl06sr(atl06sr, key='all', plot_beams=False, plot_dem=False, column_name='h_mean', cbar_label='Height above datum (m)', title='ICESat-2 ATL06-SR', clim=None, symm_clim=False, cmap='inferno', map_crs='EPSG:4326', figsize=(6, 4), save_dir=None, fig_fn=None, **ctx_kwargs)#
Plot ATL06-SR data on a map with customizable options.
Creates a map view of ATL06-SR data with options to color by various attributes, highlight different laser beams, overlay on the DEM, and add contextual basemaps.
- Parameters:
atl06sr (geopandas.GeoDataFrame) – Prepared ATL06-SR points to plot (one processing level).
key (str, optional) – Processing level label for the title, default is “all”
plot_beams (bool, optional) – Whether to color points by ICESat-2 beam, default is False
plot_dem (bool, optional) – Whether to plot the DEM as a background, default is False
column_name (str, optional) – Column to use for point coloring, default is “h_mean”
cbar_label (str, optional) – Colorbar label, default is “Height above datum (m)”
title (str, optional) – Plot title, default is “ICESat-2 ATL06-SR”
clim (tuple or None, optional) – Color limits as (min, max), default is None (auto)
symm_clim (bool, optional) – Whether to use symmetric color limits, default is False
cmap (str, optional) – Matplotlib colormap, default is “inferno”
map_crs (str, optional) – Coordinate reference system for mapping, default is “EPSG:4326”
figsize (tuple, optional) – Figure size as (width, height), default is (6, 4)
save_dir (str or None, optional) – Directory to save figure, default is None (don’t save)
fig_fn (str or None, optional) – Filename for saved figure, default is None
**ctx_kwargs (dict, optional) – Additional arguments for contextily basemap
Notes
When plot_beams is True, points are colored by ICESat-2 laser spot number, with strong beams (1, 3, 5) in darker colors and weak beams (2, 4, 6) in lighter colors.
- plot_atl06sr_dem_profile(resolved, seg_info, plot_aligned=False, save_dir=None, fig_fn=None)#
Plot elevation profile comparing ICESat-2 and DEM along the best track.
Creates a 2×2 figure with the profile stack on the left and a map view spanning the full height on the right: - Top-left: Absolute elevation profile (DEM, COP30, ICESat-2) - Bottom-left: Height difference profile (ICESat-2 minus DEM)
(shares x-axis with top-left, no vertical space between them)
Right column: DEM hillshade map with the full track and segment extents, spanning the full vertical height
- Parameters:
resolved (tuple) – The
(track, rgt, cycle, spot, track_count, track_date, dist, dh_vals)tuple fromIcesat2Source._resolve_best_track.seg_info (dict or None) – Best/worst segment extents from
Icesat2Source._find_best_worst_segments.plot_aligned (bool, optional) – Whether to also plot the aligned DEM profile, default is False
save_dir (str or None, optional) – Directory to save figure, default is None
fig_fn (str or None, optional) – Filename for saved figure, default is None
- plot_atl06sr_time_stamps(filtered, key='all', title='ICESat-2 ATL06-SR Time Stamps', cmap='inferno', map_crs='EPSG:4326', figsize=(15, 10), save_dir=None, fig_fn=None, **ctx_kwargs)#
Plot ATL06-SR data for different temporal filters.
Creates a 2x2 grid of plots showing ATL06-SR data for different temporal filters (unfiltered, 15-day, 45-day, and seasonal) colored by height.
- Parameters:
filtered (dict) – The
atl06sr_processing_levels_filteredmapping of processing-level key -> GeoDataFrame.key (str, optional) – Base processing level to plot, default is “all”
title (str, optional) – Plot title, default is “ICESat-2 ATL06-SR Time Stamps”
cmap (str, optional) – Matplotlib colormap for elevation, default is “inferno”
map_crs (str, optional) – Coordinate reference system for mapping, default is “EPSG:4326”
figsize (tuple, optional) – Figure size as (width, height), default is (15, 10)
save_dir (str or None, optional) – Directory to save figure, default is None (don’t save)
fig_fn (str or None, optional) – Filename for saved figure, default is None
**ctx_kwargs (dict, optional) – Additional arguments for contextily basemap
Notes
This method requires the filtered data to have been created using the predefined_temporal_filter_atl06sr method for the temporal variations to be available.
- plot_best_worst_segments(resolved, seg_info, plot_aligned=False, save_dir=None, fig_fn=None)#
Plot 1 km segments with better and worse agreement as a 1×2 figure.
Creates a single-row, 2-column figure: - Column 1: Better agreement segment (lowest score) - Column 2: Worse agreement segment (highest score)
Segment score is
3·|median(dh)| + NMAD(dh)(seeIcesat2Source._find_best_worst_segments). Segment selection is based on the unaligned dh so best/worst segments remain comparable across the pre- and post-alignment variants of this plot.- Parameters:
resolved (tuple) – The
(track, rgt, cycle, spot, track_count, track_date, dist, dh_vals)tuple fromIcesat2Source._resolve_best_track.seg_info (dict) – Best/worst segment extents from
Icesat2Source._find_best_worst_segments.plot_aligned (bool, optional) – Whether to overlay the aligned DEM heights and include aligned Median/NMAD in each segment title. Requires
self.alt.aligned_dem_fnand thealigned_dem_height/icesat_minus_aligned_demcolumns. Default False.save_dir (str or None, optional) – Directory to save figure, default is None
fig_fn (str or None, optional) – Filename for saved figure, default is None
- alt#
- asp_plot.altimetry_plots.WORLDCOVER_NAMES#
- asp_plot.altimetry_plots.logger#