Plan unified visualization and reporting layer for climate-toolkit outputs
Summary
Current toolkit mostly prints terminal tables and saves JSON/CSV, with limited plotting only in climatology. We need deliberate visualization/reporting layer spanning:
- historical climate summaries
- season analysis
- period comparisons
- NEX-GDDP ensemble comparisons
- hazards outputs
- weather-station candidate review and station-vs-grid diagnostics
This should be treated as major enhancement project, not ad hoc plot additions.
Why this matters
- terminal outputs getting too dense for users to monitor or interpret
- many modules now return rich structured outputs that are difficult to inspect quickly
- ensemble workflows need uncertainty shown visually, not only printed means
- station-vs-grid workflow needs diagnostic plots/maps to support source selection
- current plotting logic is isolated in
climate_tookit/climatology/long_term_climatology.py and not reusable across package
Current state in repo
climate_tookit/climatology/long_term_climatology.py already writes annual time-series and monthly climatology PNGs via matplotlib
- weather-station workflow now emits HTML candidate maps/tables, but layout and reporting are still narrow-purpose
- most other modules emit terminal tables + JSON/CSV only
- no shared plotting API, no shared style/config, no common report bundle convention
Research notes: recommended stack and patterns
Core stack
-
xarray + matplotlib for baseline static figures
-
Cartopy for publication-quality climate maps
- Strong choice for projected climate maps, anomaly maps, gridded fields, multi-panel map layouts.
- Better than plain scatter/leaflet for static atlas-style outputs.
- Source: Cartopy docs
https://cartopy.readthedocs.io/stable/
-
hvPlot / HoloViews / Panel for optional interactive HTML dashboards
-
Folium for lightweight standalone HTML maps
-
geemap as optional Earth Engine exploration layer, not hard dependency
- Useful for GEE-backed exploratory maps, inspectors, split maps, timeseries interaction.
- Should stay optional because package must not force GEE-bound visualization path for all users.
- Source:
https://geemap.org/
Ensemble / uncertainty best practice
Verification / station-vs-grid diagnostics
- Daily precipitation correlation alone is weak and often misleading.
- Need multi-timescale diagnostics:
- daily event skill
- monthly totals
- seasonal totals
- annual descriptive totals
- bias / MAE / RMSE / correlation
- wet-day contingency metrics
xskillscore is strong fit for standardized verification metrics if we move more calculations onto xarray-aligned structures.
- Source:
https://xskillscore.readthedocs.io/en/stable/
Design principles for toolkit visualization layer
-
Machine-readable first, plot second
- plotting should consume standardized output payloads, not terminal text
- each module should expose stable report-ready structures
-
Static first, interactive second
- first target: robust PNG/SVG/HTML exports from CLI
- second target: richer interactive dashboards where justified
-
Uncertainty-aware by default
- ensemble plots should show spread, percentiles, counts of contributing models, and missingness
-
CF/unit aware labeling
- variable labels and units should come from harmonized metadata layer
- avoid hard-coded inconsistent labels across modules
-
Separate map outputs from time-series/stat-table outputs
- site/station geography problem differs from seasonal or climatology diagnostics
-
Report bundle convention
- one run should be able to emit organized bundle, e.g.:
report.json
tables/*.csv
figures/*.png
maps/*.html
index.html
-
Optional dependency groups
- keep installable base package lean
- likely extras such as
viz, maps, dashboard
Recommended scope by module
1. climate_statistics
- annual rainfall seasonality panel
- monthly climatology bars/lines
- detected/fixed season window timeline
- seasonal summary cards/tables
- humid/perhumid guard explanation box
2. season_analysis
- rainfall + ET0 + water balance time series with detected onset/cessation markers
- season-within-window timeline
- intra-season dry-spell visualization
- multi-year onset/cessation scatter / box plots
3. compare_periods.periods
- baseline vs focal/future seasonal bars
- anomaly plots
- percent-change panels
- “review required” annotation panels when season comparability weak
4. compare_periods.ensemble_periods
- ensemble fan charts for temperature / precipitation / water balance metrics
- baseline vs future ridge/small-multiple model spreads
- season-specific uncertainty bars
- model contribution / missingness panel
5. calculate_hazards
- hazard scorecards
- threshold exceedance frequency plots
- seasonal hazard comparison panels
- later: map-ready hazard layers if/when spatial workflows mature
6. weather_station
- nearby-station candidate map with basemap, distance lines, completeness scaling
- station coverage calendar heatmaps
- station-vs-grid monthly/seasonal comparison panels
- variable-by-variable source ranking summary
- pooled multi-station diagnostics plots
Proposed implementation phases
Phase 0: output contracts and metadata
- define shared report/figure schema
- normalize variable labels/units for plot use
- identify canonical “tidy” table per module
- decide where xarray structures are worth preserving
Phase 1: shared plotting foundation
- create
climate_tookit.visualization package
- add plot config, palettes, label helpers, file naming helpers
- add shared table-to-figure utilities
- add optional dependency extras in packaging
Phase 2: static CLI exports
- add reusable PNG/SVG exports for:
- climatology
- season analysis
- compare_periods
- ensemble_periods
- weather_station compare
Phase 3: map/report outputs
- formalize HTML map generation for station candidate review
- add report bundle writer and simple
index.html
- add multi-site map and summary outputs where relevant
Phase 4: interactive dashboards
- prototype Panel/hvPlot report for:
- ensemble compare
- weather station compare
- multi-site exploration
- keep optional; do not block CLI use
Phase 5: docs and examples
- user guide for figure/report outputs
- example commands and screenshots
- notes on when to prefer static vs interactive outputs
Suggested package structure
climate_tookit/visualization/
__init__.py
config.py
labels.py
io.py
styles.py
timeseries.py
climatology.py
seasons.py
compare_periods.py
ensembles.py
hazards.py
weather_station.py
maps.py
report_bundle.py
Initial heavy-lift decisions to make before coding too much
- Should canonical plot inputs be pandas tables, xarray objects, or dual-format adapters?
- Which outputs must be supported in pure CLI batch mode?
- Which dependencies stay optional?
- Should
index.html be plain Jinja/Folium output first, with Panel later?
- How much of weather-station compare should move onto xarray/xskillscore structures first?
Concrete first tranche after this issue
- Inventory each module’s structured outputs and define canonical plot-ready tables.
- Design minimal shared visualization API and output bundle layout.
- Implement two exemplars first:
ensemble_periods uncertainty plot set
weather_station.compare diagnostics + map bundle
- Only then propagate to other modules.
References
Plan unified visualization and reporting layer for climate-toolkit outputs
Summary
Current toolkit mostly prints terminal tables and saves JSON/CSV, with limited plotting only in climatology. We need deliberate visualization/reporting layer spanning:
This should be treated as major enhancement project, not ad hoc plot additions.
Why this matters
climate_tookit/climatology/long_term_climatology.pyand not reusable across packageCurrent state in repo
climate_tookit/climatology/long_term_climatology.pyalready writes annual time-series and monthly climatology PNGs via matplotlibResearch notes: recommended stack and patterns
Core stack
xarray+matplotlibfor baseline static figureslong_name,standard_name,units) for axis labels.https://docs.xarray.dev/en/stable/user-guide/plotting.html
Cartopyfor publication-quality climate mapshttps://cartopy.readthedocs.io/stable/
hvPlot/HoloViews/Panelfor optional interactive HTML dashboardshttps://hvplot.holoviz.org/en/docs/latest/user_guide/Gridded_Data.html
https://panel.holoviz.org/
Foliumfor lightweight standalone HTML mapshttps://python-visualization.github.io/folium/latest/
geemapas optional Earth Engine exploration layer, not hard dependencyhttps://geemap.org/
Ensemble / uncertainty best practice
xclim.ensemblesalready providescreate_ensemble,ensemble_mean_std_max_min, andensemble_percentiles.https://xclim.readthedocs.io/en/stable/apidoc/xclim.ensembles.html
https://xclim.readthedocs.io/en/stable/notebooks/ensembles.html
Verification / station-vs-grid diagnostics
xskillscoreis strong fit for standardized verification metrics if we move more calculations onto xarray-aligned structures.https://xskillscore.readthedocs.io/en/stable/
Design principles for toolkit visualization layer
Machine-readable first, plot second
Static first, interactive second
Uncertainty-aware by default
CF/unit aware labeling
Separate map outputs from time-series/stat-table outputs
Report bundle convention
report.jsontables/*.csvfigures/*.pngmaps/*.htmlindex.htmlOptional dependency groups
viz,maps,dashboardRecommended scope by module
1.
climate_statistics2.
season_analysis3.
compare_periods.periods4.
compare_periods.ensemble_periods5.
calculate_hazards6.
weather_stationProposed implementation phases
Phase 0: output contracts and metadata
Phase 1: shared plotting foundation
climate_tookit.visualizationpackagePhase 2: static CLI exports
Phase 3: map/report outputs
index.htmlPhase 4: interactive dashboards
Phase 5: docs and examples
Suggested package structure
Initial heavy-lift decisions to make before coding too much
index.htmlbe plain Jinja/Folium output first, with Panel later?Concrete first tranche after this issue
ensemble_periodsuncertainty plot setweather_station.comparediagnostics + map bundleReferences