Skip to content

Commit

Permalink
Feature #2578 PCPCombine -input_thresh for missing inputs (#2609)
Browse files Browse the repository at this point in the history
* refactoring to reduce duplicate/redundant code, reduce cognitive complexity to satisfy SonarQube, etc

* change wording of error log to satisfy test

* set -input_thresh argument if set for add, derive, and sum methods. refactor setting of method arguments, e.g. -add, -sum, etc., cleanup

* refactor how level is handled in find_data function so that if the level has already been set, it will use that value, otherwise try to get it from {data_type}_level, e.g. fcst_level, otherwise set it to 0 to prevent errors

* refactor duplicate code into function to satisfy SonarQube

* removed unused variable

* use find_data function to find input files to be consistent with other wrappers, only allow multiple input files to be found for a given call to find_data if using the -derive method

* fix typo in key

* suppress warnings when files aren't found because it is expected

* formatting to be consistent in doc string

* per #2578, add MISSING before file path that is not found if input_thresh is set and less than 1.0, added unit test to ensure correct behavior occurs

* add documentation blocks for new functions, ci-run-all-diff

* use pytest fixture instead of local function

* add support for setting -vld_thresh argument

* per #2578, added documentation and tests for setting -input_thresh and -vld_thresh

* moved verbosity argument to end of command to more easily change it when debugging

* refactor to reduce cognitive complexity to satisfy SonarQube

* update usage statement to include METplus version number
  • Loading branch information
georgemccabe authored Jun 12, 2024
1 parent c2f741a commit de58025
Show file tree
Hide file tree
Showing 18 changed files with 646 additions and 576 deletions.
26 changes: 26 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11979,3 +11979,29 @@ METplus Configuration Glossary
There is no default, so a value must be specified. All runtime frequencies are supported.

| *Used by:* UserScript
FCST_PCP_COMBINE_INPUT_THRESH
Specify the value for the command line argument '-input_thresh' for the
forecast run of PCPCombine, e.g. :term:`FCST_PCP_COMBINE_RUN` is True.
Not used when :term:`FCST_PCP_COMBINE_METHOD` is SUBTRACT or USER_DEFINED.

| *Used by:* PCPCombine
OBS_PCP_COMBINE_INPUT_THRESH
Specify the value for the command line argument '-input_thresh' for the
observation run of PCPCombine, e.g. :term:`OBS_PCP_COMBINE_RUN` is True.
Not used when :term:`OBS_PCP_COMBINE_METHOD` is SUBTRACT or USER_DEFINED.

| *Used by:* PCPCombine
FCST_PCP_COMBINE_VLD_THRESH
Specify the value for the command line argument '-vld_thresh' for the
forecast run of PCPCombine, e.g. :term:`FCST_PCP_COMBINE_RUN` is True.

| *Used by:* PCPCombine
OBS_PCP_COMBINE_VLD_THRESH
Specify the value for the command line argument '-vld_thresh' for the
observation run of PCPCombine, e.g. :term:`OBS_PCP_COMBINE_RUN` is True.

| *Used by:* PCPCombine
4 changes: 4 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6027,6 +6027,10 @@ METplus Configuration
| :term:`PCP_COMBINE_INC_VALID_TIMES`
| :term:`PCP_COMBINE_SKIP_INIT_TIMES`
| :term:`PCP_COMBINE_INC_INIT_TIMES`
| :term:`FCST_PCP_COMBINE_INPUT_THRESH`
| :term:`FCST_PCP_COMBINE_VLD_THRESH`
| :term:`OBS_PCP_COMBINE_INPUT_THRESH`
| :term:`OBS_PCP_COMBINE_VLD_THRESH`
|
.. warning:: **DEPRECATED:**
Expand Down
8 changes: 5 additions & 3 deletions internal/tests/pytests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ def make_nc(tmp_path, lon, lat, z, data, variable='Temp', file_name='fake.nc'):
def get_test_data_dir():
"""!Get path to directory containing test data.
"""
def get_test_data_path(subdir):
def get_test_data_path(subdir=None):
internal_tests_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir)
os.path.join(os.path.dirname(__file__), os.pardir, 'data')
)
return os.path.join(internal_tests_dir, 'data', subdir)
if subdir:
internal_tests_dir = os.path.join(internal_tests_dir, subdir)
return internal_tests_dir

return get_test_data_path

Expand Down
Loading

0 comments on commit de58025

Please sign in to comment.