Skip to content

Commit

Permalink
per #2334, add support for setting land_mask (and topo_mask) in Point…
Browse files Browse the repository at this point in the history
…Stat wrapper
  • Loading branch information
georgemccabe committed Dec 18, 2023
1 parent 808a58b commit 4c99bd2
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 0 deletions.
75 changes: 75 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11509,3 +11509,78 @@ METplus Configuration Glossary
Specify the value for 'regrid.censor_val' in the MET configuration file for WaveletStat.

| *Used by:* WaveletStat
POINT_STAT_LAND_MASK_FLAG
Specify the value for 'land_mask.flag' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_LAND_MASK_FILE_NAME
Specify the value for 'land_mask.file_name' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_LAND_MASK_FIELD_NAME
Specify the value for 'land_mask.field.name' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_LAND_MASK_FIELD_LEVEL
Specify the value for 'land_mask.field.level' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_LAND_MASK_REGRID_METHOD
Specify the value for 'land_mask.regrid.method' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_LAND_MASK_REGRID_WIDTH
Specify the value for 'land_mask.regrid.width' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_LAND_MASK_THRESH
Specify the value for 'land_mask.thresh' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_FLAG
Specify the value for 'topo_mask.flag' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_FILE_NAME
Specify the value for 'topo_mask.file_name' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_FIELD_NAME
Specify the value for 'topo_mask.field.name' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_FIELD_LEVEL
Specify the value for 'topo_mask.field.level' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_REGRID_METHOD
Specify the value for 'topo_mask.regrid.method' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_REGRID_WIDTH
Specify the value for 'topo_mask.regrid.width' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_USE_OBS_THRESH
Specify the value for 'topo_mask.use_obs_thresh' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_TOPO_MASK_INTERP_FCST_THRESH
Specify the value for 'topo_mask.interp_fcst_thresh' in the MET configuration file for PointStat.

| *Used by:* PointStat
65 changes: 65 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6286,6 +6286,21 @@ Configuration
| :term:`POINT_STAT_CLIMO_CDF_CENTER_BINS`
| :term:`POINT_STAT_CLIMO_CDF_WRITE_BINS`
| :term:`POINT_STAT_CLIMO_CDF_DIRECT_PROB`
| :term:`POINT_STAT_LAND_MASK_FLAG`
| :term:`POINT_STAT_LAND_MASK_FILE_NAME`
| :term:`POINT_STAT_LAND_MASK_FIELD_NAME`
| :term:`POINT_STAT_LAND_MASK_FIELD_LEVEL`
| :term:`POINT_STAT_LAND_MASK_REGRID_METHOD`
| :term:`POINT_STAT_LAND_MASK_REGRID_WIDTH`
| :term:`POINT_STAT_LAND_MASK_THRESH`
| :term:`POINT_STAT_TOPO_MASK_FLAG`
| :term:`POINT_STAT_TOPO_MASK_FILE_NAME`
| :term:`POINT_STAT_TOPO_MASK_FIELD_NAME`
| :term:`POINT_STAT_TOPO_MASK_FIELD_LEVEL`
| :term:`POINT_STAT_TOPO_MASK_REGRID_METHOD`
| :term:`POINT_STAT_TOPO_MASK_REGRID_WIDTH`
| :term:`POINT_STAT_TOPO_MASK_USE_OBS_THRESH`
| :term:`POINT_STAT_TOPO_MASK_INTERP_FCST_THRESH`
| :term:`POINT_STAT_OBS_QUALITY_INC`
| :term:`POINT_STAT_OBS_QUALITY_EXC`
| :term:`POINT_STAT_OUTPUT_FLAG_FHO`
Expand Down Expand Up @@ -6679,6 +6694,56 @@ ${METPLUS_CLIMO_CDF_DICT}
* - :term:`POINT_STAT_CLIMO_CDF_DIRECT_PROB`
- climo_cdf.direct_prob

${METPLUS_LAND_MASK_DICT}
^^^^^^^^^^^^^^^^^^^^^^^^^

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

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_LAND_MASK_FLAG`
- land_mask.flag
* - :term:`POINT_STAT_LAND_MASK_FILE_NAME`
- land_mask.file_name
* - :term:`POINT_STAT_LAND_MASK_FIELD_NAME`
- land_mask.field.name
* - :term:`POINT_STAT_LAND_MASK_FIELD_LEVEL`
- land_mask.field.level
* - :term:`POINT_STAT_LAND_MASK_REGRID_METHOD`
- land_mask.regrid.method
* - :term:`POINT_STAT_LAND_MASK_REGRID_WIDTH`
- land_mask.regrid.width
* - :term:`POINT_STAT_LAND_MASK_THRESH`
- land_mask.thresh

${METPLUS_TOPO_MASK_DICT}
^^^^^^^^^^^^^^^^^^^^^^^^^

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

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_TOPO_MASK_FLAG`
- topo_mask.flag
* - :term:`POINT_STAT_TOPO_MASK_FILE_NAME`
- topo_mask.file_name
* - :term:`POINT_STAT_TOPO_MASK_FIELD_NAME`
- topo_mask.field.name
* - :term:`POINT_STAT_TOPO_MASK_FIELD_LEVEL`
- topo_mask.field.level
* - :term:`POINT_STAT_TOPO_MASK_REGRID_METHOD`
- topo_mask.regrid.method
* - :term:`POINT_STAT_TOPO_MASK_REGRID_WIDTH`
- topo_mask.regrid.width
* - :term:`POINT_STAT_TOPO_MASK_USE_OBS_THRESH`
- topo_mask.use_obs_thresh
* - :term:`POINT_STAT_TOPO_MASK_INTERP_FCST_THRESH`
- topo_mask.interp_fcst_thresh

${METPLUS_OBS_WINDOW_DICT}
""""""""""""""""""""""""""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,57 @@ def test_met_dictionary_in_var_options(metplus_config):
'sid = ["one", "two"];'
'llpnt = [{ name = "LAT30TO40"; lat_thresh = >=30&&<=40; lon_thresh = NA; }, { name = "BOX"; lat_thresh = >=20&&<=40; lon_thresh = >=-110&&<=-90; }];}'
)}),
# land_mask dictionary
({'POINT_STAT_LAND_MASK_FLAG': 'false', },
{'METPLUS_LAND_MASK_DICT': 'land_mask = {flag = FALSE;}'}),
({'POINT_STAT_LAND_MASK_FILE_NAME': '/some/file/path.nc', },
{'METPLUS_LAND_MASK_DICT': 'land_mask = {file_name = ["/some/file/path.nc"];}'}),
({'POINT_STAT_LAND_MASK_FIELD_NAME': 'LAND',
'POINT_STAT_LAND_MASK_FIELD_LEVEL': 'L0'},
{'METPLUS_LAND_MASK_DICT': 'land_mask = {field = {name = "LAND";level = "L0";}}'}),
({'POINT_STAT_LAND_MASK_REGRID_METHOD': 'NEAREST',
'POINT_STAT_LAND_MASK_REGRID_WIDTH': '1'},
{'METPLUS_LAND_MASK_DICT': 'land_mask = {regrid = {method = NEAREST;width = 1;}}'}),
({'POINT_STAT_LAND_MASK_THRESH': 'eq1', },
{'METPLUS_LAND_MASK_DICT': 'land_mask = {thresh = eq1;}'}),
({'POINT_STAT_LAND_MASK_FLAG': 'false',
'POINT_STAT_LAND_MASK_FILE_NAME': '/some/file/path.nc',
'POINT_STAT_LAND_MASK_FIELD_NAME': 'LAND',
'POINT_STAT_LAND_MASK_FIELD_LEVEL': 'L0',
'POINT_STAT_LAND_MASK_REGRID_METHOD': 'NEAREST',
'POINT_STAT_LAND_MASK_REGRID_WIDTH': '1',
'POINT_STAT_LAND_MASK_THRESH': 'eq1',
},
{'METPLUS_LAND_MASK_DICT': ('land_mask = {flag = FALSE;file_name = ["/some/file/path.nc"];'
'field = {name = "LAND";level = "L0";}'
'regrid = {method = NEAREST;width = 1;}thresh = eq1;}')}),
# topo_mask dictionary
({'POINT_STAT_TOPO_MASK_FLAG': 'false', },
{'METPLUS_TOPO_MASK_DICT': 'topo_mask = {flag = FALSE;}'}),
({'POINT_STAT_TOPO_MASK_FILE_NAME': '/some/file/path.nc', },
{'METPLUS_TOPO_MASK_DICT': 'topo_mask = {file_name = ["/some/file/path.nc"];}'}),
({'POINT_STAT_TOPO_MASK_FIELD_NAME': 'TOPO',
'POINT_STAT_TOPO_MASK_FIELD_LEVEL': 'L0'},
{'METPLUS_TOPO_MASK_DICT': 'topo_mask = {field = {name = "TOPO";level = "L0";}}'}),
({'POINT_STAT_TOPO_MASK_REGRID_METHOD': 'NEAREST',
'POINT_STAT_TOPO_MASK_REGRID_WIDTH': '1'},
{'METPLUS_TOPO_MASK_DICT': 'topo_mask = {regrid = {method = NEAREST;width = 1;}}'}),
({'POINT_STAT_TOPO_MASK_USE_OBS_THRESH': 'ge-100&&le100', },
{'METPLUS_TOPO_MASK_DICT': 'topo_mask = {use_obs_thresh = ge-100&&le100;}'}),
({'POINT_STAT_TOPO_MASK_INTERP_FCST_THRESH': 'ge-50&&le50', },
{'METPLUS_TOPO_MASK_DICT': 'topo_mask = {interp_fcst_thresh = ge-50&&le50;}'}),
({'POINT_STAT_TOPO_MASK_FLAG': 'false',
'POINT_STAT_TOPO_MASK_FILE_NAME': '/some/file/path.nc',
'POINT_STAT_TOPO_MASK_FIELD_NAME': 'TOPO',
'POINT_STAT_TOPO_MASK_FIELD_LEVEL': 'L0',
'POINT_STAT_TOPO_MASK_REGRID_METHOD': 'NEAREST',
'POINT_STAT_TOPO_MASK_REGRID_WIDTH': '1',
'POINT_STAT_TOPO_MASK_USE_OBS_THRESH': 'ge-100&&le100',
'POINT_STAT_TOPO_MASK_INTERP_FCST_THRESH': 'ge-50&&le50'
},
{'METPLUS_TOPO_MASK_DICT': ('topo_mask = {flag = FALSE;file_name = ["/some/file/path.nc"];'
'field = {name = "TOPO";level = "L0";}regrid = {method = NEAREST;width = 1;}'
'use_obs_thresh = ge-100&&le100;interp_fcst_thresh = ge-50&&le50;}')}),
]
)
Expand Down
31 changes: 31 additions & 0 deletions metplus/wrappers/point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class PointStatWrapper(CompareGriddedWrapper):
'METPLUS_FCST_FIELD',
'METPLUS_OBS_FIELD',
'METPLUS_MESSAGE_TYPE',
'METPLUS_LAND_MASK_DICT',
'METPLUS_TOPO_MASK_DICT',
'METPLUS_OBS_WINDOW_DICT',
'METPLUS_MASK_DICT',
'METPLUS_OUTPUT_PREFIX',
Expand Down Expand Up @@ -189,6 +191,35 @@ def create_c_dict(self):

self.handle_climo_cdf_dict()

self.add_met_config_dict('land_mask', {
'flag': 'bool',
'file_name': 'list',
'field': ('dict', None, {
'name': 'string',
'level': 'string',
}),
'regrid': ('dict', None, {
'method': ('string', 'remove_quotes'),
'width': 'int',
}),
'thresh': 'thresh',
})

self.add_met_config_dict('topo_mask', {
'flag': 'bool',
'file_name': 'list',
'field': ('dict', None, {
'name': 'string',
'level': 'string',
}),
'regrid': ('dict', None, {
'method': ('string', 'remove_quotes'),
'width': 'int',
}),
'use_obs_thresh': 'thresh',
'interp_fcst_thresh': 'thresh',
})

c_dict['OBS_VALID_BEG'] = (
self.config.getraw('config', 'POINT_STAT_OBS_VALID_BEG', '')
)
Expand Down
23 changes: 23 additions & 0 deletions parm/met_config/PointStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ ${METPLUS_CLIMO_CDF_DICT}

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

//
// Land/Sea mask
// For LANDSF message types, only use forecast grid points where land = TRUE.
// For WATERSF message types, only use forecast grid points where land = FALSE.
// land_mask.flag may be set separately in each "obs.field" entry.
//
//land_mask = {
${METPLUS_LAND_MASK_DICT}

//
// Topography
// For SURFACE message types, only use observations where the topo - station
// elevation difference meets the use_obs_thresh threshold.
// For the observations kept, when interpolating forecast data to the
// observation location, only use forecast grid points where the topo - station
// difference meets the interp_fcst_thresh threshold.
// topo_mask.flag may be set separately in each "obs.field" entry.
//
//topo_mask = {
${METPLUS_TOPO_MASK_DICT}

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

//
// Point observation time window
//
Expand Down
17 changes: 17 additions & 0 deletions parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,23 @@ POINT_STAT_OUTPUT_FLAG_VL1L2 = STAT
#POINT_STAT_CLIMO_CDF_WRITE_BINS = True
#POINT_STAT_CLIMO_CDF_DIRECT_PROB =

#POINT_STAT_LAND_MASK_FLAG =
#POINT_STAT_LAND_MASK_FILE_NAME =
#POINT_STAT_LAND_MASK_FIELD_NAME =
#POINT_STAT_LAND_MASK_FIELD_LEVEL =
#POINT_STAT_LAND_MASK_REGRID_METHOD =
#POINT_STAT_LAND_MASK_REGRID_WIDTH =
#POINT_STAT_LAND_MASK_THRESH =

#POINT_STAT_TOPO_MASK_FLAG =
#POINT_STAT_TOPO_MASK_FILE_NAME =
#POINT_STAT_TOPO_MASK_FIELD_NAME =
#POINT_STAT_TOPO_MASK_FIELD_LEVEL =
#POINT_STAT_TOPO_MASK_REGRID_METHOD =
#POINT_STAT_TOPO_MASK_REGRID_WIDTH =
#POINT_STAT_TOPO_MASK_USE_OBS_THRESH =
#POINT_STAT_TOPO_MASK_INTERP_FCST_THRESH =

#POINT_STAT_HSS_EC_VALUE =

#POINT_STAT_SEEPS_P1_THRESH =
Expand Down

0 comments on commit 4c99bd2

Please sign in to comment.