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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[command]
default=app_env_wrapper run_metplus.py niwa/restricted_ASCII2NC_python_embedding_niwa_ens.conf

[env]
CONDA_VENV_LOCATION=${CONDA_METPLUS_VENV_LOCATION}
METPLUS_OBS_DIR=${METPLUS_OBS_DIR}
INPUT_READ_SCRIPT=restricted_read_ascii_point_niwa.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has quite a few issues

  • incorrect comments referring to ascii2nc
  • it's a config for PointStat rather than EnsembleStat
  • input templates referring to NIWA local paths
  • the variable configuration is probably going to be site specific

What's the goal of this file? It's not being used in the niwa opt and can't be used as a starting point for other sites as-is.

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}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ max_fcrs = 240

# Elements used to pattern match files
# MET output types as a comma separated list
stat_type = cnt
#stat_type = cnt --- passed as parameter from app ---
# File prefix, often the name of the MET tool, defaults to ""
stream = point_stat
# stream = point_stat --- passed as parameter from app ---
# Optional grid filter, defaults to ""
#grid = G000
# Optional date filter, defaults to ""
Expand Down
1 change: 0 additions & 1 deletion src/CSET/cset_workflow/app/verpy_metloader/rose-app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ source=${CYLC_WORKFLOW_SHARE_DIR}/${MODEL_NAME}_${STREAM}_${VER_METHOD}_tar
appdir=${CYLC_WORKFLOW_SHARE_DIR}/verpy_dbs
output_table=${STREAM}_${VER_METHOD}_table
db_prefix=${VER_METHOD}_${STAT_TYPE}
# stream=${STREAM}
27 changes: 27 additions & 0 deletions src/CSET/cset_workflow/app/verpy_plot/file/ensemble_stat_ecnt.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[VerPy_settings]
comment: general stuff
verbosity: 30

[VerPy_sources]
comment: data sources
type = ecnt
truth = Surface Obs
system = MET

[VerPy_dates]
comment: dates and times. Sourced via environment variables

[VerPy_plot_general]
comment = general plot details
stats = [33752,38057]
param = [(16, 1, -0.1), 'rh']
interp = NEAREST
compare-on-plot = 'stats'

[VerPyPlot_plot1]
comment = Lead Time plots
inherit = VerPy_settings, VerPy_sources, VerPy_dates, VerPy_plot_general
output = fcrseries
jobid = cset_lead_times
fcrs = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600]
times: [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300]
Comment on lines +26 to +27

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be more flexible for other sites if these are left unset, so that verpy fills them in from what data is available?

4 changes: 2 additions & 2 deletions src/CSET/cset_workflow/app/verpy_plot/rose-app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ default=plot_stats.py --conf=${CONF_FILE} --outdir=${OUT_DIR} --start=${START_DA

[env]
CONDA_VENV_LOCATION=${CONDA_METPLUS_VENV_LOCATION}
CONF_FILE=pointstat_cnt.rc
CONF_FILE=${STREAM}_${STAT_TYPE}.rc
OUT_DIR=${PLOT_DIR}
START=${START_DATE}
END=${END_DATE}
EXPIDS=${MODEL_NAMES}

DB_DIR=${CYLC_WORKFLOW_SHARE_DIR}/verpy_dbs
TABLENAME=${STREAM}_${VER_METHOD}_table
DB_NAME=${VER_METHOD}_${STAT_TYPE}_${STAT_TYPE}.db
DB_DIR=${CYLC_WORKFLOW_SHARE_DIR}/verpy_dbs
1 change: 1 addition & 0 deletions src/CSET/cset_workflow/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,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' %}
2 changes: 1 addition & 1 deletion src/CSET/cset_workflow/includes/metplus_common.cylc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if RUN_METPLUS_GRID_STAT|default(False) or RUN_METPLUS_POINT_STAT|default(False) %}
{% if RUN_METPLUS_GRID_STAT|default(False) or RUN_METPLUS_POINT_STAT|default(False) or RUN_METPLUS_ENSEMBLE_STAT|default(False)%}
[[METPLUS]]
[[[environment]]]
METPLUS_ANA_DIR = {{METPLUS_ANA_DIR}}
Expand Down
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_ensemble_stat_graph()}}
"""
{% endfor %}
{% elif CSET_CYCLING_MODE == "trial" %}
{{CSET_TRIAL_CYCLE_PERIOD}} = """
{{metplus_ensemble_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
[[[environment]]]
ROSE_APP_OPT_CONF_KEYS = {{SITE}}_ens
Comment on lines +34 to +60

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this duplicating sections from point_stat that would be better off in metplus_common.cylc?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not any opt files that match this - should it be made optional? with e.g.

Suggested change
ROSE_APP_OPT_CONF_KEYS = {{SITE}}_ens
ROSE_APP_OPT_CONF_KEYS = ({{SITE}}_ens)


[[METPLUS_ENSEMBLE_STAT]]
# Family grouping metplus_point_stat tasks for all models"
inherit = METPLUS
[[[environment]]]
ROSE_TASK_APP = metplus_ensemble_stat

[[METPLUS_ENSEMBLE_STAT_POSTPROC]]
# Family grouping all metplus Post-processing
inherit = METPLUS
[[[environment]]]
STAT = area
STAT_TYPE_LIST = "ecnt rhist rps pct"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example ensemble_stat config should output these stats


[[VERPY_METLOADER]]
# Family grouping for all VerPy metloader tasks
inherit = METPLUS
script = rose task-run -v --app-key=verpy_metloader
Comment on lines +75 to +78

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be in metplus_common


{% for model in models %}
[[metplus_ensemble_stat_m{{model["id"]}}]]
# Runs METplus wrappers for ensemble stat calculations.
inherit = METPLUS_ENSEMBLE_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}_ensemble_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
Comment on lines +92 to +99

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does making tar files of the output need to be done, or would it be simpler to just load the text files into the verpy database?

"""

[[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 = ecnt
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)
STAT_TYPE = ecnt
STREAM = ensemble_stat
VER_METHOD = area
MODEL_NAMES = {{ models | map(attribute='name') | join(' ') }}

{% endif %}
18 changes: 14 additions & 4 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,20 +48,19 @@ 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

###################################
# Scores
Expand Down
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 @@ -117,6 +117,7 @@ PROFILE_PLEVEL_AGGREGATION=False,False,False,False
RAIN_PRESENCE_DOMAIN_MEAN_TIMESERIES=False
RAIN_PRESENCE_SPATIAL_DIFFERENCE=False
RAIN_PRESENCE_SPATIAL_PLOT=False
RUN_METPLUS_ENSEMBLE_STAT=False
RUN_METPLUS_GRID_STAT=False
RUN_METPLUS_POINT_STAT=False
SCORES_ALL=False
Expand Down