Add analysis verification table script - #215
Open
adestefani8 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: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):
then build the table from the same config:
How it works
The script reads the
verif_aggregated_<hash>.ncfiles produced by the verification and goes through three steps:common.smkon the config. The run id is the one thing not reproducible that way, so the run file is globbed at the exact hash;--run-sourcedisambiguates when the config has several runs.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.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
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.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.--stratificationoption like the scorecard's could be added later.--variable).KeyError: 'forecaster'inverif_obs.smk; you might have to run it with a local workaround.Example