Skip to content

Commit

Permalink
Per #2727, add support for setting point_weight_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe committed Oct 15, 2024
1 parent 12ab43e commit dd5048a
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12970,3 +12970,13 @@ METplus Configuration Glossary
using the -aggr command line argument.

| *Used by:* SeriesAnalysis
POINT_STAT_POINT_WEIGHT_FLAG
Specify the value for 'point_weight_flag' in the MET configuration file for PointStat.

| *Used by:* PointStat
ENSEMBLE_STAT_POINT_WEIGHT_FLAG
Specify the value for 'point_weight_flag' in the MET configuration file for EnsembleStat.

| *Used by:* EnsembleStat
26 changes: 26 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ METplus Configuration
| :term:`ENSEMBLE_STAT_ENS_MEMBER_IDS`
| :term:`ENSEMBLE_STAT_CONTROL_ID`
| :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG`
| :term:`ENSEMBLE_STAT_POINT_WEIGHT_FLAG`
| :term:`ENSEMBLE_STAT_PROB_CAT_THRESH`
| :term:`ENSEMBLE_STAT_PROB_PCT_THRESH`
| :term:`ENSEMBLE_STAT_ECLV_POINTS`
Expand Down Expand Up @@ -1091,6 +1092,18 @@ ${METPLUS_GRID_WEIGHT_FLAG}
* - :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG`
- grid_weight_flag

${METPLUS_POINT_WEIGHT_FLAG}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. list-table::
:widths: 5 5
:header-rows: 1

* - METplus Config(s)
- MET Config File
* - :term:`ENSEMBLE_STAT_POINT_WEIGHT_FLAG`
- point_weight_flag

${METPLUS_OUTPUT_PREFIX}
""""""""""""""""""""""""

Expand Down Expand Up @@ -7097,6 +7110,7 @@ Configuration
| :term:`POINT_STAT_UGRID_MAX_DISTANCE_KM`
| :term:`POINT_STAT_UGRID_COORDINATES_FILE`
| :term:`POINT_STAT_UGRID_CONFIG_FILE`
| :term:`POINT_STAT_POINT_WEIGHT_FLAG`
|
.. warning:: **DEPRECATED:**
Expand Down Expand Up @@ -7787,6 +7801,18 @@ ${METPLUS_OUTPUT_PREFIX}
* - :term:`POINT_STAT_OUTPUT_PREFIX`
- output_prefix

${METPLUS_POINT_WEIGHT_FLAG}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. list-table::
:widths: 5 5
:header-rows: 1

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_POINT_WEIGHT_FLAG`
- point_weight_flag

${METPLUS_MET_CONFIG_OVERRIDES}
"""""""""""""""""""""""""""""""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,9 @@ def test_ensemble_stat_field_info(metplus_config, config_overrides,
'time_interp_method = NEAREST;'
'match_month = TRUE;day_interval = 30;'
'hour_interval = 12;}')}),
({'ENSEMBLE_STAT_POINT_WEIGHT_FLAG': 'SID', },
{'METPLUS_POINT_WEIGHT_FLAG': 'point_weight_flag = SID;'}),
]
)
@pytest.mark.wrapper_c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,8 @@ def test_met_dictionary_in_var_options(metplus_config):
'time_interp_method = NEAREST;'
'match_month = TRUE;day_interval = 30;'
'hour_interval = 12;}')}),
({'POINT_STAT_POINT_WEIGHT_FLAG': 'SID', },
{'METPLUS_POINT_WEIGHT_FLAG': 'point_weight_flag = SID;'}),
]
)
@pytest.mark.wrapper_a
Expand Down
6 changes: 6 additions & 0 deletions metplus/wrappers/ensemble_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class EnsembleStatWrapper(CompareGriddedWrapper):
'METPLUS_ENS_MEMBER_IDS',
'METPLUS_CONTROL_ID',
'METPLUS_GRID_WEIGHT_FLAG',
'METPLUS_POINT_WEIGHT_FLAG',
'METPLUS_PROB_CAT_THRESH',
'METPLUS_PROB_PCT_THRESH',
'METPLUS_ECLV_POINTS',
Expand Down Expand Up @@ -354,6 +355,11 @@ def create_c_dict(self):
extra_args={'remove_quotes': True,
'uppercase': True})

self.add_met_config(name='point_weight_flag',
data_type='string',
extra_args={'remove_quotes': True,
'uppercase': True})

self.add_met_config(name='prob_pct_thresh',
data_type='list',
extra_args={'remove_quotes': True})
Expand Down
6 changes: 6 additions & 0 deletions metplus/wrappers/point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class PointStatWrapper(CompareGriddedWrapper):
'METPLUS_UGRID_DATASET',
'METPLUS_UGRID_MAX_DISTANCE_KM',
'METPLUS_UGRID_COORDINATES_FILE',
'METPLUS_POINT_WEIGHT_FLAG',
]

# deprecated env vars that are no longer supported in the wrapped MET conf
Expand Down Expand Up @@ -286,6 +287,11 @@ def create_c_dict(self):
self.add_met_config(name='ugrid_max_distance_km', data_type='int')
self.add_met_config(name='ugrid_coordinates_file', data_type='string')

self.add_met_config(name='point_weight_flag',
data_type='string',
extra_args={'remove_quotes': True,
'uppercase': True})

if not c_dict['FCST_INPUT_TEMPLATE']:
self.log_error('Must set FCST_POINT_STAT_INPUT_TEMPLATE '
'in config file')
Expand Down
2 changes: 2 additions & 0 deletions parm/met_config/EnsembleStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ rng = {

//grid_weight_flag =
${METPLUS_GRID_WEIGHT_FLAG}
//point_weight_flag =
${METPLUS_POINT_WEIGHT_FLAG}
//output_prefix =
${METPLUS_OUTPUT_PREFIX}
//version = "V9.0";
Expand Down
3 changes: 3 additions & 0 deletions parm/met_config/PointStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ ${METPLUS_UGRID_COORDINATES_FILE}

////////////////////////////////////////////////////////////////////////////////

//point_weight_flag =
${METPLUS_POINT_WEIGHT_FLAG}

tmp_dir = "${MET_TMP_DIR}";

// output_prefix =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,4 @@ ENSEMBLE_STAT_NC_ORANK_FLAG_WEIGHT = FALSE
#ENSEMBLE_STAT_CONTROL_ID =

#ENSEMBLE_STAT_GRID_WEIGHT_FLAG =
#ENSEMBLE_STAT_POINT_WEIGHT_FLAG =
2 changes: 2 additions & 0 deletions parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,5 @@ POINT_STAT_MESSAGE_TYPE = ADPUPA, ADPSFC
#POINT_STAT_UGRID_MAX_DISTANCE_KM =
#POINT_STAT_UGRID_COORDINATES_FILE =
#POINT_STAT_UGRID_CONFIG_FILE =

#POINT_STAT_POINT_WEIGHT_FLAG =

0 comments on commit dd5048a

Please sign in to comment.