Skip to content

Commit

Permalink
Added fcst_file_type to two wrappers (#1437)
Browse files Browse the repository at this point in the history
Co-authored-by: Hank Fisher <[email protected]>
Co-authored-by: George McCabe <[email protected]>
  • Loading branch information
3 people authored Feb 15, 2022
1 parent 58c0de8 commit caa65c8
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 5 deletions.
20 changes: 20 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,16 @@ METplus Configuration Glossary

| *Used by:* PointStat
POINT_STAT_FCST_FILE_TYPE
Specify the value for 'fcst.file_type' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_OBS_FILE_TYPE
Specify the value for 'obs.file_type' in the MET configuration file for PointStat.

| *Used by:* PointStat
FCST_POINT_STAT_INPUT_DATATYPE
Specify the data type of the input directory for forecast files used with the MET point_stat tool. Currently valid options are NETCDF, GRIB, and GEMPAK. If set to GEMPAK, data will automatically be converted to NetCDF via GempakToCF. A corresponding variable exists for observation data called :term:`OBS_POINT_STAT_INPUT_DATATYPE`.

Expand Down Expand Up @@ -2464,6 +2474,16 @@ METplus Configuration Glossary

| *Used by:* MODE
MODE_FCST_FILE_TYPE
Specify the value for 'fcst.file_type' in the MET configuration file for MODE.

| *Used by:* MODE
MODE_OBS_FILE_TYPE
Specify the value for 'obs.file_type' in the MET configuration file for MODE.

| *Used by:* MODE
MODE_MERGE_CONFIG_FILE
Path to mode merge config file.

Expand Down
55 changes: 52 additions & 3 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4055,10 +4055,12 @@ METplus Configuration
| :term:`FCST_MODE_VAR<n>_LEVELS` (optional)
| :term:`FCST_MODE_VAR<n>_THRESH` (optional)
| :term:`FCST_MODE_VAR<n>_OPTIONS` (optional)
| :term:`MODE_FCST_FILE_TYPE` (optional)
| :term:`OBS_MODE_VAR<n>_NAME` (optional)
| :term:`OBS_MODE_VAR<n>_LEVELS` (optional)
| :term:`OBS_MODE_VAR<n>_THRESH` (optional)
| :term:`OBS_MODE_VAR<n>_OPTIONS` (optional)
| :term:`MODE_OBS_FILE_TYPE` (optional)
|
.. warning:: **DEPRECATED:**
Expand Down Expand Up @@ -4224,6 +4226,18 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`MODE_FCST_MERGE_FLAG`
- fcst.merge_flag

**${METPLUS_FCST_FILE_TYPE}**

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

* - METplus Config(s)
- MET Config File
* - :term:`MODE_FCST_FILE_TYPE`
- fcst.file_type


**${METPLUS_OBS_FIELD}**

.. list-table::
Expand Down Expand Up @@ -4287,6 +4301,17 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`OBS_MODE_MERGE_FLAG`
- obs.merge_flag

**${METPLUS_OBS_FILE_TYPE}**

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

* - METplus Config(s)
- MET Config File
* - :term:`MODE_OBS_FILE_TYPE`
- obs.file_type

**${METPLUS_MASK_POLY}**

.. list-table::
Expand Down Expand Up @@ -5289,6 +5314,8 @@ Configuration
| :term:`POINT_STAT_OFFSETS`
| :term:`FCST_POINT_STAT_INPUT_DATATYPE`
| :term:`OBS_POINT_STAT_INPUT_DATATYPE`
| :term:`POINT_STAT_FCST_FILE_TYPE`
| :term:`POINT_STAT_OBS_FILE_TYPE`
| :term:`POINT_STAT_CONFIG_FILE`
| :term:`MODEL`
| :term:`POINT_STAT_REGRID_TO_GRID`
Expand Down Expand Up @@ -5490,6 +5517,17 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.

.. note:: For more information on controlling the forecast field attributes in METplus, please see the :ref:`Field_Info` section of the User's Guide.

**${METPLUS_FCST_FILE_TYPE}**

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

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_FCST_FILE_TYPE`
- fcst.file_type

**${METPLUS_OBS_FIELD}**

.. list-table::
Expand All @@ -5499,16 +5537,27 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - METplus Config(s)
- MET Config File
* - :term:`OBS_VAR<n>_NAME`
- fcst.field.name
- obs.field.name
* - :term:`OBS_VAR<n>_LEVELS`
- fcst.field.level
- obs.field.level
* - :term:`OBS_VAR<n>_THRESH`
- fcst.field.cat_thresh
- obs.field.cat_thresh
* - :term:`OBS_VAR<n>_OPTIONS`
- n/a

.. note:: For more information on controlling the observation field attributes in METplus, please see the :ref:`Field_Info` section of the User's Guide.

**${METPLUS_OBS_FILE_TYPE}**

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

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_OBS_FILE_TYPE`
- obs.file_type

**${METPLUS_MESSAGE_TYPE}**

.. list-table::
Expand Down
4 changes: 4 additions & 0 deletions internal_tests/pytests/mode/test_mode_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ def set_minimum_config_settings(config):
{'METPLUS_PS_PLOT_FLAG': 'ps_plot_flag = TRUE;'}),
({'MODE_CT_STATS_FLAG': 'True', },
{'METPLUS_CT_STATS_FLAG': 'ct_stats_flag = TRUE;'}),
({'MODE_FCST_FILE_TYPE': 'NETCDF_PINT', },
{'METPLUS_FCST_FILE_TYPE': 'file_type = NETCDF_PINT;'}),
({'MODE_OBS_FILE_TYPE': 'NETCDF_PINT', },
{'METPLUS_OBS_FILE_TYPE': 'file_type = NETCDF_PINT;'}),
]
)
def test_mode_single_field(metplus_config, config_overrides,
Expand Down
5 changes: 4 additions & 1 deletion internal_tests/pytests/point_stat/test_point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ def test_met_dictionary_in_var_options(metplus_config):
'prob_cat_thresh = [>1, <=2];}')}),
({'POINT_STAT_MESSAGE_TYPE_GROUP_MAP': '{ key = "SURFACE"; val = "ADPSFC,SFCSHP,MSONET";},{ key = "ANYAIR"; val = "AIRCAR,AIRCFT";}', },
{'METPLUS_MESSAGE_TYPE_GROUP_MAP': 'message_type_group_map = [{ key = "SURFACE"; val = "ADPSFC,SFCSHP,MSONET";}, { key = "ANYAIR"; val = "AIRCAR,AIRCFT";}];'}),
({'POINT_STAT_FCST_FILE_TYPE': 'NETCDF_PINT', },
{'METPLUS_FCST_FILE_TYPE': 'file_type = NETCDF_PINT;'}),
({'POINT_STAT_FCST_FILE_TYPE': 'NETCDF_PINT', },
{'METPLUS_FCST_FILE_TYPE': 'file_type = NETCDF_PINT;'}),
]
)
def test_point_stat_all_fields(metplus_config, config_overrides,
Expand Down
22 changes: 22 additions & 0 deletions metplus/wrappers/mode_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class MODEWrapper(CompareGriddedWrapper):
'METPLUS_INTEREST_FUNCTION_CONVEX_HULL_DIST',
'METPLUS_PS_PLOT_FLAG',
'METPLUS_CT_STATS_FLAG',
'METPLUS_FCST_FILE_TYPE',
'METPLUS_OBS_FILE_TYPE',
]

