Skip to content

Commit 8490d9a

Browse files
committed
Major changes to METplus: user-specifiable MASK regions, OMP_NUM_THREADS=4 for parallelized code, general cleanup
- Always verify on FULL grid - Allow users to specify MASK_GRID regions in the config file, using the names of the grid as specified in the METplus users guide (or using custom .poly files in parm/metplus/) - Some general conf file cleanup - Allow user to specify input file for poly plotting script - Fix GOES task names in setup.py - New GOES obs in smoke test, test for smoke vx at 12z init; not sure if I'll keep these changes but using them for now
1 parent c21e876 commit 8490d9a

18 files changed

+192
-28
lines changed

parm/metplus/EnsembleStat.conf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,7 @@ OBS_{{METPLUS_TOOL_NAME}}_WINDOW_END = {OBS_WINDOW_END}
203203
{{comment_or_null}}{{METPLUS_TOOL_NAME}}_CLIMO_CDF_BINS = 1
204204
{{comment_or_null}}{{METPLUS_TOOL_NAME}}_CLIMO_CDF_CENTER_BINS = False
205205
{{METPLUS_TOOL_NAME}}_CLIMO_CDF_WRITE_BINS = False
206-
{% if input_field_group in ['APCP', 'ASNOW'] %}
207-
{{METPLUS_TOOL_NAME}}_MASK_GRID =
208-
{%- elif input_field_group in ['REFC', 'RETOP'] %}
209206
{{METPLUS_TOOL_NAME}}_MASK_GRID = FULL
210-
{%- elif input_field_group in ['SFC', 'UPA'] %}
211-
{{METPLUS_TOOL_NAME}}_MASK_GRID =
212-
{%- endif %}
213207

214208
{{METPLUS_TOOL_NAME}}_CI_ALPHA = 0.05
215209

@@ -730,6 +724,6 @@ FCST_{{METPLUS_TOOL_NAME}}_INPUT_TEMPLATE = {{fcst_input_fn_template}}
730724
{{METPLUS_TOOL_NAME}}_CLIMO_STDEV_INPUT_TEMPLATE =
731725
#
732726
# Variable used to specify one or more verification mask files for
733-
# {{MetplusToolName}}. Not used for this example.
727+
# {{MetplusToolName}}.
734728
#
735-
{{METPLUS_TOOL_NAME}}_VERIFICATION_MASK_TEMPLATE = {MET_INSTALL_DIR}/share/met/poly/CONUS.poly
729+
{{METPLUS_TOOL_NAME}}_VERIFICATION_MASK_TEMPLATE = {{vx_mask}}

parm/metplus/GridStat_ensmean.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ FCST_{{METPLUS_TOOL_NAME}}_PROB_THRESH = ==0.1
549549
#{{METPLUS_TOOL_NAME}}_CLIMO_CDF_CENTER_BINS = False
550550
#{{METPLUS_TOOL_NAME}}_CLIMO_CDF_WRITE_BINS = True
551551

552-
{{METPLUS_TOOL_NAME}}_MASK_GRID =
552+
{{METPLUS_TOOL_NAME}}_MASK_GRID = {{vx_mask}}
553553

554554
# Statistical output types
555555
{{METPLUS_TOOL_NAME}}_OUTPUT_FLAG_FHO = STAT

parm/metplus/GridStat_ensprob.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ FCST_{{METPLUS_TOOL_NAME}}_PROB_THRESH = {{thresh_fcst_prob}}
533533
#{{METPLUS_TOOL_NAME}}_CLIMO_CDF_CENTER_BINS = False
534534
#{{METPLUS_TOOL_NAME}}_CLIMO_CDF_WRITE_BINS = True
535535

536-
{{METPLUS_TOOL_NAME}}_MASK_GRID =
536+
{{METPLUS_TOOL_NAME}}_MASK_GRID = FULL
537537

538538
# Statistical output types
539539
{{METPLUS_TOOL_NAME}}_OUTPUT_FLAG_FHO = NONE
@@ -643,4 +643,4 @@ FCST_{{METPLUS_TOOL_NAME}}_INPUT_TEMPLATE = {{fcst_input_fn_template}}
643643
# Variable used to specify one or more verification mask files for
644644
# {{MetplusToolName}}. Not used for this example.
645645
#
646-
{{METPLUS_TOOL_NAME}}_VERIFICATION_MASK_TEMPLATE = {MET_INSTALL_DIR}/share/met/poly/CONUS.poly
646+
{{METPLUS_TOOL_NAME}}_VERIFICATION_MASK_TEMPLATE = {{vx_mask}}

