-
Notifications
You must be signed in to change notification settings - Fork 50
Add stub ex-scripts, recentering class, and ctest for recentering task #916
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
Changes from all commits
6b015d1
257cef4
5678cc1
3886b78
e12b247
595069b
f167b90
856a689
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env python3 | ||
| # exgdas_global_marine_analysis_ecen.py | ||
| # This script creates an MarineRecenter class | ||
| # and runs the initialize, run, and finalize methods | ||
| # which currently are stubs | ||
| import os | ||
|
|
||
| from wxflow import Logger, cast_strdict_as_dtypedict | ||
| # TODO (AFE): change to from pygfs.task.marine_recenter import MarineRecenter | ||
| from soca.marine_recenter import MarineRecenter | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment with a
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it helps, it would be: from pygfs.task.marine_recenter import MarineRecenter |
||
|
|
||
| # Initialize root logger | ||
| logger = Logger(level='DEBUG', colored_log=True) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
|
|
||
| # Take configuration from environment and cast it as python dictionary | ||
| config = cast_strdict_as_dtypedict(os.environ) | ||
|
|
||
| # Instantiate the aerosol analysis task | ||
| MarineRecen = MarineRecenter(config) | ||
| MarineRecen.initialize() | ||
| MarineRecen.run() | ||
| MarineRecen.finalize() | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||||||||||||||||||
| #!/usr/bin/env python3 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import os | ||||||||||||||||||||||
| from logging import getLogger | ||||||||||||||||||||||
| from typing import Dict, List, Any | ||||||||||||||||||||||
| from wxflow import AttrDict, FileHandler, logit, Task | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| logger = getLogger(__name__.split('.')[-1]) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| class MarineRecenter(Task): | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @logit(logger, name="MarineRecenter") | ||||||||||||||||||||||
| def __init__(self, config): | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add stub documentation and follow
Suggested change
Please see examples of tasks in |
||||||||||||||||||||||
| logger.info("init") | ||||||||||||||||||||||
| super().__init__(config) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Create a local dictionary that is repeatedly used across this class | ||||||||||||||||||||||
| local_dict = AttrDict( | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| "diags": os.path.join(self.runtime_config['DATA'], 'diags'), # output dir for soca DA obs space | ||||||||||||||||||||||
| "obs_in": os.path.join(self.runtime_config['DATA'], 'obs') , # input " " | ||||||||||||||||||||||
| "bkg_dir": os.path.join(self.runtime_config['DATA'], 'bkg'), # ice and ocean backgrounds | ||||||||||||||||||||||
| "anl_out": os.path.join(self.runtime_config['DATA'], 'Data'), # output dir for soca DA | ||||||||||||||||||||||
| "static_ens": os.path.join(self.runtime_config['DATA'], 'static_ens') # clim. ens. | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # task_config is everything that this task should need | ||||||||||||||||||||||
| self.task_config = AttrDict(**self.config, **self.runtime_config, **local_dict) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #_soca_ensb_yaml_temp | ||||||||||||||||||||||
| print(self.task_config) | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is temporary for debugging |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @logit(logger) | ||||||||||||||||||||||
| def initialize(self): | ||||||||||||||||||||||
| logger.info("initialize") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @logit(logger) | ||||||||||||||||||||||
| def run(self): | ||||||||||||||||||||||
| logger.info("run") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @logit(logger) | ||||||||||||||||||||||
| def finalize(self): | ||||||||||||||||||||||
| logger.info("finalize") | ||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.