Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/varda-single_paper_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ experiment:
leadtimes: [6, 24]
params: ["T_2M", "SP_10M", "TOT_PREC1", "TOT_PREC6"]

publication:
teaser:
enabled: true
init_time: "202504051200"
leadtime: 24
dark: false
grid: /store_new/mch/msopr/ml/grids/icon_grid_0001_R19B08_mch.nc

locations:
output_root: output/

Expand Down
34 changes: 34 additions & 0 deletions src/evalml/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,36 @@ class PublicationScoremapsConfig(BaseModel):
model_config = {"extra": "forbid"}


class PublicationTeaserConfig(BaseModel):
"""Case selection and styling for the publication teaser ('hero') figure."""

enabled: bool = Field(
default=False,
description="Whether to generate the publication teaser figure.",
)
init_time: str = Field(
...,
pattern=r"^\d{12}$",
description="Initialisation time (YYYYMMDDHHMM) of the case to plot.",
)
leadtime: int = Field(
default=24,
ge=0,
description="Lead time in hours for the plotted forecast frame.",
)
dark: bool = Field(
default=False,
description="Dark variant: black background, white text/ticks, glow.",
)
grid: Optional[str] = Field(
default=None,
description="ICON grid file for the true-mesh (tripcolor) zoom. "
"Falls back to a Delaunay mesh when omitted.",
)

model_config = {"extra": "forbid"}


class PublicationConfig(BaseModel):
"""Configuration for the publication workflow."""

Expand All @@ -489,6 +519,10 @@ class PublicationConfig(BaseModel):
description="Publication scoremap figure settings (omit to skip). "
"Requires a gridded (zarr) truth source.",
)
teaser: Optional[PublicationTeaserConfig] = Field(
default=None,
description="Publication teaser (hero) figure settings (omit to skip).",
)

model_config = {"extra": "forbid"}

Expand Down
7 changes: 7 additions & 0 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ rule publication_all:
"enabled", False
)
else []
)
+ (
[rules.publication_teaser.output]
if ((config.get("publication", {}) or {}).get("teaser") or {}).get(
"enabled", False
)
else []
),


Expand Down
54 changes: 54 additions & 0 deletions workflow/rules/publication.smk
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,57 @@ rule publication_scoremaps:
--manifest {input.manifest} \
--output {output} >{log} 2>&1
"""


def _pub_teaser_cfg():
return (config.get("publication", {}) or {}).get("teaser") or {}


rule publication_teaser:
"""Publication teaser (hero) figure: global forecast + nested regional zooms.

Standalone renderer (workflow/scripts/publication_teaser.py); the case and
style (incl. the dark variant) come from config.publication.teaser. Depends on
the candidate's aggregated verification file so inference has run for the
requested init_time before the GRIB is resolved.
"""
input:
"workflow/scripts/publication_teaser.py",
"workflow/scripts/publication.mplstyle",
manifest=rules.publication_manifest.output,
verif=_meteogram_data_dep,
output:
report(
directory(OUT_ROOT / f"figures/{TRUTH_SLUG}/teaser"),
htmlindex="publication_teaser.html",
),
log:
OUT_ROOT / "logs/figures/publication_teaser.log",
resources:
slurm_partition="postproc",
cpus_per_task=8,
mem_mb=32000,
runtime="60m",
params:
grib_dir=lambda wc: str(
OUT_ROOT
/ f"data/runs/{_pub_candidate_run_id()}"
/ f"{_pub_teaser_cfg().get('init_time', '')}/grib"
),
init_time=lambda wc: _pub_teaser_cfg().get("init_time", ""),
leadtime=lambda wc: _pub_teaser_cfg().get("leadtime", 24),
grid_flag=lambda wc: (
f"--grid {_pub_teaser_cfg()['grid']}"
if _pub_teaser_cfg().get("grid")
else ""
),
dark_flag=lambda wc: "--dark" if _pub_teaser_cfg().get("dark", False) else "",
shell:
"""
set -euo pipefail
export ECCODES_DEFINITION_PATH=$(realpath .venv/share/eccodes-cosmo-resources/definitions)
python workflow/scripts/publication_teaser.py \
--input {params.grib_dir:q} --date {params.init_time:q} \
--leadtime {params.leadtime} {params.grid_flag} {params.dark_flag} \
--output {output} >{log} 2>&1
"""
Loading