Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[dir]
OUTPUT_BASE = {ENV[CYLC_TASK_WORK_DIR]}
MET_INSTALL_DIR = {ENV[MET_INSTALL_DIR]}
TIME_START = {ENV[TIME_START]}

[config]

# Documentation for this use case can be found at
# https://metplus.readthedocs.io/en/latest/generated/met_tool_wrapper/ASCII2NC/ASCII2NC_python_embedding.html

# For additional information, please see the METplus Users Guide.
# https://metplus.readthedocs.io/en/latest/Users_Guide

###
# Processes to run
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#process-list
###

SCRUB_STAGING_DIR = False
PROCESS_LIST = PointStat
LOG_POINT_STAT_VERBOSITY = 4

###
# Time Info
# LOOP_BY options are INIT, VALID, RETRO, and REALTIME
# If set to INIT or RETRO:
# INIT_TIME_FMT, INIT_BEG, INIT_END, and INIT_INCREMENT must also be set
# If set to VALID or REALTIME:
# VALID_TIME_FMT, VALID_BEG, VALID_END, and VALID_INCREMENT must also be set
# LEAD_SEQ is the list of forecast leads to process
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#timing-control
###

LOOP_BY = INIT
INIT_TIME_FMT = %Y%m%dT%H
INIT_BEG = {TIME_START}
INIT_END = {TIME_START}
INIT_INCREMENT = 1H

#LEAD_SEQ = 0
LEAD_SEQ = begin_end_incr(0,6,1)

###
# File I/O
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#directory-and-filename-template-info
###

FCST_POINT_STAT_INPUT_DIR = /nesi/project/niwa99999/bornemannjj/CSET_TEST_DATA/model/AKL
FCST_POINT_STAT_INPUT_TEMPLATE = akl_0p333km_{TIME_START}_met.nc

OBS_POINT_STAT_INPUT_DIR = {ENV[CYLC_WORKFLOW_SHARE_DIR]}/obs_nc
OBS_POINT_STAT_INPUT_TEMPLATE = ascii2nc_python_niwa_{valid?fmt=%Y%m%d}T{valid?fmt=%2H}00.nc

POINT_STAT_OUTPUT_DIR = {ENV[CYLC_WORKFLOW_SHARE_DIR]}
POINT_STAT_OUTPUT_TEMPLATE = Point_Stat_{init?fmt=%Y%m%d}T{init?fmt=%2H}00.nc


###
# POINT_STAT Settings
#https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#pointstat
###

MODEL = ENV[MODEL_NAME]

POINT_STAT_REGRID_TO_GRID = FCST
POINT_STAT_REGRID_METHOD = NEAREST
POINT_STAT_REGRID_WIDTH = 1
POINT_STAT_REGRID_VLD_THRESH = 0.5

POINT_STAT_MASK_GRID = FULL

POINT_STAT_FCST_FILE_TYPE = NETCDF_NCCF
POINT_STAT_MESSAGE_TYPE = "ADPSFC"

FCST_POINT_STAT_VAR1_NAME = sfc_temp
FCST_POINT_STAT_VAR1_LEVELS = "({lead?fmt=%H},*,*)"
FCST_POINT_STAT_VAR1_THRESH = <=273, >273
#FCST_POINT_STAT_VAR1_OPTIONS = set_attr_name="T2M"; set_attr_level="Z0"

OBS_POINT_STAT_VAR1_NAME = TMP
OBS_POINT_STAT_VAR1_LEVELS = Z0
OBS_POINT_STAT_VAR1_THRESH = <=273, >273
#OBS_POINT_STAT_VAR1_OPTIONS = set_attr_name="T2M"

FCST_POINT_STAT_VAR2_NAME = sfc_rh
FCST_POINT_STAT_VAR2_LEVELS = "({lead?fmt=%H},*,*)"
FCST_POINT_STAT_VAR2_THRESH = <60, >95
#FCST_POINT_STAT_VAR2_OPTIONS = set_attr_name="RH"; set_attr_level="Z0"

OBS_POINT_STAT_VAR2_NAME = RH
OBS_POINT_STAT_VAR2_LEVELS = Z0
OBS_POINT_STAT_VAR2_THRESH = <60, >95

OBS_POINT_STAT_WINDOW_BEGIN = -1800
OBS_POINT_STAT_WINDOW_END = 1800

POINT_STAT_OUTPUT_FLAG_CNT = BOTH
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[command]
default=app_env_wrapper run_metplus.py niwa/restricted_EnsembleStat_cycling_niwa.conf niwa/restricted_EnsembleStat_science_niwa.conf