parm/metplus/GridStat_or_PointStat.conf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -849,14 +849,8 @@ FCST_{{METPLUS_TOOL_NAME}}_INPUT_TEMPLATE = {{fcst_input_fn_template}}
849849
# {{METPLUS_TOOL_NAME}}_CLIMO_STDEV_INPUT_DIR. Not used in this example.
850850
#
851851
{{METPLUS_TOOL_NAME}}_CLIMO_STDEV_INPUT_TEMPLATE =
852-
{#-
853-
Not sure if the following section for ..._VERIFICATION_MASK_TEMPLATE
854-
is also nececcary for PointStat.
855-
#}
856-
{%- if (METPLUS_TOOL_NAME == 'GRID_STAT') %}
857852
#
858853
# Variable used to specify one or more verification mask files for
859-
# {{MetplusToolName}}. Not used for this example.
854+
# {{MetplusToolName}}.
860855
#
861-
{{METPLUS_TOOL_NAME}}_VERIFICATION_MASK_TEMPLATE = {MET_INSTALL_DIR}/share/met/poly/CONUS.poly, /scratch1/BMC/hmtb/harrold/ufs-srweather-app/parm/metplus/EAST_ROCKIES.poly
862-
{%- endif %}
856+
{{METPLUS_TOOL_NAME}}_VERIFICATION_MASK_TEMPLATE = {{vx_mask}}

parm/metplus/plot_latlon_points.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ def plot_points_on_map(lats, lons, output_file='map.png', threshold=80):
6969
parser = argparse.ArgumentParser(
7070
description="Plots METplus polyfiles on a map")
7171

72-
# parser.add_argument('-i', '--input_file', default='latlon.txt',
73-
# help='Name of METplus polyfile')
72+
parser.add_argument('-i', '--input_file', default='latlon.txt',
73+
help='Name of METplus polyfile')
7474
# parser.add_argument('-o', '--output_file', default='map.png',
7575
# help='Name of output file')
7676
parser.add_argument('-t', '--threshold', default=80, help='Threshold +/- latitude; if there are plot points closer to the pole than this latitude, a polar projection will be used')
7777
parser.add_argument('-d', '--debug', action='store_true',
7878
help='Script will be run in debug mode with more verbose output')
7979
pargs = parser.parse_args()
8080

81-
for polyfile in list(glob.glob("/contrib/spack-stack/spack-stack-1.6.0/envs/fms-2024.01/install/intel/2021.5.0/met-12.0.1-iw45pz7/share/met/poly/*poly")):
81+
for polyfile in list(glob.glob(pargs.input_file)):
8282

8383
output_file = Path(polyfile).stem
8484
lats, lons = read_latlon_file(polyfile)

parm/wflow/verify_ens.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ metatask_GenEnsProd_EnsembleStat_APCP_all_accums:
3636
OBTYPE: 'CCPA'
3737
FCST_LEVEL: 'A#ACCUM_HH#'
3838
FCST_THRESH: 'all'
39+
OMP_NUM_THREADS: 4
3940
dependency:
4041
metataskdep_pcpcombine_fcst:
4142
attrs:
@@ -70,6 +71,7 @@ metatask_GenEnsProd_EnsembleStat_ASNOW_all_accums:
7071
OBTYPE: 'NOHRSC'
7172
FCST_LEVEL: 'A#ACCUM_HH#'
7273
FCST_THRESH: 'all'
74+
OMP_NUM_THREADS: 4
7375
dependency:
7476
and:
7577
metataskdep_pcpcombine_fcst:
@@ -105,6 +107,7 @@ metatask_GenEnsProd_EnsembleStat_REFC_RETOP:
105107
OBTYPE: 'MRMS'
106108
FCST_LEVEL: 'L0'
107109
FCST_THRESH: 'all'
110+
OMP_NUM_THREADS: 4
108111
dependency:
109112
and:
110113
metataskdep_check_post_output: &check_post_output
@@ -157,6 +160,7 @@ metatask_GenEnsProd_EnsembleStat_SFC_UPA:
157160
ACCUM_HH: '01'
158161
FCST_LEVEL: 'all'
159162
FCST_THRESH: 'all'
163+
OMP_NUM_THREADS: 4
160164
walltime: 04:45:00
161165
dependency:
162166
metataskdep_check_post_output:
@@ -211,6 +215,7 @@ metatask_GridStat_APCP_all_accums_ensmeanprob:
211215
ACCUM_HH: '#ACCUM_HH#'
212216
FCST_LEVEL: 'A#ACCUM_HH#'
213217
FCST_THRESH: 'all'
218+
OMP_NUM_THREADS: 4
214219
dependency:
215220
and:
216221
taskdep_pcpcombine_obs_ccpa:
@@ -238,6 +243,7 @@ metatask_GridStat_ASNOW_all_accums_ensmeanprob:
238243
ACCUM_HH: '#ACCUM_HH#'
239244
FCST_LEVEL: 'A#ACCUM_HH#'
240245
FCST_THRESH: 'all'
246+
OMP_NUM_THREADS: 4
241247
dependency:
242248
and:
243249
taskdep_pcpcombine_obs_nohrsc:
@@ -261,6 +267,7 @@ metatask_GridStat_REFC_RETOP_ensprob:
261267
OBTYPE: 'MRMS'
262268
FCST_LEVEL: 'L0'
263269
FCST_THRESH: 'all'
270+
OMP_NUM_THREADS: 4
264271
dependency:
265272
and:
266273
datadep_all_get_obs_mrms_complete:

scripts/exregional_run_met_genensprod_or_ensemblestat.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,24 @@ fi
307307
#
308308
#-----------------------------------------------------------------------
309309
#
310+
# Populate VX_MASK_FILE_LIST based on user selections
311+
#
312+
#-----------------------------------------------------------------------
313+
#
314+
# This weird logic is needed because in older versions of bash empty arrays are treated as unset
315+
if [ ${VX_MASK[@]} ]; then
316+
VX_MASK_FILE_LIST=""
317+
for i in "${VX_MASK[@]}"; do
318+
if [ -f "${PARMdir}/${VX_MASK[i]}.poly" ]; then
319+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, ${PARMdir}/${VX_MASK[i]}.poly"
320+
else
321+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, {MET_INSTALL_DIR}/share/met/poly/${VX_MASK[i]}.poly"
322+
fi
323+
done
324+
fi
325+
#
326+
#-----------------------------------------------------------------------
327+
#
310328
# Set the names of the template METplus configuration file, the METplus
311329
# configuration file generated from this template, and the METplus log
312330
# file.
@@ -401,6 +419,11 @@ settings="\
401419
'input_level_fcst': '${FCST_LEVEL:-}'
402420
'input_thresh_fcst': '${FCST_THRESH:-}'
403421
#
422+
# Verification mask settings
423+
#
424+
'vx_mask': '${VX_MASK_FILE_LIST:-}'
425+
#
426+
#
404427
# Verification configuration dictionary.
405428
#
406429
'vx_config_dict':

scripts/exregional_run_met_gridstat_or_pointstat_vx.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ sections=(
2323
for sect in ${sections[*]} ; do
2424
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
2525
done
26+
echo ${BASH_VERSION}
2627
#
2728
#-----------------------------------------------------------------------
2829
#
@@ -324,6 +325,24 @@ fi
324325
#
325326
#-----------------------------------------------------------------------
326327
#
328+
# Populate VX_MASK_FILE_LIST based on user selections
329+
#
330+
#-----------------------------------------------------------------------
331+
#
332+
# This weird logic is needed because in older versions of bash empty arrays are treated as unset
333+
if [ ${VX_MASK[@]} ]; then
334+
VX_MASK_FILE_LIST=""
335+
for i in "${VX_MASK[@]}"; do
336+
if [ -f "${PARMdir}/${VX_MASK[i]}.poly" ]; then
337+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, ${PARMdir}/${VX_MASK[i]}.poly"
338+
else
339+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, {MET_INSTALL_DIR}/share/met/poly/${VX_MASK[i]}.poly"
340+
fi
341+
done
342+
fi
343+
#
344+
#-----------------------------------------------------------------------
345+
#
327346
# Set the names of the template METplus configuration file, the METplus
328347
# configuration file generated from this template, and the METplus log
329348
# file.
@@ -418,6 +437,11 @@ settings="\
418437
'input_level_fcst': '${FCST_LEVEL:-}'
419438
'input_thresh_fcst': '${FCST_THRESH:-}'
420439
#
440+
# Verification mask settings
441+
#
442+
'vx_mask': '${VX_MASK_FILE_LIST:-}'
443+
#
444+
#
421445
# Verification configuration dictionary.
422446
#
423447
'vx_config_dict':
@@ -459,7 +483,6 @@ fi
459483
#
460484
#-----------------------------------------------------------------------
461485
#
462-
463486
print_info_msg "$VERBOSE" "
464487
Calling METplus to run MET's ${metplus_tool_name} tool for field(s): ${FIELDNAME_IN_MET_FILEDIR_NAMES}"
465488
${METPLUS_PATH}/ush/run_metplus.py \

scripts/exregional_run_met_gridstat_or_pointstat_vx_ensmean.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,24 @@ fi
250250
#
251251
#-----------------------------------------------------------------------
252252
#
253+
# Populate VX_MASK_FILE_LIST based on user selections
254+
#
255+
#-----------------------------------------------------------------------
256+
#
257+
# This weird logic is needed because in older versions of bash empty arrays are treated as unset
258+
if [ ${VX_MASK[@]} ]; then
259+
VX_MASK_FILE_LIST=""
260+
for i in "${VX_MASK[@]}"; do
261+
if [ -f "${PARMdir}/${VX_MASK[i]}.poly" ]; then
262+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, ${PARMdir}/${VX_MASK[i]}.poly"
263+
else
264+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, {MET_INSTALL_DIR}/share/met/poly/${VX_MASK[i]}.poly"
265+
fi
266+
done
267+
fi
268+
#
269+
#-----------------------------------------------------------------------
270+
#
253271
# Set the names of the template METplus configuration file, the METplus
254272
# configuration file generated from this template, and the METplus log
255273
# file.
@@ -344,6 +362,10 @@ settings="\
344362
'input_level_fcst': '${FCST_LEVEL:-}'
345363
'input_thresh_fcst': '${FCST_THRESH:-}'
346364
#
365+
# Verification mask settings
366+
#
367+
'vx_mask': '${VX_MASK_FILE_LIST:-}'
368+
#
347369
# Verification configuration dictionary.
348370
#
349371
'vx_config_dict':
@@ -379,6 +401,7 @@ fi
379401
#
380402
#-----------------------------------------------------------------------
381403
#
404+
export OMP_NUM_THREADS=4
382405
print_info_msg "$VERBOSE" "
383406
Calling METplus to run MET's ${metplus_tool_name} tool for field(s): ${FIELDNAME_IN_MET_FILEDIR_NAMES}"
384407
${METPLUS_PATH}/ush/run_metplus.py \

scripts/exregional_run_met_gridstat_or_pointstat_vx_ensprob.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,24 @@ metplus_log_fn="metplus.log.${metplus_log_bn}"
270270
#
271271
#-----------------------------------------------------------------------
272272
#
273+
# Populate VX_MASK_FILE_LIST based on user selections
274+
#
275+
#-----------------------------------------------------------------------
276+
#
277+
# This weird logic is needed because in older versions of bash empty arrays are treated as unset
278+
if [ ${VX_MASK[@]} ]; then
279+
VX_MASK_FILE_LIST=""
280+
for i in "${VX_MASK[@]}"; do
281+
if [ -f "${PARMdir}/${VX_MASK[i]}.poly" ]; then
282+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, ${PARMdir}/${VX_MASK[i]}.poly"
283+
else
284+
VX_MASK_FILE_LIST="${VX_MASK_FILE_LIST}, {MET_INSTALL_DIR}/share/met/poly/${VX_MASK[i]}.poly"
285+
fi
286+
done
287+
fi
288+
#
289+
#-----------------------------------------------------------------------
290+
#
273291
# Load the yaml-like file containing the configuration for ensemble
274292
# verification.
275293
#
@@ -344,6 +362,11 @@ settings="\
344362
'input_level_fcst': '${FCST_LEVEL:-}'
345363
'input_thresh_fcst': '${FCST_THRESH:-}'
346364
#
365+
# Verification mask settings
366+
#
367+
'vx_mask': '${VX_MASK_FILE_LIST:-}'
368+
#
369+
#
347370
# Verification configuration dictionary.
348371
#
349372
'vx_config_dict':
@@ -379,6 +402,7 @@ fi
379402
#
380403
#-----------------------------------------------------------------------
381404
#
405+
export OMP_NUM_THREADS=4
382406
print_info_msg "$VERBOSE" "
383407
Calling METplus to run MET's ${metplus_tool_name} tool for field(s): ${FIELDNAME_IN_MET_FILEDIR_NAMES}"
384408
${METPLUS_PATH}/ush/run_metplus.py \

0 commit comments

Comments
 (0)