-
Notifications
You must be signed in to change notification settings - Fork 16
2158 add metplus ensemble stats capability #2159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1b48157
88f4298
6d9979e
38816f0
817d1cb
3eff94d
dd070ff
518804f
817085f
475c1df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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 |
|---|---|---|
| @@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||||||
|
|
||||||
| [[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" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 %} | ||||||
There was a problem hiding this comment.
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
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.