[env]
CONDA_VENV_LOCATION = ${CONDA_METPLUS_VENV_LOCATION}
METPLUS_FCST_DIR = ${METPLUS_FCST_DIR}/${model_name}
START_TIME=${TASK_START_TIME}
FORECAST_LENTGH = ${FORECAST_LENGTH}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[command]
default=app_env_wrapper run_metplus.py EnsembleStat.conf

[env]
CONDA_VENV_LOCATION=${CONDA_METPLUS_VENV_LOCATION}
METPLUS_FCST_DIR=${METPLUS_FCST_DIR}
1 change: 1 addition & 0 deletions src/CSET/cset_workflow/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ final cycle point = {{CSET_TRIAL_END_DATE}}
{% include 'includes/metplus_common.cylc' %}
{% include 'includes/metplus_point_stat.cylc' %}
{% include 'includes/metplus_grid_stat.cylc' %}
{% include 'includes/metplus_ensemble_stat.cylc' %}

# Site-specific details that add to or override the core workflow definition.
{% include 'site/' ~ SITE ~ '.cylc' %}
127 changes: 127 additions & 0 deletions src/CSET/cset_workflow/includes/metplus_ensemble_stat.cylc
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@

{% if RUN_METPLUS_ENSEMBLE_STAT|default(False) %}
[scheduling]
[[graph]]
{% macro metplus_ensemble_stat_graph() %}
metplus_prep_obs => metplus_ascii2nc
{% for model in models %}
fetch_fcst_m{{model["id"]}} => metplus_prep_fcst_m{{model["id"]}}
metplus_prep_fcst_m{{model["id"]}} => metplus_ensemble_stat_m{{model["id"]}}
metplus_ascii2nc => metplus_ensemble_stat_m{{model["id"]}}
metplus_ensemble_stat_m{{model["id"]}} => metplus_ensemble_stat_postproc_m{{model["id"]}}
{% endfor %}
METPLUS_ENSEMBLE_STAT_POSTPROC:succeed-all => cycle_complete
{% endmacro %}

{% if CSET_CYCLING_MODE == "case_study" %}
{% for date in CSET_CASE_DATES %}
R1/{{date}} = """
{{metplus_point_stat_graph()}}
"""
{% endfor %}
{% elif CSET_CYCLING_MODE == "trial" %}
{{CSET_TRIAL_CYCLE_PERIOD}} = """
{{metplus_point_stat_graph()}}
"""
{% endif %}
R1/$ = """
{% for model in models %}
cycle_complete => verpy_metloader_ensemblestat_m{{model["id"]}}
{% endfor %}
VERPY_METLOADER:succeed-all => verpy_plot_ensemblestat => finish_website
"""

[runtime]
[[metplus_prep_obs]]
inherit = METPLUS

{% for model in models %}
[[metplus_prep_fcst_m{{model["id"]}}]]
# Prepares model data for use by metplus
inherit = METPLUS
[[[environment]]]
ROSE_TASK_APP = metplus_prep_fcst
MODEL_NAME = {{model["name"]}}
MODEL_ID = m{{model["id"]}}
INPUT_PATHS = $CYLC_TASK_SHARE_CYCLE_DIR/data/{{model["id"]}}
{% if SELECT_SUBAREA %}
SUBAREA_TYPE = {{SUBAREA_TYPE}}
SUBAREA_EXTENT = {{SUBAREA_EXTENT}}
{% else %}
SUBAREA_TYPE = None
SUBAREA_EXTENT = None
{% endif %}
{% endfor %}

[[metplus_ascii2nc]]
# Runs METplus wrappers for ASCII to nc ingestion of obs.
inherit = METPLUS

[[METPLUS_ENSEMBLE_STAT]]
# Family grouping metplus_point_stat tasks for all models"
inherit = METPLUS
[[[environment]]]
ROSE_TASK_APP = metplus_ensemble_stat
STAT = area??
STAT_TYPE_LIST = cnt??

[[METPLUS_ENSEMBLE_STAT_POSTPROC]]
# Family grouping all metplus Post-processing
inherit = METPLUS
[[[environment]]]
STAT = area??
STAT_TYPE_LIST = cnt??

[[VERPY_METLOADER]]
# Family grouping for all VerPy metloader tasks
inherit = METPLUS
script = rose task-run -v --app-key=verpy_metloader

{% for model in models %}
[[metplus_ensemble_stat_m{{model["id"]}}]]
# Runs METplus wrappers for ensemble stat calculations.
inherit = METPLUS_POINT_STAT
[[[environment]]]
MODEL_NAME = {{model["name"]}}
model_name = {{model["name"] | lower}}

