Skip to content

feat: viz layer + postprocess + attribution workflow (close gap G) - #4

Merged
VANvonZHANG merged 15 commits into
mainfrom
feat/viz-layer
Jun 27, 2026
Merged

VANvonZHANG merged 15 commits into
mainfrom
feat/viz-layer

Conversation

@VANvonZHANG

Copy link
Copy Markdown
Contributor

Summary

Implements the missing plotting layer (spec gap G) plus its post-processing and attribution-orchestration support.

New

  • pyradtran/viz/ — pure data-in→fig-out plotting (no Runner/libRadtran coupling); matplotlib lazy-imported via the plot extra:
    • rt.py: plot_spectral, plot_flux_profile, plot_budget, plot_heating_rate, plot_rt_overview
    • composite.py: plot_composite_optics, plot_block_profiles
    • attribution.py: plot_component_attribution (LEGO "killer plot")
    • _style.py: publication-grade theme + colorblind-safe palette
  • core/postprocess.py — pure dataset transforms: add_budget_vars/compute_budget (T/R/A), evaluate_composite_on_grid, evaluate_blocks_on_grid
  • workflow/attribution.py — compute_component_attribution (leave-one-out, N+1 runs)
  • examples/multicomponent_viz/run_demo.py — self-contained comprehensive demo (MieSpecies → DISORT → all plots + attribution)

Changed

  • core/output_parser.py — retain physical zout altitudes (resolve_zout_tokens: "toa"→km); HEATING_RATE_COLUMN constant
  • core/runner.py — thread resolved zout into parse_output
  • optics/mie.py — numpy 2.x compat (_trapz shim; np.trapz removed in 2.0)

Tests

29/29 viz/postprocess/workflow/public-API (synthetic data, headless, no libRadtran). Optics suite unblocked by the mie fix (52 pass; 3 pre-existing test-file np.trapz failures out of scope).

Known limitations

  • Heating-rate plot is best-effort: DISORT + heating_rate="local" emits no heating column here (open item O1).
  • Runner.execute_many swallows per-scene exceptions and fails on CompositeAerosol (ProcessPoolExecutor pickling) — flagged for a separate fix; the workflow's injected execute_many lets callers run sequentially.

- ci.yml: install .[dev,plot] so matplotlib-backed viz tests run
- test_bulk_species: importorskip('Aerosol3D') (aerosol3d absent in CI)
- aerosol.py: OpacPresetName(str, Enum) -> StrEnum (ruff UP042)
- scene.py: set_satellite passed 'source' twice -> build defaults dict
  (fixes 'SourceConfig() got multiple values for source')
- test_composite_aerosol_unit: np.trapz -> np.trapezoid (numpy 2.x)
- test_postprocess_grid: drop unused xarray import (F401)
- ruff format (12 files)
@VANvonZHANG
VANvonZHANG merged commit 5107382 into main Jun 27, 2026
2 checks passed
@VANvonZHANG
VANvonZHANG deleted the feat/viz-layer branch June 27, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant