Skip to content

Add analysis verification table script - #215

Open
adestefani8 wants to merge 2 commits into
mainfrom
feat/analysis-verification-table
Open

Add analysis verification table script#215
adestefani8 wants to merge 2 commits into
mainfrom
feat/analysis-verification-table

Conversation

@adestefani8

@adestefani8 adestefani8 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

This PR adds workflow/scripts/report_analysis_verification_table.py, which builds a CSV showing where a model run's analysis (lead time 0) sits between two baselines:

position = (run − INCA) / (ICON − INCA) × 100  [%]

Rows are metrics, columns are regions: 0% = same score as INCA, 100% = same score as ICON, regardless of the direction of the metric.

Purpose: track how the analysis moves away from ICON and towards INCA as the analysis is developed.

Usage

The script is not wired into the Snakemake workflow: it is run by hand, in two steps. First launch the inference and verification with the dates and setup you want in the table (truth, baselines, regions):

evalml make config/varda-single-1.0.yaml experiment_all

then build the table from the same config:

uv run workflow/scripts/report_analysis_verification_table.py \
    --config config/varda-single-1.0.yaml

How it works

The script reads the verif_aggregated_<hash>.nc files produced by the verification and goes through three steps:

  1. Locate the input files. The files are named after config hashes, so the paths are computed by reproducing the hashing of common.smk on the config. The run id is the one thing not reproducible that way, so the run file is globbed at the exact hash; --run-source disambiguates when the config has several runs.
  2. Load the three sources. Each one is reduced to a single lead time (default 0) with all init times pooled (season="all", init_hour=-999), which leaves one value per region for each metric. The script stops if the three sources do not cover the same dates.
  3. Build the table. One row per metric (ETS expands into one row per threshold), one column per region (the regions the verification was run with), printed and saved as CSV. Metrics missing from a source are skipped, with a message saying which source lacks them.

What goes into the table is controlled by the options:

  • --lower / --upper: the two anchor baselines (default INCA and ICON-CH1-CTRL); they must be baselines of the config
  • --variable: variables and metrics (default: U_10M, V_10M and T_2M, each with RMSE, R2 and ETS)
  • --lead-time-h: the lead time to read (default 0, the analysis)

Notes

  • The script is named and placed like the other report scripts (e.g. report_scorecard.py), even though currently no rule calls it. It can be left as a standalone script or wired into the pipeline at some point.
  • The hash functions are a small copy of the ones in common.smk: if they change there, they must be updated here too (if they get out of sync, the script fails with a clear error rather than reading the wrong files). Alternatively, the hashing could be dropped and the three input paths passed directly on the command line, at the price of finding the hashed paths by hand.
  • Columns are always regions. The files also contain per-season and per-init-hour results, so a --stratification option like the scorecard's could be added later.
  • TOT_PREC is not in the default variables: at lead time 0 the run and ICON have no accumulation window yet (INCA does), so there is nothing to position (it can still be requested with --variable).
  • If you run this right now, the inference may fail with KeyError: 'forecaster' in verif_obs.smk; you might have to run it with a local workaround.

Example

image

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