# handle deprecated env vars used pre v4.0.0
Expand Down Expand Up @@ -358,6 +360,23 @@ def create_c_dict(self):
self.add_met_config(name='ct_stats_flag',
data_type='bool')

self.add_met_config(name='file_type',
data_type='string',
env_var_name='FCST_FILE_TYPE',
metplus_configs=['MODE_FCST_FILE_TYPE',
'FCST_MODE_FILE_TYPE',
'MODE_FILE_TYPE'],
extra_args={'remove_quotes': True,
'uppercase': True})

self.add_met_config(name='file_type',
data_type='string',
env_var_name='OBS_FILE_TYPE',
metplus_configs=['MODE_OBS_FILE_TYPE',
'OBS_MODE_FILE_TYPE',
'MODE_FILE_TYPE'],
extra_args={'remove_quotes': True,
'uppercase': True})

c_dict['ALLOW_MULTIPLE_FILES'] = False

Expand All @@ -382,6 +401,9 @@ def create_c_dict(self):
self.get_env_var_value('METPLUS_VERIF_MASK').strip('[]')
)




return c_dict

def set_environment_variables(self, time_info):
Expand Down
20 changes: 20 additions & 0 deletions metplus/wrappers/point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class PointStatWrapper(CompareGriddedWrapper):
'METPLUS_HSS_EC_VALUE',
'METPLUS_HIRA_DICT',
'METPLUS_MESSAGE_TYPE_GROUP_MAP',
'METPLUS_FCST_FILE_TYPE',
'METPLUS_OBS_FILE_TYPE',
]

