Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1203 ioda2nc #1262

Merged
merged 28 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f7c3ea9
per #1203, created files for ioda2nc wrapper -- needs to be updated
georgemccabe Nov 9, 2021
3334553
added info to contrib guide instructions for creating a new wrapper
georgemccabe Nov 10, 2021
ec15535
Renamed handle_time_summary_dict function to handle_time_summary_lega…
georgemccabe Nov 11, 2021
fea44b9
if metplus_configs argument is not set, use <APP_NAME>_<MET_CONFIG_NA…
georgemccabe Nov 11, 2021
5017a7d
don't read verbosity because it is already read in LoopTimesWrapper
georgemccabe Nov 11, 2021
6737767
read verbosity as integer instead of string
georgemccabe Nov 11, 2021
736aaa7
added wrapper MET config file file ioda2nc
georgemccabe Nov 11, 2021
9afb47f
per #1203, implement logic for wrapper
georgemccabe Nov 11, 2021
ad992e4
Merge branch 'develop' into feature_1203_ioda2nc
georgemccabe Nov 11, 2021
10f17e7
Per #1101, set tmp_dir to /d1/personal/mccabe/out2/tmp in all wrapped…
georgemccabe Nov 11, 2021
19393eb
per #1212, properly parse list values that contain square braces [] o…
georgemccabe Nov 12, 2021
ddad551
per #1203, add documentation for ioda2nc config variables
georgemccabe Nov 12, 2021
e1da1ce
fix formatting for width to remove quotes
georgemccabe Nov 12, 2021
55dc20f
set default -nmsg value to 0 to easily check if it should be let unse…
georgemccabe Nov 12, 2021
3b711a2
per #1204, add documentation for IODA2NC use case example
georgemccabe Nov 12, 2021
0eaf2be
per #1204, add IODA2NCToolUseCase to quick search
georgemccabe Nov 12, 2021
85b9271
per #1203, added unit tests for ioda2nc wrapper to ensure commands ar…
georgemccabe Nov 12, 2021
7e0c30f
added assert to ensure number of commands generated matches the expec…
georgemccabe Nov 12, 2021
28c5c83
per #1203, added documentation for all functions and corrected return…
georgemccabe Nov 12, 2021
2ab2603
per #1204, created use case configuration file for basic example of I…
georgemccabe Nov 12, 2021
ec2f088
per #1204, add new use case to automated tests
georgemccabe Nov 12, 2021
c57676d
removed apostrophe that messes up documentation rendering
georgemccabe Nov 12, 2021
e5ae6ce
fixed variable name mismatch
georgemccabe Nov 12, 2021
d2c15de
minor change to trigger automation
georgemccabe Nov 12, 2021
e118226
change new use case to not run every time to prepare for PR
georgemccabe Nov 12, 2021
ee5e8b1
Removed unit tests that were copied from another file that aren't act…
georgemccabe Nov 12, 2021
3523edf
Merge branch 'develop' into feature_1203_ioda2nc
georgemccabe Nov 15, 2021
dd5c3fc
Removed missing line break
georgemccabe Nov 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/parm/use_case_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"index_list": "30-58",
"run": false
},
{
"category": "met_tool_wrapper",
"index_list": "59",
"run": false
},
{
"category": "air_quality_and_comp",
"index_list": "0",
Expand Down
64 changes: 59 additions & 5 deletions docs/Contributors_Guide/create_wrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ In metplus/util/doc_util.py, add entries to the LOWER_TO_WRAPPER_NAME
dictionary so that the wrapper can be found in the PROCESS_LIST even if
it is formatted differently. The key should be the wrapper name in all
lower-case letters without any underscores. The value should be the class name
of the wrapper without the "Wrapper" suffix. Examples::
of the wrapper without the "Wrapper" suffix. Add the new entry in the location
to preserve alphabetical order so it is easier for other developers to find
it. Examples::

'newtool': 'NewTool',
'ascii2nc': 'ASCII2NC',
'ensemblestat': 'EnsembleStat',
'newtool': 'NewTool',

The name of a tool can be formatted in different ways depending on the context.
For example, the MET tool PCPCombine is written as Pcp-Combine in the MET
Expand Down Expand Up @@ -59,6 +61,9 @@ Wrapper Components

Open the wrapper file for editing the new class.

Naming
^^^^^^

Rename the class to match the wrapper's class from the above sections.
Most wrappers should be a sub-class of the CommandBuilder wrapper::

Expand All @@ -67,19 +72,28 @@ Most wrappers should be a sub-class of the CommandBuilder wrapper::
The text 'CommandBuilder' in parenthesis makes NewToolWrapper a subclass
of CommandBuilder.

Find and replace can be used to rename all instances of the wrapper name in
the file. For example, to create IODA2NC wrapper from ASCII2NC, replace
**ascii2nc** with **ioda2nc** and **ASCII2NC** with **IODA2NC**.
To create EnsembleStat wrapper from GridStat, replace
**grid_stat** with **ensemble_stat** and
**GridStat** with **EnsembleStat**.

Parent Class
^^^^^^^^^^^^

If the new tool falls under one of the existing tool categories,
then you can make the tool a subclass of one of those classes.
This should only be done if the functions in the parent class are needed
by the new wrapper. If you are unsure, then use CommandBuilder.

Refer to the :ref:`basic_components_of_wrappers` section of the Contributor's
Guide for more information on what should be added.

Init Function
^^^^^^^^^^^^^

Modify the init function to initialize NewTool from its base class
to set the self.app_name variable to name of the application.
If the application is a MET tool, then set self.app_path to the full path
of the tool under **MET_BIN_DIR**.
See the Basic Components :ref:`bc_init_function` section for more information::

def __init__(self, config, instance=None, config_overrides=None):
Expand All @@ -90,6 +104,43 @@ See the Basic Components :ref:`bc_init_function` section for more information::
instance=instance,
config_overrides=config_overrides)

Read Configuration Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The create_c_dict function is called during the initialization step of each
wrapper. It is where values from the self.config object are read.
The values are stored in the **c_dict** variable that is referenced
throughout the wrapper execution via self.c_dict.

The function should always start with a call to the parent class'
implementation of the function to read/set any variables that are common to
all wrappers::

c_dict = super().create_c_dict()

The function should also always return the c_dict variable::

return c_dict

File Input/Output
"""""""""""""""""

METplus configuration variables that end with _DIR and _TEMPLATE are used
to define the criteria to search for input files.

Allow Multiple Files
""""""""""""""""""""

If the application can take more than one file as input for a given category
(i.e. FCST, OBS, ENS, etc.) then ALLOW_MULTIPLE_FILES must be set to True::

c_dict['ALLOW_MULTIPLE_FILES'] = True

This is set to False by default in CommandBuilder's create_c_dict function.
If it is set to False and a list of files are found for an input
(using wildcards or a list of files in the METplus config template variable)
then the wrapper will produce an error and not build the command.

Run Functions
^^^^^^^^^^^^^

Expand Down Expand Up @@ -182,6 +233,9 @@ Your use case/example configuration file is located in a directory structure lik

Note the documentation file is in METplus/docs while the use case conf file is in METplus/parm

Refer to the :ref:`basic_components_of_wrappers` section of the Contributor's
Guide for more information on what should be added.

Documentation
-------------

Expand Down
Loading