Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make initial config changes for COM refactor
THIS COMMIT BREAKS THE ENTIRE WORKFLOW. Functionality will be returned in subsequent commits for this project. Removes the old `COMIN` variables from `config.base` and adds a new `config.com`. This new configuration is currently sourced by `config.base` and contains a series of path templates. These templates are substituted at runtime to produce the appropriate paths. Templates must use SINGLE quotation marks to prevent substituting variables when sourced. The substitutions can be made one of two ways. First, the `config.com` script also defines a function `generate_com`, which takes in a list of variable names and automatically parses the associated template into the each variable. The function also takes a list of options that mirrors those of the `declare` (aka `typeset`) built-in, which is what the function uses under the hood. For this method, the template must be defined to the variable `${VARIABLE_NAME}_TMPL`. Assign COM_OBS from COM_OBS_TMPL template and mark it for export and read-only ``` generate_com -rx COM_OBS ``` The second method is to do the substitution directly using `envsubst`. If you need to override variables in the template without changing the actual variables (for instance, to generate the path for a previous cycle), or assign to a different variable name than the template, you'll need to use this method. To use this method, use a subshell to echo the template and pipe it through `envsubst` to substitute in variables from the environment: This is the equivilent of the generate_com example above ``` COM_OBS=$(echo "${COM_OBS_TMPL}" | envsubst) declare -rx COM_OBS ``` As mentioned, you can also locally override variables if needed: ``` COM_ATMOS_RESTART_PREV=$({ RUN="${rCDUMP}" PDY="${PDY_PREV}" cyc="${cyc_PREV}" echo "${COM_ATMOS_RESTART_TMPL}" | envsubst }) declare -rx COM_ATMOS_RESTART_PREV ``` ``` Refs: NOAA-EMC#761
- Loading branch information