-
Notifications
You must be signed in to change notification settings - Fork 5
Adds stubs for marine obs bufr converter job #68
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| source "${HOMEobsforge}/ush/preamble.sh" | ||
| source "${HOMEobsforge}/ush/jjob_header.sh" | ||
|
|
||
| ############################################## | ||
| # Set variables used in the script | ||
| ############################################## | ||
|
|
||
|
|
||
| ############################################## | ||
| # Begin JOB SPECIFIC work | ||
| ############################################## | ||
|
|
||
| ############################################################### | ||
| # Run relevant script | ||
|
|
||
| EXSCRIPT=${DUMPMARINEPY:-${HOMEobsforge}/scripts/exobsforge_global_marine_bufr_dump.py} | ||
| ${EXSCRIPT} | ||
| status=$? | ||
| if [[ ${status} -ne 0 ]]; then | ||
| exit "${status}" | ||
| fi | ||
|
|
||
|
|
||
| ############################################## | ||
| # End JOB SPECIFIC work | ||
| ############################################## | ||
|
|
||
| ############################################## | ||
| # Final processing | ||
| ############################################## | ||
| if [[ -e "${pgmout}" ]] ; then | ||
| cat "${pgmout}" | ||
| fi | ||
|
|
||
| ########################################## | ||
| # Remove the Temporary working directory | ||
| ########################################## | ||
| cd "${DATAROOT}" || exit | ||
| if [[ "${KEEPDATA}" == "NO" ]]; then | ||
| rm -rf "${DATA}" | ||
| fi | ||
|
|
||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| source "${HOMEobsforge}/ush/preamble.sh" | ||
|
|
||
| ############################################################### | ||
| # Source UFSDA workflow modules | ||
| . "${HOMEobsforge}/ush/load_obsforge_modules.sh" | ||
| status=$? | ||
| if [[ ${status} -ne 0 ]]; then | ||
| exit "${status}" | ||
| fi | ||
|
|
||
| export job="marinebufrdump" | ||
| export jobid="${job}.$$" | ||
|
|
||
| ############################################################### | ||
| # Execute the JJOB | ||
| "${HOMEobsforge}/jobs/JOBSFORGE_GLOBAL_MARINE_BUFR_DUMP" | ||
| status=$? | ||
| exit "${status}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/usr/bin/env python3 | ||
| # exobsforge_global_marine_bufr_dump.py | ||
| # This script will collect and preprocess | ||
| # the ocean and seaice observations for | ||
| # global marine assimilation | ||
| import os | ||
|
|
||
| from wxflow import AttrDict, Logger, cast_strdict_as_dtypedict, parse_j2yaml | ||
| from pyobsforge.task.marine_bufr_prepobs import MarineBufrObsPrep | ||
|
|
||
| # Initialize root logger | ||
| logger = Logger(level='DEBUG', colored_log=True) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
|
|
||
| # Take configuration from environment and cast it as python dictionary | ||
| config_env = cast_strdict_as_dtypedict(os.environ) | ||
|
|
||
| # Take configuration from YAML file to augment/append config dict | ||
| config_yaml = parse_j2yaml(os.path.join(config_env['HOMEobsforge'], 'parm', 'config.yaml'), config_env) | ||
| # Extract obsforge specific configuration | ||
| obsforge_dict = {} | ||
| for key, value in config_yaml['obsforge'].items(): | ||
| if key not in config_env.keys(): | ||
| obsforge_dict[key] = value | ||
|
|
||
| # Combine configs together | ||
| config = AttrDict(**config_env, **obsforge_dict) | ||
| config = AttrDict(**config, **config_yaml['marinebufrdump']) | ||
|
|
||
| marineBufrObs = MarineBufrObsPrep(config) | ||
| marineBufrObs.initialize() | ||
| marineBufrObs.execute() | ||
| marineBufrObs.finalize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| from logging import getLogger | ||
| from typing import Dict, Any | ||
| from wxflow import AttrDict, Task, add_to_datetime, to_timedelta, logit | ||
|
|
||
| logger = getLogger(__name__.split('.')[-1]) | ||
|
|
||
|
|
||
| class MarineBufrObsPrep(Task): | ||
| """ | ||
| Class for preparing and managing marine observations | ||
| """ | ||
| def __init__(self, config: Dict[str, Any]) -> None: | ||
| super().__init__(config) | ||
|
|
||
| _window_begin = add_to_datetime(self.task_config.current_cycle, -to_timedelta(f"{self.task_config['assim_freq']}H") / 2) | ||
| _window_end = add_to_datetime(self.task_config.current_cycle, +to_timedelta(f"{self.task_config['assim_freq']}H") / 2) | ||
|
|
||
| local_dict = AttrDict( | ||
| { | ||
| 'window_begin': _window_begin, | ||
| 'window_end': _window_end, | ||
| 'PREFIX': f"{self.task_config.RUN}.t{self.task_config.cyc:02d}z.", | ||
| } | ||
| ) | ||
|
|
||
| # task_config is everything that this task should need | ||
| self.task_config = AttrDict(**self.task_config, **local_dict) | ||
|
|
||
| @logit(logger) | ||
| def initialize(self) -> None: | ||
| """ | ||
| """ | ||
| logger.info("running init") | ||
|
|
||
| @logit(logger) | ||
| def execute(self) -> None: | ||
| """ | ||
| """ | ||
| logger.info("running execute") | ||
|
|
||
| @logit(logger) | ||
| def finalize(self) -> None: | ||
| """ | ||
| """ | ||
| logger.info("running finalize") | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.