# handle deprecated env vars used pre v4.0.0
Expand Down Expand Up @@ -182,6 +184,24 @@ def create_c_dict(self):
self.add_met_config(name='message_type',
data_type='list')

self.add_met_config(name='file_type',
data_type='string',
env_var_name='FCST_FILE_TYPE',
metplus_configs=['POINT_STAT_FCST_FILE_TYPE',
'FCST_POINT_STAT_FILE_TYPE',
'POINT_STAT_FILE_TYPE'],
extra_args={'remove_quotes': True,
'uppercase': True})

self.add_met_config(name='file_type',
data_type='string',
env_var_name='OBS_FILE_TYPE',
metplus_configs=['POINT_STAT_OBS_FILE_TYPE',
'OBS_POINT_STAT_FILE_TYPE',
'POINT_STAT_FILE_TYPE'],
extra_args={'remove_quotes': True,
'uppercase': True})

self.handle_climo_cdf_dict()

c_dict['OBS_VALID_BEG'] = (
Expand Down
2 changes: 2 additions & 0 deletions parm/met_config/MODEConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fcst = {
${METPLUS_FCST_FILTER_ATTR_THRESH}
${METPLUS_FCST_MERGE_THRESH}
${METPLUS_FCST_MERGE_FLAG}
${METPLUS_FCST_FILE_TYPE}
}

obs = {
Expand All @@ -72,6 +73,7 @@ obs = {
${METPLUS_OBS_FILTER_ATTR_THRESH}
${METPLUS_OBS_MERGE_THRESH}
${METPLUS_OBS_MERGE_FLAG}
${METPLUS_OBS_FILE_TYPE}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions parm/met_config/PointStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ rank_corr_flag = FALSE;
// Forecast and observation fields to be verified
//
fcst = {
${METPLUS_FCST_FILE_TYPE}
${METPLUS_FCST_FIELD}
}

obs = {
${METPLUS_OBS_FILE_TYPE}
${METPLUS_OBS_FIELD}
}
////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 5 additions & 0 deletions parm/use_cases/met_tool_wrapper/MODE/MODE.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ OBTYPE = WRF

MODE_CONFIG_FILE = {PARM_BASE}/met_config/MODEConfig_wrapped


#MODE_FCST_FILE_TYPE =

FCST_VAR1_NAME = RH
FCST_VAR1_LEVELS = P500

Expand All @@ -49,6 +52,8 @@ FCST_MODE_MERGE_FLAG = NONE
FCST_IS_PROB = false


#MODE_OBS_FILE_TYPE =

OBS_VAR1_NAME = RH
OBS_VAR1_LEVELS = P500

Expand Down
4 changes: 3 additions & 1 deletion parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ POINT_STAT_CLIMO_MEAN_INPUT_TEMPLATE =
POINT_STAT_CLIMO_STDEV_INPUT_DIR =
POINT_STAT_CLIMO_STDEV_INPUT_TEMPLATE =


###
# Field Info
###

POINT_STAT_ONCE_PER_FIELD = False

#POINT_STAT_FCST_FILE_TYPE =
#POINT_STAT_OBS_FILE_TYPE =

FCST_VAR1_NAME = TMP
FCST_VAR1_LEVELS = P750-900
FCST_VAR1_THRESH = <=273, >273
Expand Down

0 comments on commit caa65c8

Please sign in to comment.