asp-plot 3.5.0__tar.gz → 3.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. {asp_plot-3.5.0 → asp_plot-3.6.1}/ARCHITECTURE.md +2 -0
  2. {asp_plot-3.5.0 → asp_plot-3.6.1}/CHANGELOG.md +22 -0
  3. {asp_plot-3.5.0 → asp_plot-3.6.1}/PKG-INFO +1 -1
  4. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/asp_report.py +8 -0
  5. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/icesat2_source.py +121 -4
  6. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/report_pipeline.py +31 -17
  7. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/stereo_geometry.py +6 -5
  8. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/utils.py +4 -1
  9. {asp_plot-3.5.0 → asp_plot-3.6.1}/pyproject.toml +1 -1
  10. {asp_plot-3.5.0 → asp_plot-3.6.1}/.flake8 +0 -0
  11. {asp_plot-3.5.0 → asp_plot-3.6.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  12. {asp_plot-3.5.0 → asp_plot-3.6.1}/.github/ISSUE_TEMPLATE/problem-report.yml +0 -0
  13. {asp_plot-3.5.0 → asp_plot-3.6.1}/.github/workflows/claude-code-review.yml +0 -0
  14. {asp_plot-3.5.0 → asp_plot-3.6.1}/.github/workflows/claude.yml +0 -0
  15. {asp_plot-3.5.0 → asp_plot-3.6.1}/.github/workflows/release.yml +0 -0
  16. {asp_plot-3.5.0 → asp_plot-3.6.1}/.github/workflows/run-tests.yml +0 -0
  17. {asp_plot-3.5.0 → asp_plot-3.6.1}/.gitignore +0 -0
  18. {asp_plot-3.5.0 → asp_plot-3.6.1}/.pre-commit-config.yaml +0 -0
  19. {asp_plot-3.5.0 → asp_plot-3.6.1}/.readthedocs.yaml +0 -0
  20. {asp_plot-3.5.0 → asp_plot-3.6.1}/AGENTS.md +0 -0
  21. {asp_plot-3.5.0 → asp_plot-3.6.1}/CLAUDE.md +0 -0
  22. {asp_plot-3.5.0 → asp_plot-3.6.1}/LICENSE +0 -0
  23. {asp_plot-3.5.0 → asp_plot-3.6.1}/README.md +0 -0
  24. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/__init__.py +0 -0
  25. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/alignment.py +0 -0
  26. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/altimetry.py +0 -0
  27. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/altimetry_plots.py +0 -0
  28. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/altimetry_source.py +0 -0
  29. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/asp_log.py +0 -0
  30. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/bodies.py +0 -0
  31. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/bundle_adjust.py +0 -0
  32. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/__init__.py +0 -0
  33. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/bundle_adjust_cameras.py +0 -0
  34. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/csm_camera_plot.py +0 -0
  35. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/dem_benchmark.py +0 -0
  36. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/gallery.py +0 -0
  37. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/request_planetary_altimetry.py +0 -0
  38. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/cli/stereo_geom.py +0 -0
  39. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/csm_analysis.py +0 -0
  40. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/csm_camera.py +0 -0
  41. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/csm_io.py +0 -0
  42. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/dem_benchmark.py +0 -0
  43. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/gallery.py +0 -0
  44. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/mapproject.py +0 -0
  45. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/planetary_source.py +0 -0
  46. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/processing_parameters.py +0 -0
  47. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/report.py +0 -0
  48. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/report_captions.py +0 -0
  49. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/scenes.py +0 -0
  50. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/selections.py +0 -0
  51. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/sensors/__init__.py +0 -0
  52. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/sensors/aster.py +0 -0
  53. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/sensors/base.py +0 -0
  54. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/sensors/dimap.py +0 -0
  55. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/sensors/dimap_v1.py +0 -0
  56. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/sensors/rpc.py +0 -0
  57. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/sensors/worldview.py +0 -0
  58. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/stereo.py +0 -0
  59. {asp_plot-3.5.0 → asp_plot-3.6.1}/asp_plot/stereopair_metadata_parser.py +0 -0
  60. {asp_plot-3.5.0 → asp_plot-3.6.1}/conda-forge-recipe/meta.yaml +0 -0
  61. {asp_plot-3.5.0 → asp_plot-3.6.1}/environment.yml +0 -0
@@ -160,6 +160,7 @@ The package is organized by functionality, with each module focused on a specifi
160
160
  **`icesat2_source.py`** - `Icesat2Source(AltimetrySource)` (Earth / ICESat-2)
161
161
  - Requests/processes ICESat-2 ATL06-SR via the SlideRule x-series API (`sliderule_api.run("atl03x")`) with lazy init (`_ensure_sliderule()` — connects only when ICESat-2 methods run). SlideRule logging silenced (`verbose=False`, WARNING, explicit filter on `sliderule.session`)
162
162
  - `request_atl06sr_multi_processing()` decomposed (#140) into a short request/cache/ingest loop over helpers: `_print_time_filter_summary`, `_build_level_parms`, `_load_cached_atl06sr`, `_params_match_cache`, `_request_atl06sr_level`, `_ingest_atl06sr`. Parquet cache saved to `self.alt.directory` (not CWD); the param comparison strips the `output` key (SlideRule injects a random temp path into `parms` during `run()`) and only the comparison is wrapped in `try/except` so SlideRule API errors propagate
163
+ - **Granule limit**: the server rejects an `atl03x` request matching more than 300 granules. `_request_atl06sr_level()` lists them first (`_list_granules()`, one query, which raises `max_resources` because the server applies the same limit to listings) and, above `MAX_GRANULES_PER_REQUEST` (250, a margin because the client's count can differ from the server's), `_run_granule_batches()` sends them as `resources` batches and concatenates. Batching by granule rather than by date means no point is returned twice. The parquet records the overall `parms`, so `_params_match_cache()` still recognizes a repeat. If the listing fails, the request goes as one, as before.
163
164
  - Server-side time filtering via `_resolve_time_range(...)`: default `"all"` = full mission (2018-10-14 → today UTC midnight); `"buffered"` cascades explicit `t0`/`t1` > `scene_date` ± `time_buffer_days` > XML metadata ± buffer > `"all"`. `t1` truncated to midnight UTC for stable caching
164
165
  - ESA WorldCover sampling: `sample_esa_worldcover()` / `_sample_worldcover_into_gdf()` read 10m values directly from public AWS S3 COGs (`esa-worldcover.s3.amazonaws.com/v200/2021/map/`) via `rasterio` vsicurl, batched per tile, persisted into the parquet cache (much faster than SlideRule's server-side `samples`). `_worldcover_tile_url(lat, lon)` maps a coord to the 3×3° tile URL (flat layout). Anonymous reads (unsigned AWS session) so SSO configs don't crash
165
166
  - `filter_outliers(n_sigma=3)`: drops dh beyond `n_sigma × std` from the mean (true std, not NMAD) after the 30-NMAD gross-outlier gate (`_outlier_mask`); called automatically by `atl06sr_to_dem_dh()`; pass `None` to skip. When an aligned DEM is set, `icesat_minus_aligned_dem` is blanked wherever `icesat_minus_dem` is NaN (same in `planetary_to_dem_dh()`): `pc_align`'s translation moves the DEM's holes, so a point that sampled NaN before alignment — and therefore passed the cut untested — must not enter the aligned residuals when it lands on data afterwards
@@ -247,6 +248,7 @@ All CLI tools are in `asp_plot/cli/` and use Click for argument parsing:
247
248
  - `--no-altimetry`: Skip the altimetry comparisons plotted by default. Auto-detects planetary body from DEM CRS: Earth → ICESat-2 (requires internet), Moon → LOLA, Mars → MOLA. For planetary DEMs, requires `--altimetry-csv`.
248
249
  - `--altimetry-csv`: Path to a LOLA/MOLA CSV from the ODE GDS API. **Mars: must be the `*_pts_csv.csv` (not `*_topo_csv.csv`) — the loader requires the `PLANET_RAD` column to avoid the oblate-areoid offset.** Moon accepts either the `*_topo_simple_csv.csv` (results=u) or the `*_pts_csv.csv` (results=p). Obtained via the `request_planetary_altimetry` CLI tool.
249
250
  - `--no-pc-align`: Skips the `pc_align` step; by default (when altimetry is on) the report runs `pc_align` against the reference altimetry (ICESat-2 for Earth, MOLA for Mars, LOLA for Moon) after the existing altimetry plots and appends an alignment report. **Earth success path**: adds four pages (alignment report page, pre/post landcover histogram, aligned profile, aligned best/worst segments). **Planetary success path**: adds three pages (alignment report page, pre/post mapview, pre/post histogram). `insufficient_points` and `no_improvement` outcomes emit a single alignment report page on either branch. Skipped automatically when `--no-altimetry` is set.
251
+ - `--pc-align-min-points`: Fewest altimetry points on the DEM for the `pc_align` step to run (`ReportConfig.pc_align_min_points`); `None`, the default, keeps the alignment methods' own minimums (500 ICESat-2 points, 20 LOLA/MOLA points). Below the minimum the alignment page says the step was skipped.
250
252
  - `--no-geometry`: Skip the stereo geometry plots drawn by default (used for planetary missions)
251
253
  - `--subset-km`: Hillshade subset size in km (default: 1.0)
252
254
  - `--atl06sr-time-range`: Time range for ICESat-2 ATL06-SR requests. `"all"` (default) for full mission, `"auto"` for scene metadata ±1 year, `"START,END"` for a custom range, or a single date (buffered by ±1 year).
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.6.1] - 2026-11-06
11
+
12
+ In this release:
13
+
14
+ - A large footprint over the full ICESat-2 mission no longer fails at SlideRule's limit of 300 granules per request.
15
+ - A SlideRule request that returns nothing raises a clear error instead of `AttributeError`.
16
+ - A failed basemap logs a warning and keeps the figure, and is no longer reported as missing bundle adjustment files.
17
+
18
+ ### Fixed
19
+ - **A SlideRule request that returns nothing now raises a clear error.** The client returns `None` when it cannot open its output file, and asp_plot passed that on, so the caller got `AttributeError: 'NoneType' object has no attribute 'columns'`. The new `RuntimeError` names the region and time range and lists the likely causes: no ICESat-2 granules, more than the 300 granules the server allows per request, or a temporary failure. A request that ran and found no points for one processing level still continues, now with a warning.
20
+ - **ICESat-2 requests over SlideRule's granule limit now work.** The server rejects an `atl03x` request that matches more than 300 granules, which a large footprint over the full mission can reach: `asp_report --atl06sr-time-range all`, the default, failed for these footprints, and ICESat-2 keeps adding granules. asp_plot now lists the granules first and, above 250, sends them in batches and combines the results. Other requests are unchanged, apart from the one extra query to list the granules.
21
+ - **A failed basemap no longer disappears silently or looks like missing bundle adjustment files.** `StereoGeometryPlotter` dropped a basemap that failed without saying so, and now logs a warning with the exception. `Plotter.plot_geodataframe` had no guard, so a basemap error stopped the plot; it now logs the same warning and keeps the figure, without a basemap. The report's bundle adjustment section printed "No bundle adjustment files found" for any `ValueError`, including ones from plotting, and dropped the residual and geodiff pages. That message now comes only from the file lookup, and a plotting error is reported as one.
22
+
23
+ ## [3.6.0] - 2026-10-30
24
+
25
+ In this release:
26
+
27
+ - `asp_report --pc-align-min-points` sets how many altimetry points the `pc_align` step needs before it runs, so small DEMs that ICESat-2 crosses only a few times can still be aligned.
28
+
29
+ ### Added
30
+ - **`asp_report --pc-align-min-points N` sets how many altimetry points the `pc_align` step needs before it runs** (`ReportConfig.pc_align_min_points`). The step skipped itself below a fixed 500 ICESat-2 points (20 for LOLA/MOLA), so a report on a DEM of about 1 km², which ICESat-2 crosses only a few times, compared against the points but never aligned to them. The default is unchanged.
31
+
10
32
  ## [3.5.0] - 2026-10-23
11
33
 
12
34
  In this release:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: asp_plot
3
- Version: 3.5.0
3
+ Version: 3.6.1
4
4
  Summary: Package for plotting outputs Ames Stereo Pipeline processing
5
5
  Project-URL: Homepage, https://github.com/uw-cryo/asp_plot
6
6
  Project-URL: Documentation, https://asp-plot.readthedocs.io
@@ -92,6 +92,12 @@ def _reconstruct_command():
92
92
  default=False,
93
93
  help="Skip the pc_align step (run by default against the reference altimetry -- ICESat-2 for Earth, MOLA for Mars, LOLA for Moon -- appending the alignment-report pages; skipped automatically with --no-altimetry).",
94
94
  )
95
+ @click.option(
96
+ "--pc-align-min-points",
97
+ type=int,
98
+ default=None,
99
+ help="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.",
100
+ )
95
101
  @click.option(
96
102
  "--no-geometry",
97
103
  is_flag=True,
@@ -155,6 +161,7 @@ def main(
155
161
  no_altimetry,
156
162
  altimetry_csv,
157
163
  no_pc_align,
164
+ pc_align_min_points,
158
165
  no_geometry,
159
166
  subset_km,
160
167
  atl06sr_time_range,
@@ -183,6 +190,7 @@ def main(
183
190
  plot_altimetry=not no_altimetry,
184
191
  altimetry_csv=altimetry_csv,
185
192
  pc_align=not no_pc_align,
193
+ pc_align_min_points=pc_align_min_points,
186
194
  plot_geometry=not no_geometry,
187
195
  subset_km=subset_km,
188
196
  atl06sr_time_range=atl06sr_time_range,
@@ -20,6 +20,7 @@ from datetime import datetime, timedelta, timezone
20
20
  import geopandas as gpd
21
21
  import numpy as np
22
22
  import pandas as pd
23
+ from sliderule import earthdata as sliderule_earthdata
23
24
  from sliderule import sliderule as sliderule_api
24
25
 
25
26
  from asp_plot.altimetry_source import AltimetrySource
@@ -29,6 +30,14 @@ from asp_plot.utils import nmad as _nmad
29
30
 
30
31
  logger = logging.getLogger(__name__)
31
32
 
33
+ # SlideRule's atl03x endpoint rejects a request whose search matches more than
34
+ # 300 granules. The client's own CMR search can differ from the server's by a
35
+ # few granules, so requests are split well below that.
36
+ MAX_GRANULES_PER_REQUEST = 250
37
+ # Listing granules goes through the same server, which applies that 300 limit
38
+ # to the listing too unless the query asks for more.
39
+ MAX_GRANULES_LISTED = 10000
40
+
32
41
  #: ESA WorldCover class codes (see ``WORLDCOVER_NAMES``) grouped under the
33
42
  #: names :meth:`Icesat2Source.filter_esa_worldcover` accepts.
34
43
  WORLDCOVER_GROUPS = {
@@ -480,16 +489,124 @@ class Icesat2Source(AltimetrySource):
480
489
  def _request_atl06sr_level(self, parms, fn, save_to_parquet):
481
490
  """Fetch one processing level from SlideRule and sample WorldCover.
482
491
 
483
- Runs the ``atl03x`` request, samples ESA WorldCover before caching so
484
- the column is persisted in the parquet (and need not be re-sampled on
485
- later runs), and optionally writes the parquet to ``fn``.
492
+ Runs the ``atl03x`` request, split into batches of granules if it would
493
+ pass the server's limit, samples ESA WorldCover before caching so the
494
+ column is persisted in the parquet (and need not be re-sampled on later
495
+ runs), and optionally writes the parquet to ``fn``. The parquet records
496
+ ``parms``, not the batches, so a repeated request is a cache hit.
497
+
498
+ Raises
499
+ ------
500
+ RuntimeError
501
+ If SlideRule returns ``None``. See :meth:`_run_atl03x`.
502
+
503
+ Notes
504
+ -----
505
+ A request that ran but found no points returns a frame with its columns
506
+ and no rows. That is a valid result for one level (no canopy points over
507
+ bare ground, say), so it only logs a warning.
486
508
  """
487
- atl06sr = sliderule_api.run("atl03x", parms)
509
+ granules = self._list_granules(parms)
510
+ if len(granules) > MAX_GRANULES_PER_REQUEST:
511
+ atl06sr = self._run_granule_batches(parms, granules)
512
+ else:
513
+ atl06sr = self._run_atl03x(parms)
514
+ if atl06sr.empty:
515
+ logger.warning(
516
+ f"SlideRule found no points for {self._describe_request(parms)}."
517
+ )
488
518
  atl06sr = self._sample_worldcover_into_gdf(atl06sr)
489
519
  if save_to_parquet:
490
520
  self._save_to_parquet(fn, atl06sr, parms)
491
521
  return atl06sr
492
522
 
523
+ @staticmethod
524
+ def _list_granules(parms):
525
+ """List the ATL03 granules a request would search, oldest name first.
526
+
527
+ Returns an empty list if the search fails, so that the request goes to
528
+ SlideRule as one request, as it would have without this check.
529
+ """
530
+ try:
531
+ sliderule_earthdata.set_max_resources(MAX_GRANULES_LISTED)
532
+ return sorted(
533
+ sliderule_earthdata.cmr(
534
+ short_name="ATL03",
535
+ polygon=parms["poly"],
536
+ time_start=parms["t0"],
537
+ time_end=parms["t1"],
538
+ )
539
+ )
540
+ except Exception as e:
541
+ logger.warning(f"Could not list ATL03 granules for the request: {e!r}")
542
+ return []
543
+
544
+ def _run_granule_batches(self, parms, granules):
545
+ """Run ``atl03x`` on ``granules`` in batches and combine the results.
546
+
547
+ Each granule is in exactly one batch, so no point is returned twice, as
548
+ it could be from splitting the time range at a date inside a granule.
549
+ """
550
+ batches = [
551
+ granules[i : i + MAX_GRANULES_PER_REQUEST]
552
+ for i in range(0, len(granules), MAX_GRANULES_PER_REQUEST)
553
+ ]
554
+ print(f"Splitting {len(granules)} granules into {len(batches)} requests")
555
+ frames = []
556
+ for number, batch in enumerate(batches, start=1):
557
+ print(f"Request {number} of {len(batches)}")
558
+ label = f"batch {number} of {len(batches)} of "
559
+ frames.append(self._run_atl03x({**parms, "resources": batch}, label))
560
+ # Frames with no rows can lose their dtypes in a concat.
561
+ with_points = [frame for frame in frames if not frame.empty]
562
+ return pd.concat(with_points) if with_points else frames[0]
563
+
564
+ def _run_atl03x(self, parms, label=""):
565
+ """Run one ``atl03x`` request, raising an error if nothing comes back.
566
+
567
+ Parameters
568
+ ----------
569
+ parms : dict
570
+ SlideRule request parameters.
571
+ label : str, optional
572
+ Prefix for the request in the error message.
573
+
574
+ Raises
575
+ ------
576
+ RuntimeError
577
+ If SlideRule returns ``None``. The client returns ``None`` whenever
578
+ it cannot open its output file and discards the reason. That
579
+ happens for a request with no ICESat-2 granules, one over the
580
+ server's granule limit, and transient server or client failures.
581
+ """
582
+ atl06sr = sliderule_api.run("atl03x", parms)
583
+ if atl06sr is None:
584
+ raise RuntimeError(
585
+ f"SlideRule returned no result for {label}"
586
+ f"{self._describe_request(parms)}. "
587
+ "The client does not report the reason, but SlideRule's log "
588
+ "messages may. Likely causes: no ICESat-2 granules in the region "
589
+ "and time range; more than the 300 granules the server allows per "
590
+ "request, which a narrower time range avoids (--atl06sr-time-range "
591
+ "in asp_report); or a temporary failure, in which case the same "
592
+ "request may succeed if repeated."
593
+ )
594
+ return atl06sr
595
+
596
+ @staticmethod
597
+ def _describe_request(parms):
598
+ """One-line summary of a SlideRule request for messages to the user."""
599
+ poly = parms["poly"]
600
+ region = poly
601
+ if all(isinstance(point, dict) for point in poly):
602
+ lons = [point["lon"] for point in poly]
603
+ lats = [point["lat"] for point in poly]
604
+ region = (
605
+ f"lon {min(lons):.4f} to {max(lons):.4f}, "
606
+ f"lat {min(lats):.4f} to {max(lats):.4f}"
607
+ )
608
+ return f"the atl03x request over {region}, from {parms['t0']} to {parms['t1']}"
609
+
493
610
  def _ingest_atl06sr(self, key, atl06sr, h_sigma_quantile=1.0):
494
611
  """
495
612
  Normalize and quality-filter a raw ATL06-SR dataframe and store it.
@@ -75,6 +75,9 @@ class ReportConfig:
75
75
  plot_altimetry: bool = True
76
76
  altimetry_csv: Optional[str] = None
77
77
  pc_align: bool = True
78
+ # Fewest altimetry points on the DEM for pc_align to run. None keeps the
79
+ # alignment methods' own defaults: 500 for ICESat-2, 20 for LOLA/MOLA.
80
+ pc_align_min_points: Optional[int] = None
78
81
  plot_geometry: bool = True
79
82
  subset_km: float = 1.0
80
83
  atl06sr_time_range: str = "all"
@@ -232,12 +235,21 @@ def _build_match_points(ctx: ReportContext) -> List[object]:
232
235
  def _build_bundle_adjust(ctx: ReportContext) -> List[object]:
233
236
  cfg = ctx.config
234
237
  sections: List[object] = []
238
+
239
+ # Only the file lookup can mean "no bundle adjustment files": a ValueError
240
+ # from plotting has to be reported as a plotting failure.
235
241
  try:
236
242
  ba_files = ReadBundleAdjustFiles(
237
243
  cfg.directory, ctx.ba_directory, stem=ctx.ba_stem
238
244
  )
239
245
  resid_initial_gdf, resid_final_gdf = ba_files.get_initial_final_residuals_gdfs()
246
+ except ValueError:
247
+ print(
248
+ f"\n\nNo bundle adjustment files found in directory {os.path.join(cfg.directory, ctx.ba_directory):}. If you want bundle adjustment plots, make sure you run the tool and supply the correct --bundle-adjust-prefix to asp_report.\n\n"
249
+ )
250
+ return sections + _build_bundle_adjust_cameras(ctx)
240
251
 
252
+ try:
241
253
  plotter = PlotBundleAdjustFiles(
242
254
  [resid_initial_gdf, resid_final_gdf],
243
255
  lognorm=True,
@@ -285,7 +297,9 @@ def _build_bundle_adjust(ctx: ReportContext) -> List[object]:
285
297
  # Map-projected residuals (requires reference DEM in bundle_adjust)
286
298
  try:
287
299
  resid_mapprojected_gdf = ba_files.get_mapproj_residuals_gdf()
288
-
300
+ except ValueError as e:
301
+ print(f"\n\nSkipping map-projected residuals plot: {e}\n\n")
302
+ else:
289
303
  plotter = PlotBundleAdjustFiles(
290
304
  [resid_mapprojected_gdf],
291
305
  title="Bundle Adjust Midpoint distance between\nfinal interest points projected onto reference DEM",
@@ -307,15 +321,17 @@ def _build_bundle_adjust(ctx: ReportContext) -> List[object]:
307
321
  caption=captions.MAP_PROJECTED_RESIDUALS,
308
322
  )
309
323
  )
310
- except ValueError as e:
311
- print(f"\n\nSkipping map-projected residuals plot: {e}\n\n")
312
324
 
313
325
  # Geodiff plots (requires reference DEM in bundle_adjust with --mapproj-dem flag)
314
326
  try:
315
327
  geodiff_initial_gdf, geodiff_final_gdf = (
316
328
  ba_files.get_initial_final_geodiff_gdfs()
317
329
  )
318
-
330
+ except ValueError as e:
331
+ print(
332
+ f"\n\nSkipping geodiff plots (requires --mapproj-dem flag in bundle_adjust): {e}\n\n"
333
+ )
334
+ else:
319
335
  plotter = PlotBundleAdjustFiles(
320
336
  [geodiff_initial_gdf, geodiff_final_gdf],
321
337
  lognorm=False,
@@ -340,15 +356,10 @@ def _build_bundle_adjust(ctx: ReportContext) -> List[object]:
340
356
  caption=captions.GEODIFF,
341
357
  )
342
358
  )
343
- except ValueError as e:
344
- print(
345
- f"\n\nSkipping geodiff plots (requires --mapproj-dem flag in bundle_adjust): {e}\n\n"
346
- )
347
359
 
348
- except ValueError:
349
- print(
350
- f"\n\nNo bundle adjustment files found in directory {os.path.join(cfg.directory, ctx.ba_directory):}. If you want bundle adjustment plots, make sure you run the tool and supply the correct --bundle-adjust-prefix to asp_report.\n\n"
351
- )
360
+ except ValueError as e:
361
+ print(f"\n\nBundle adjustment plots stopped by a plotting error: {e}\n\n")
362
+
352
363
  sections.extend(_build_bundle_adjust_cameras(ctx))
353
364
  return sections
354
365
 
@@ -628,10 +639,10 @@ def _build_altimetry_earth(ctx: ReportContext, ctx_kwargs_altimetry: dict):
628
639
 
629
640
  # ---- pc_align + ICESat-2 alignment report (Earth only) ----
630
641
  if cfg.pc_align:
631
- align_result = icesat.align_and_evaluate(
632
- processing_level="all",
633
- improvement_threshold_pct=5.0,
634
- )
642
+ align_kwargs = {"processing_level": "all", "improvement_threshold_pct": 5.0}
643
+ if cfg.pc_align_min_points is not None:
644
+ align_kwargs["minimum_points"] = cfg.pc_align_min_points
645
+ align_result = icesat.align_and_evaluate(**align_kwargs)
635
646
  stats_row = _stats_row_from_result(align_result)
636
647
 
637
648
  align_title = "DEM Alignment with ICESat-2"
@@ -777,7 +788,10 @@ def _build_altimetry_planetary(ctx: ReportContext, body: str):
777
788
 
778
789
  # ---- pc_align + planetary alignment report (Moon/Mars) ----
779
790
  if cfg.pc_align:
780
- align_result = alt.align_and_evaluate_planetary()
791
+ align_kwargs = {}
792
+ if cfg.pc_align_min_points is not None:
793
+ align_kwargs["minimum_points"] = cfg.pc_align_min_points
794
+ align_result = alt.align_and_evaluate_planetary(**align_kwargs)
781
795
  stats_row = _stats_row_from_result(align_result)
782
796
 
783
797
  align_title = f"DEM Alignment with {instrument}"
@@ -604,7 +604,8 @@ class StereoGeometryPlotter:
604
604
 
605
605
  Very large extents make contextily's auto-zoom resolve to an invalid
606
606
  (negative) zoom that errors; fall back to a coarse continental zoom so the
607
- overview still gets a basemap instead of silently dropping it.
607
+ overview still gets a basemap instead of silently dropping it. If that
608
+ fails too, the figure is drawn without a basemap and a warning says why.
608
609
  """
609
610
  import contextily as ctx
610
611
 
@@ -613,8 +614,8 @@ class StereoGeometryPlotter:
613
614
  except Exception:
614
615
  try:
615
616
  ctx.add_basemap(ax, crs=map_crs, attribution=False, zoom=6)
616
- except Exception:
617
- pass
617
+ except Exception as e:
618
+ logger.warning("Basemap skipped: %r", e)
618
619
 
619
620
  def _overview_title(self, scenes):
620
621
  """Acquisition summary title for the overview figure (no pair metrics)."""
@@ -880,8 +881,8 @@ class StereoGeometryPlotter:
880
881
  import contextily as ctx
881
882
 
882
883
  ctx.add_basemap(ax0, crs=map_crs, attribution=False)
883
- except Exception:
884
- pass
884
+ except Exception as e:
885
+ logger.warning("Basemap skipped: %r", e)
885
886
  ax0.tick_params(labelsize=7)
886
887
 
887
888
  # Row 1: Roll, pitch, yaw, either computed from quaternions or
@@ -1425,7 +1425,10 @@ class Plotter:
1425
1425
  )
1426
1426
 
1427
1427
  if ctx_kwargs:
1428
- ctx.add_basemap(ax=ax, **ctx_kwargs)
1428
+ try:
1429
+ ctx.add_basemap(ax=ax, **ctx_kwargs)
1430
+ except Exception as e:
1431
+ logger.warning("Basemap skipped: %r", e)
1429
1432
 
1430
1433
 
1431
1434
  # SATID prefixes for the DigitalGlobe -> Maxar -> Vantor satellite heritage, all
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "asp_plot"
7
- version = "3.5.0"
7
+ version = "3.6.1"
8
8
  license = {text = "BSD-3-Clause"}
9
9
  authors = [
10
10
  { name="Ben Purinton", email="purinton@uw.edu" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes