Skip to content

First PR: restructure plotting folder in FastEval - #2994

Open
iluise wants to merge 2 commits into
iluise/develop/metrics-resultsfrom
iluise/develop/plotting-p1
Open

iluise wants to merge 2 commits into
iluise/develop/metrics-resultsfrom
iluise/develop/plotting-p1

Conversation

@iluise

@iluise iluise commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

New design for the plotting folder to accommodate for the parallelization:

Every plot is classified by what it is drawn from:

  • Field plots: drawn from the loaded prediction / target arrays (ReaderOutput). They are drawn where the data is loaded: by each worker under MPI, by _process_stream in a serial run. A worker draws only the samples × forecast steps of its own chunk.
  • Verification plots: drawn from the scores (MetricResults: .score, .spatial, .by_init_hour). Scores are averages over samples, so these plots are drawn once, after the per-chunk results are merged. That happens on the master under MPI, and at the end of evaluate_from_config in a serial run.

The master never needs the loaded data. The workers never need another chunk's results. This is the same split as scoring: score_orchestration computes MetricResults per chunk, and the master merges them.

plot_utils.py holds the common helpers; field_plots.py and verification_plots.py one side each, with the score maps in their own score_maps.py and the videos of both sides in animations.py; plot_orchestration.py holds what the run loop calls.

Module Content Called from
field_plots.py plot_data (orchestration of maps and histograms: config, availability, fstep filtering, colour ranges, task building, dispatch); _plot_single_sample, _plot_histograms_across_samples, _select_ensemble_data, _dispatch_timeseries_plots plot_orchestration.py
verification_plots.py plot_scores (orchestration of the score_plots entries over metric × region); the eight drivers lead_time_plot_metric_region, ratio_plot_metric_region, heat_maps_metric_region, score_card_metric_region, bar_plot_metric_region, quantile_plot_metric_region, psd_plot_metric_region, init_hour_metric_region; _flatten_or_average, _extract_psd_attrs plot_orchestration.py
score_maps.py plot_score_maps (orchestration of the score maps, including the per-(metric, region) colour ranges); _plot_score_maps_per_stream, _plot_score_map. Verification side: drawn from the merged MetricResult.spatial run_evaluation.py for now then plot_orchestration.py from one of the next PRs
animations.py the videos of both sides, built from the frames on disk: _build_single_animation, _dispatch_field_animations, _dispatch_score_map_animations field_plots.py, score_maps.py
plot_utils.py the generic helpers all
plot_orchestration.py only the two functions the run loop calls run_evaluation.py

NO CODE CHANGE. Functions are moved as they are, except for the following renames:

Today After Why
run_score_map_pipeline plot_score_maps it plots; "pipeline" says nothing
_scatter_plot_single _plot_score_map it draws only score maps; the old name reads like the per-sample map path (Plotter.create_maps_per_sample)
plot_summary + plot_init_hour_summary plot_scores one entry point for all score_plots entries; no "summary" naming
body of plot_init_hour_summary init_hour_metric_region a driver like the others
plot_metric_region lead_time_plot_metric_region every driver plots "a metric for a region"; this one is the score vs lead time
_plot_all_samples _plot_histograms_across_samples it draws only the across-sample histograms
_dispatch_animations _dispatch_field_animations symmetric with _dispatch_score_map_animations; it builds only map and histogram videos

Issue Number

Closes #2993

Is this PR a draft? Mark it as draft.

Checklist before asking for review

  • I have performed a self-review of my code
  • My changes comply with basic sanity checks:
    • I have fixed formatting issues with ./scripts/actions.sh lint
    • I have run unit tests with ./scripts/actions.sh unit-test
    • I have documented my code and I have updated the docstrings.
    • I have added unit tests, if relevant
  • I have tried my changes with data and code:
    • I have run the integration tests with ./scripts/actions.sh integration-test
    • (bigger changes) I have run a full training and I have written in the comment the run_id(s): launch-slurm.py --time 60
    • (bigger changes and experiments) I have shared a hegdedoc in the github issue with all the configurations and runs for this experiments
  • I have informed and aligned with people impacted by my change:
    • for config changes: the MatterMost channels and/or a design doc
    • for changes of dependencies: the MatterMost software development channel

FastEvaluation

  • I have updated the public documentation if necessary

@iluise

iluise commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Tested on ERA5, NPPATMS, SurfaceCombined with the following config:

global_plotting_options:
 image_format : "png" #options: "png", "pdf", "svg", "eps", "jpg" ..

evaluation:
  metrics:
    - fbi:
        thresh: 0.5
    - rmse
    - froct
    - troct
 
  regions: ["global"] 
  score_plots: [lead_time, init_hour, score_map, score_animation]
  summary_dir: "./plots_paper/"
  plot_ensemble: "members" #supported: false, "std", "minmax", "members"
  print_summary: false #print out score values on screen. it can be verbose
  
  log_scale: false
  add_grid: false
  
run_ids :
  test_multi_stream_1de37:
  streams:
      ERA5:
        channels: ["z_500", "t_850"] #,"u_850", "v_850", "q_850"] #"2t", "10u", "10v", 
        regions: ["global"] #, "nhem", "tropics"] 
        evaluation:
          forecast_step: "1-5" #"all" #[1,2,3,4,5,6,7] #"all" #[1, 2, 3] #,3, 2]
          sample: "0-4" #[0]
          ensemble: "all"
      NPPATMS:
        channels: ["obsvalue_rawbt_1", "obsvalue_rawbt_5"]
        regions: ["global"] #, "nhem", "tropics"]
        evaluation:
          forecast_step: "1-5" #"all" #[1,2,3,4,5,6,7] #"all" #[1, 2, 3] #,3, 2]
          sample: "0-2" #[0]
          ensemble: "all" 
         plotting:
           sample: [0] 
           forecast_step: [1, 2] 
           ensemble: "all"
           data_plots:
             - maps:
                 predictions: [image, video]
                 target: [image]
                 bias: [image, video]
             - histograms_per_sample        # or histograms_per_sample: [image, video]
             - timeseries
      SurfaceCombined:
        regions: ["global"] #, "nhem", "tropics"]
        evaluation:
          forecast_step: "1-5" #"all" #[1,2,3,4,5,6,7] #"all" #[1, 2, 3]
          sample: "0-2" #[0]
          ensemble: "all"
         plotting:
           sample: [0] 
           forecast_step: [1, 2] 
           ensemble: "all"
           data_plots:
             - maps:
                 predictions: [image, video]
                 target: [image]
                 bias: [image, video]
             - histograms_per_sample        # or histograms_per_sample: [image, video]
             - timeseries

@github-actions github-actions Bot added the eval anything related to the model evaluation pipeline label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eval anything related to the model evaluation pipeline

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant