Skip to content

Commit

Permalink
Feature 1392 climo_cdf.direct_prob and SeriesAnalysis (#1396)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Feb 9, 2022
1 parent 1619c6c commit b1bbe3e
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 11 deletions.
30 changes: 30 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5445,6 +5445,11 @@ METplus Configuration Glossary

| *Used by:* EnsembleStat
ENSEMBLE_STAT_CLIMO_CDF_DIRECT_PROB
Specify the value for 'climo_cdf.direct_prob' in the MET configuration file for EnsembleStat.

| *Used by:* EnsembleStat
ENSEMBLE_STAT_DUPLICATE_FLAG
Specify the value for 'duplicate_flag' in the MET configuration file for EnsembleStat.

Expand Down Expand Up @@ -6266,6 +6271,11 @@ METplus Configuration Glossary

| *Used by:* GridStat
GRID_STAT_CLIMO_CDF_DIRECT_PROB
Specify the value for 'climo_cdf.direct_prob' in the MET configuration file for GridStat.

| *Used by:* GridStat
POINT_STAT_CLIMO_CDF_CDF_BINS
See :term:`POINT_STAT_CLIMO_CDF_BINS`

Expand All @@ -6284,6 +6294,11 @@ METplus Configuration Glossary

| *Used by:* PointStat
POINT_STAT_CLIMO_CDF_DIRECT_PROB
Specify the value for 'climo_cdf.direct_prob' in the MET configuration file for PointStat.

| *Used by:* PointStat
GRID_STAT_OUTPUT_FLAG_FHO
Specify the value for 'output_flag.fho' in the MET configuration file for GridStat.

Expand Down Expand Up @@ -9045,3 +9060,18 @@ METplus Configuration Glossary
:term:`GEN_ENS_PROD_INPUT_DIR` are ignored.

| *Used by:* GenEnsProd
SERIES_ANALYSIS_CLIMO_CDF_BINS
Specify the value for 'climo_cdf.cdf_bins' in the MET configuration file for SeriesAnalysis.

| *Used by:* SeriesAnalysis
SERIES_ANALYSIS_CLIMO_CDF_CENTER_BINS
Specify the value for 'climo_cdf.center_bins' in the MET configuration file for SeriesAnalysis.

| *Used by:* SeriesAnalysis
SERIES_ANALYSIS_CLIMO_CDF_DIRECT_PROB
Specify the value for 'climo_cdf.direct_prob' in the MET configuration file for SeriesAnalysis.

| *Used by:* SeriesAnalysis
26 changes: 26 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ METplus Configuration
| :term:`ENSEMBLE_STAT_CLIMO_CDF_BINS`
| :term:`ENSEMBLE_STAT_CLIMO_CDF_CENTER_BINS`
| :term:`ENSEMBLE_STAT_CLIMO_CDF_WRITE_BINS`
| :term:`ENSEMBLE_STAT_CLIMO_CDF_DIRECT_PROB`
| :term:`ENSEMBLE_STAT_DUPLICATE_FLAG`
| :term:`ENSEMBLE_STAT_SKIP_CONST`
| :term:`ENSEMBLE_STAT_NMEP_SMOOTH_GAUSSIAN_DX`
Expand Down Expand Up @@ -717,6 +718,8 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
- climo_cdv.center_bins
* - :term:`ENSEMBLE_STAT_CLIMO_CDF_WRITE_BINS`
- climo_cdv.write_bins
* - :term:`ENSEMBLE_STAT_CLIMO_CDF_DIRECT_PROB`
- climo_cdf.direct_prob

**${METPLUS_MASK_GRID}**

Expand Down Expand Up @@ -2806,6 +2809,7 @@ METplus Configuration
| :term:`GRID_STAT_CLIMO_CDF_BINS`
| :term:`GRID_STAT_CLIMO_CDF_CENTER_BINS`
| :term:`GRID_STAT_CLIMO_CDF_WRITE_BINS`
| :term:`GRID_STAT_CLIMO_CDF_DIRECT_PROB`
| :term:`GRID_STAT_OUTPUT_FLAG_FHO`
| :term:`GRID_STAT_OUTPUT_FLAG_CTC`
| :term:`GRID_STAT_OUTPUT_FLAG_CTS`
Expand Down Expand Up @@ -3193,6 +3197,8 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
- climo_cdf.center_bins
* - :term:`GRID_STAT_CLIMO_CDF_WRITE_BINS`
- climo_cdf.write_bins
* - :term:`GRID_STAT_CLIMO_CDF_DIRECT_PROB`
- climo_cdf.direct_prob

**${METPLUS_OUTPUT_FLAG_DICT}**

Expand Down Expand Up @@ -5314,6 +5320,7 @@ Configuration
| :term:`POINT_STAT_CLIMO_CDF_BINS`
| :term:`POINT_STAT_CLIMO_CDF_CENTER_BINS`
| :term:`POINT_STAT_CLIMO_CDF_WRITE_BINS`
| :term:`POINT_STAT_CLIMO_CDF_DIRECT_PROB`
| :term:`POINT_STAT_OBS_QUALITY_INC`
| :term:`POINT_STAT_OBS_QUALITY_EXC`
| :term:`POINT_STAT_OUTPUT_FLAG_FHO`
Expand Down Expand Up @@ -5679,6 +5686,8 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
- climo_cdf.center_bins
* - :term:`POINT_STAT_CLIMO_CDF_WRITE_BINS`
- climo_cdf.write_bins
* - :term:`POINT_STAT_CLIMO_CDF_DIRECT_PROB`
- climo_cdf.direct_prob

**${METPLUS_OBS_QUALITY_INC}**

Expand Down Expand Up @@ -5977,6 +5986,9 @@ METplus Configuration
| :term:`SERIES_ANALYSIS_CLIMO_STDEV_FILE_TYPE`
| :term:`SERIES_ANALYSIS_CLIMO_STDEV_USE_FCST`
| :term:`SERIES_ANALYSIS_CLIMO_STDEV_USE_OBS`
| :term:`SERIES_ANALYSIS_CLIMO_CDF_BINS`
| :term:`SERIES_ANALYSIS_CLIMO_CDF_CENTER_BINS`
| :term:`SERIES_ANALYSIS_CLIMO_CDF_DIRECT_PROB`
| :term:`SERIES_ANALYSIS_HSS_EC_VALUE`
| :term:`SERIES_ANALYSIS_OUTPUT_STATS_FHO`
| :term:`SERIES_ANALYSIS_OUTPUT_STATS_CTC`
Expand Down Expand Up @@ -6208,6 +6220,20 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`SERIES_ANALYSIS_CLIMO_STDEV_FILE_TYPE`
- climo_stdev.file_type

**${METPLUS_CLIMO_CDF_DICT}**

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

* - METplus Config(s)
- MET Config File
* - :term:`SERIES_ANALYSIS_CLIMO_CDF_BINS`
- climo_cdf.cdf_bins
* - :term:`SERIES_ANALYSIS_CLIMO_CDF_CENTER_BINS`
- climo_cdf.center_bins
* - :term:`SERIES_ANALYSIS_CLIMO_CDF_DIRECT_PROB`
- climo_cdf.direct_prob

**${METPLUS_BLOCK_SIZE}**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,17 @@ def test_handle_climo_file_variables(metplus_config, config_overrides,
({'ENSEMBLE_STAT_CLIMO_CDF_WRITE_BINS': 'False', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {write_bins = FALSE;}'}),
({'ENSEMBLE_STAT_CLIMO_CDF_DIRECT_PROB': 'False', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {direct_prob = FALSE;}'}),
({
'ENSEMBLE_STAT_CLIMO_CDF_CDF_BINS': '1',
'ENSEMBLE_STAT_CLIMO_CDF_CENTER_BINS': 'True',
'ENSEMBLE_STAT_CLIMO_CDF_WRITE_BINS': 'False',
'ENSEMBLE_STAT_CLIMO_CDF_DIRECT_PROB': 'False',
},
{
'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;write_bins = FALSE;}'}),
'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;write_bins = FALSE;direct_prob = FALSE;}'}),
({'ENSEMBLE_STAT_INTERP_VLD_THRESH': '0.8', },
{'METPLUS_INTERP_DICT': 'interp = {vld_thresh = 0.8;}'}),
Expand Down
6 changes: 5 additions & 1 deletion internal_tests/pytests/grid_stat/test_grid_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,17 @@ def test_handle_climo_file_variables(metplus_config, config_overrides,
({'GRID_STAT_CLIMO_CDF_WRITE_BINS': 'False', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {write_bins = FALSE;}'}),
({'GRID_STAT_CLIMO_CDF_DIRECT_PROB': 'False', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {direct_prob = FALSE;}'}),
({
'GRID_STAT_CLIMO_CDF_CDF_BINS': '1',
'GRID_STAT_CLIMO_CDF_CENTER_BINS': 'True',
'GRID_STAT_CLIMO_CDF_WRITE_BINS': 'False',
'GRID_STAT_CLIMO_CDF_DIRECT_PROB': 'False',
},
{
'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;write_bins = FALSE;}'}),
'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;write_bins = FALSE;direct_prob = FALSE;}'}),
({'GRID_STAT_INTERP_FIELD': 'NONE', },
{'METPLUS_INTERP_DICT': 'interp = {field = NONE;}'}),
Expand Down
6 changes: 5 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 @@ -162,13 +162,17 @@ def test_met_dictionary_in_var_options(metplus_config):
({'POINT_STAT_CLIMO_CDF_WRITE_BINS': 'False', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {write_bins = FALSE;}'}),
({'POINT_STAT_CLIMO_CDF_DIRECT_PROB': 'False', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {direct_prob = FALSE;}'}),
({
'POINT_STAT_CLIMO_CDF_CDF_BINS': '1',
'POINT_STAT_CLIMO_CDF_CENTER_BINS': 'True',
'POINT_STAT_CLIMO_CDF_WRITE_BINS': 'False',
'POINT_STAT_CLIMO_CDF_DIRECT_PROB': 'False',
},
{
'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;write_bins = FALSE;}'}),
'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;write_bins = FALSE;direct_prob = FALSE;}'}),
({'POINT_STAT_OBS_QUALITY_INC': '2,3,4', },
{'METPLUS_OBS_QUALITY_INC': 'obs_quality_inc = ["2", "3", "4"];'}),
Expand Down
15 changes: 15 additions & 0 deletions internal_tests/pytests/series_analysis/test_series_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ def set_minimum_config_settings(config):
({'SERIES_ANALYSIS_OBS_CAT_THRESH': '<=CDP33', },
{'METPLUS_OBS_CAT_THRESH': 'cat_thresh = [<=CDP33];'}),
({'SERIES_ANALYSIS_CLIMO_CDF_CDF_BINS': '1', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;}'}),
({'SERIES_ANALYSIS_CLIMO_CDF_CENTER_BINS': 'True', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {center_bins = TRUE;}'}),
({'SERIES_ANALYSIS_CLIMO_CDF_DIRECT_PROB': 'False', },
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {direct_prob = FALSE;}'}),
({'SERIES_ANALYSIS_CLIMO_CDF_CDF_BINS': '1',
'SERIES_ANALYSIS_CLIMO_CDF_CENTER_BINS': 'True',
'SERIES_ANALYSIS_CLIMO_CDF_DIRECT_PROB': 'False',
},
{'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;direct_prob = FALSE;}'}),
]
)
def test_series_analysis_single_field(metplus_config, config_overrides,
Expand Down
14 changes: 14 additions & 0 deletions metplus/wrappers/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,3 +1843,17 @@ def get_config_file(self, default_config_file=None):
return get_wrapped_met_config_file(self.config,
self.app_name,
default_config_file)

def handle_climo_cdf_dict(self, write_bins=True):
items = {
'cdf_bins': ('float', None, None,
[f'{self.app_name.upper()}_CLIMO_CDF_BINS']),
'center_bins': 'bool',
}

# add write_bins unless it should be excluded
if write_bins:
items['write_bins'] = 'bool'

items['direct_prob'] = 'bool'
self.add_met_config_dict('climo_cdf', items)
8 changes: 0 additions & 8 deletions metplus/wrappers/compare_gridded_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,6 @@ def get_command(self):
cmd += '-outdir {}'.format(self.outdir)
return cmd

def handle_climo_cdf_dict(self):
self.add_met_config_dict('climo_cdf', {
'cdf_bins': ('float', None, None,
[f'{self.app_name.upper()}_CLIMO_CDF_BINS']),
'center_bins': 'bool',
'write_bins': 'bool',
})

def handle_interp_dict(self, uses_field=False):
"""! Reads config variables for interp dictionary, i.e.
_INTERP_VLD_THRESH, _INTERP_SHAPE, _INTERP_METHOD, and
Expand Down
5 changes: 5 additions & 0 deletions metplus/wrappers/series_analysis_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class SeriesAnalysisWrapper(RuntimeFreqWrapper):
'METPLUS_HSS_EC_VALUE',
'METPLUS_FCST_CAT_THRESH',
'METPLUS_OBS_CAT_THRESH',
'METPLUS_CLIMO_CDF_DICT',
]

# handle deprecated env vars used pre v4.0.0
Expand Down Expand Up @@ -366,6 +367,9 @@ def create_c_dict(self):
# get climatology config variables
self.handle_climo_dict()

# get climo_cdf dictionary
self.handle_climo_cdf_dict(write_bins=False)

self.add_met_config(name='hss_ec_value',
data_type='float',
metplus_configs=['SERIES_ANALYSIS_HSS_EC_VALUE'])
Expand Down Expand Up @@ -670,6 +674,7 @@ def _get_fcst_and_obs_path(self, time_info, storm_id, lead_group):
# set forecast lead to last lead in list to set in output filename
if leads:
time_info['lead'] = leads[-1]

if self.c_dict['USING_BOTH']:
both_path = do_string_sub(self.c_dict['BOTH_INPUT_FILE_LIST'],
**time_info)
Expand Down
3 changes: 3 additions & 0 deletions parm/met_config/SeriesAnalysisConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ ${METPLUS_CLIMO_MEAN_DICT}
//climo_stdev = {
${METPLUS_CLIMO_STDEV_DICT}

//climo_cdf = {
${METPLUS_CLIMO_CDF_DICT}

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

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ ENSEMBLE_STAT_ENS_PHIST_BIN_SIZE = 0.05
ENSEMBLE_STAT_CLIMO_CDF_BINS = 1
ENSEMBLE_STAT_CLIMO_CDF_CENTER_BINS = False
ENSEMBLE_STAT_CLIMO_CDF_WRITE_BINS = True
#ENSEMBLE_STAT_CLIMO_CDF_DIRECT_PROB =

ENSEMBLE_STAT_MASK_GRID = FULL
ENSEMBLE_STAT_MASK_POLY =
Expand Down
1 change: 1 addition & 0 deletions parm/use_cases/met_tool_wrapper/GridStat/GridStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ GRID_STAT_OUTPUT_PREFIX = {MODEL}_{CURRENT_FCST_NAME}_vs_{OBTYPE}_{CURRENT_OBS_N
#GRID_STAT_CLIMO_CDF_BINS = 1
#GRID_STAT_CLIMO_CDF_CENTER_BINS = False
#GRID_STAT_CLIMO_CDF_WRITE_BINS = True
#GRID_STAT_CLIMO_CDF_DIRECT_PROB =

#GRID_STAT_OUTPUT_FLAG_FHO = NONE
GRID_STAT_OUTPUT_FLAG_CTC = STAT
Expand Down
1 change: 1 addition & 0 deletions parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ POINT_STAT_OUTPUT_FLAG_VL1L2 = STAT
#POINT_STAT_CLIMO_CDF_BINS = 1
#POINT_STAT_CLIMO_CDF_CENTER_BINS = False
#POINT_STAT_CLIMO_CDF_WRITE_BINS = True
#POINT_STAT_CLIMO_CDF_DIRECT_PROB =

#POINT_STAT_HSS_EC_VALUE =

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ SERIES_ANALYSIS_IS_PAIRED = False
#SERIES_ANALYSIS_CLIMO_STDEV_HOUR_INTERVAL =
#SERIES_ANALYSIS_CLIMO_STDEV_FILE_TYPE =

#SERIES_ANALYSIS_CLIMO_CDF_BINS =
#SERIES_ANALYSIS_CLIMO_CDF_CENTER_BINS =
#SERIES_ANALYSIS_CLIMO_CDF_DIRECT_PROB =

#SERIES_ANALYSIS_HSS_EC_VALUE =

#FCST_SERIES_ANALYSIS_PROB_THRESH =
Expand Down

0 comments on commit b1bbe3e

Please sign in to comment.