dtcenter/METplus

Enhancement: Remove support for deprecated environment variables for old wrapped MET config files

Closed this issue · 0 comments

Support for setting values in MET config files now follows a naming standard (environment variables start with METPLUS_). There is a lot of messy logic in the wrappers to continue supporting environment variables with the old naming conventions. This makes the code more complex than necessary and clutters the log output.

Many of these old variables have been supported since v4.1. We decided that this change should be made for a major release (X.0). We were unable to make this update for v5.0, so it would be good to complete it for v6.0.0. Ideally the changes would be made early in the development cycle (beta1?) so that testing can expose external use cases that reference old environment variables so they can be updated before the official release.

Users are urged to use the wrapped MET config file that is provided with the wrappers instead of using their own so that any updates to support new configs are automatically available. If they are using the provided files, then these changes will not affect them.

Describe the Enhancement

Remove support for old environment variables in favor of the newer env vars that start with METPLUS_.

For example, this function in ascii2nc_wrapper.py:

    def set_environment_variables(self, time_info):
        """!Set environment variables that will be read by the MET config file.
            Reformat as needed. Print list of variables that were set and their values.
            Args:
              @param time_info dictionary containing timing info from current run"""
        # set environment variables needed for legacy MET config file
        self.add_env_var('TIME_SUMMARY_FLAG',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_FLAG', ''))
        self.add_env_var('TIME_SUMMARY_RAW_DATA',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_RAW_DATA', ''))
        self.add_env_var('TIME_SUMMARY_BEG',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_BEG', ''))
        self.add_env_var('TIME_SUMMARY_END',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_END', ''))
        self.add_env_var('TIME_SUMMARY_STEP',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_STEP', ''))
        self.add_env_var('TIME_SUMMARY_WIDTH',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_WIDTH', ''))
        self.add_env_var('TIME_SUMMARY_GRIB_CODES',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_GRIB_CODES', '').strip('[]'))
        self.add_env_var('TIME_SUMMARY_VAR_NAMES',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_VAR_NAMES', '').strip('[]'))
        self.add_env_var('TIME_SUMMARY_TYPES',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_TYPES', '').strip('[]'))
        self.add_env_var('TIME_SUMMARY_VALID_FREQ',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_VALID_FREQ', ''))
        self.add_env_var('TIME_SUMMARY_VALID_THRESH',
                         self.env_var_dict.get('METPLUS_TIME_SUMMARY_VALID_THRESH', ''))

        # set user environment variables
        super().set_environment_variables(time_info)

can be completed removed because setting the new environment variables are handled within the add_met_config functions.

Time Estimate

~1 day

Sub-Issues

Consider breaking the enhancement down into sub-issues.

  • Add a checkbox for each sub-issue here.

Relevant Deadlines

v6.0.0

Funding Source

Define the source of funding and account keys here or state NONE.

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required
  • Select scientist(s) or no scientist required

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Select Repository and/or Organization level Project(s) or add alert: NEED CYCLE ASSIGNMENT label
  • Select Milestone as the next official version or Future Versions

Define Related Issue(s)

Consider the impact to the other METplus components.

Enhancement Checklist

See the METplus Workflow for details.

  • Complete the issue definition above, including the Time Estimate and Funding Source.
  • Fork this repository or create a branch of develop.
    Branch name: feature_<Issue Number>_<Description>
  • Complete the development and test your changes.
  • Add/update log messages for easier debugging.
  • Add/update unit tests.
  • Add/update documentation.
  • Add any new Python packages to the METplus Components Python Requirements table.
  • Push local changes to GitHub.
  • Submit a pull request to merge into develop.
    Pull request: feature <Issue Number> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s) and Development issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.