Skip to content

Commit

Permalink
Update workflow for single recipe case aggregation by lead time.
Browse files Browse the repository at this point in the history
Fixes #1031
  • Loading branch information
daflack committed Jan 28, 2025
1 parent 951cee2 commit 247476e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 4 deletions.
11 changes: 9 additions & 2 deletions cset-workflow/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ URL = https://metoffice.github.io/CSET
{% if CSET_CYCLING_MODE != "trial" or CSET_TRIAL_END_DATE|default(False) %}
# Only runs on the final cycle.
R1/$ = """
housekeeping_raw => finish_website => send_email
housekeeping_raw => housekeeping_full
housekeeping_raw => PROCESS_CASE_AGGREGATION:{% if LOGLEVEL == "DEBUG" %}succeed-all{% else %}finish-all{% endif %} => finish_website => send_email
finish_website => housekeeping_full
"""
{% endif %}

Expand Down Expand Up @@ -92,6 +92,13 @@ URL = https://metoffice.github.io/CSET
script = rose task-run -v --app-key=run_cset_recipe
execution time limit = PT1H

[[PROCESS_CASE_AGGREGATION]]
script = rose task-run -v --app-key=run_cset_recipe
execution time limit = PT1H
[[[environment]]]
# As this process is used for case aggregation we hard code to True.
DO_CASE_AGGREGATION = True

[[FETCH_DATA]]
script = rose task-run -v --app-key=fetch_fcst
execution time limit = PT1H
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% if DOMAIN_MEAN_SURFACE_TIME_SERIES_CASE_AGGREGATION_LEAD_TIME|default(False) %}
{% for field in SURFACE_MODEL_FIELDS %}
{% for model in models %}
[runtime]
[[generic_surface_domain_mean_time_series_case_aggregation_by_lead_time_m{{model["id"]}}_{{sanitise_task_name(field)}}]]
inherit = PROCESS_CASE_AGGREGATION
[[[environment]]]
CSET_RECIPE_NAME = "generic_surface_domain_mean_time_series_case_aggregation_lead_time.yaml"
CSET_ADDOPTS = """
--VARNAME='{{field}}'
--MODEL_NAME='{{model["name"]}}'
"""
MODEL_IDENTIFIERS = {{model["id"]}}
{% endfor %}
{% endfor %}
{% endif %}
8 changes: 8 additions & 0 deletions cset-workflow/meta/diagnostics/rose-meta.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ type=python_boolean
compulsory=true
sort-key=0surface4

[template variables=DOMAIN_MEAN_SURFACE_TIME_SERIES_CASE_AGGREGATION_LEAD_TIME]
ns=Diagnostics/Quicklook
description=Create a case aggregated time series plot of surface field domain
mean by lead time.
type=python_boolean
compulsory=true
sort-key=0surface4

[template variables=DOMAIN_SURFACE_HISTOGRAM_SERIES_FIELD]
ns=Diagnostics/Quicklook
description=Create a series of histogram plots for selected surface fields for each cycle time.
Expand Down
11 changes: 9 additions & 2 deletions src/CSET/_workflow_utils/run_cset_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ def output_directory():

def data_directories() -> list[str]:
"""Get the input data directories for the cycle."""
rose_datac = os.environ["ROSE_DATAC"]
model_identifiers = sorted(os.environ["MODEL_IDENTIFIERS"].split())
return [f"{rose_datac}/data/{model_id}" for model_id in model_identifiers]
if os.getenv["DO_CASE_AGGREGATION"]:
cylc_workflow_share_dir = os.environ["CYLC_WORKFLOW_SHARE_DIR"]
return [
f"{cylc_workflow_share_dir}/data/{model_id}"
for model_id in model_identifiers
]
else:
rose_datac = os.environ["ROSE_DATAC"]
return [f"{rose_datac}/data/{model_id}" for model_id in model_identifiers]


def create_diagnostic_archive(output_directory):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
category: Time Series
title: $MODEL_NAME Domain mean surface $VARNAME time series
description: Plots a time series of the domain mean surface $VARNAME.

steps:
- operator: read.read_cubes
constraint:
operator: constraints.combine_constraints
varname_constraint:
operator: constraints.generate_var_constraint
varname: $VARNAME
cell_methods_constraint:
operator: constraints.generate_cell_methods_constraint
cell_methods: []
pressure_level_constraint:
operator: constraints.generate_level_constraint
coordinate: "pressure"
levels: []

- operator: collapse.collapse
coordinate: [grid_latitude, grid_longitude]
method: MEAN

- operator: collapse.collapse_by_lead_time
method: MEAN

# Make a single NetCDF with all the data inside it.
- operator: write.write_cube_to_nc
overwrite: True

# Plot the data.
- operator: plot.plot_line_series

0 comments on commit 247476e

Please sign in to comment.