[[metplus_ensemble_stat_postproc_m{{model["id"]}}]]
# Archives point stat results in tar files ready for verpy loading.
inherit = METPLUS_ENSEMBLE_STAT_POSTPROC
script = """
MODEL_NAME={{model["name"]}}
ENSEMBLE_STAT_DIR=${CYLC_TASK_SHARE_CYCLE_DIR}/Ensemble_Stat_${MODEL_NAME}
mkdir -p ${CYLC_WORKFLOW_SHARE_DIR}/${MODEL_NAME}_point_stat_${STAT}_tar
for STAT_TYPE in ${STAT_TYPE_LIST}; do
gzip ${ENSEMBLE_STAT_DIR}/*_${STAT_TYPE}.txt
files_list=$(ls ${ENSEMBLE_STAT_DIR}/*_${STAT_TYPE}.txt.gz | xargs -n 1 basename)
tar -rf ${CYLC_WORKFLOW_SHARE_DIR}/${MODEL_NAME}_ensemble_stat_${STAT}_tar/ensemble_stat_${CYLC_TASK_CYCLE_POINT}_${STAT_TYPE}.tar -C ${ENSEMBLE_STAT_DIR} $files_list
done
"""

[[verpy_metloader_ensemblestat_m{{model["id"]}}]]
# Runs VerPy metloader utility to create the VerPy databases
inherit = VERPY_METLOADER
[[[environment]]]
VERPY_DIR = {{VERPY_DIR}}
VER_METHOD = area??
STAT_TYPE = cnt??
STREAM = ensemble_stat
MODEL_NAME = {{model["name"]}}
METLOADER_CONF_FILE = metloader.conf
{% endfor %}

[[verpy_plot_ensemblestat]]
# Runs VerPy plotting routines
inherit = METPLUS
script = rose task-run -v --app-key=verpy_plot
[[[environment]]]
PLOT_DIR = ${CYLC_WORKFLOW_SHARE_DIR}/web/plots
START_DATE = $(isodatetime {{ CSET_CASE_DATES|min }} --print-format %Y%m%d)
END_DATE = $(isodatetime {{ CSET_CASE_DATES|max }} --offset {{ANALYSIS_LENGTH}} --print-format %Y%m%d)
VER_METHOD = area??
STAT_TYPE = cnt??
STREAM = ensemble_stat
MODEL_NAMES = {{ models | map(attribute='name') | join(' ') }}

{% endif %}
17 changes: 14 additions & 3 deletions src/CSET/cset_workflow/meta/verification/rose-meta.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ trigger=template variables=METPLUS_OPT_CONFIG_KEYS: True;
compulsory=true
sort-key=met2

[template variables=RUN_METPLUS_ENSEMBLE_STAT]
ns=Verification
description=Run METplus ensemble stat in the workflow.
help=If True, it will enable the production of verification of ensemble statistics
against point observations(i.e. land-synop, sonde,...).
type=python_boolean
trigger=template variables=METPLUS_OPT_CONFIG_KEYS: True;
template variables=METPLUS_ANA_DIR: True;
compulsory=true
sort-key=met3

[template variables=METPLUS_OPT_CONFIG_KEYS]
ns=Verification
description=Which METplus configuration to run.
Expand All @@ -37,16 +48,16 @@ help=Selects the site/model specific configuration to use. The configuration mus
https://github.com/MetOffice/CSET-restricted-files/tree/main/app/{app_name}/file
type=quoted
value-hints="metoffice", "niwa", "nci-gadi"
sort-key=met3
sort-key=met4

[template variables=METPLUS_OBS_DIR]
ns=Verification
description=Path to directory containing observations in MET ASCII format.
type=quoted
sort-key=met4
sort-key=met5

[template variables=METPLUS_ANA_DIR]
ns=Verification
description=Path to directory containing analysis in MET netcdf format.
type=quoted
sort-key=met5
sort-key=met6
1 change: 1 addition & 0 deletions src/CSET/cset_workflow/rose-suite.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ MEAN_STRUCTURAL_SIMILARITY_SURFACE_FIELD=False
!!METPLUS_BASE=""
RUN_METPLUS_GRID_STAT=False
RUN_METPLUS_POINT_STAT=False
RUN_METPLUS_ENSEMBLE_STAT=False
!!MET_INSTALL_DIR=""
!!MET_LIBRARIES=""
!!MLEVEL_TRANSECT_FINISHCOORDS=
Expand Down