Skip to content

Commit

Permalink
Migrate all suite initialization to python (#202)
Browse files Browse the repository at this point in the history
### Description
All aspects of suite initialization (but not execution) are migrated to python.  The documentation in `README.md` is updated to reflect all of the changes.  A follow-on step will be to add documentation for users (not only developers).

- `Run.py` replaces the old `drive.csh` and `run.csh`.  Scenarios are submitted as cylc suites by executing `Run.py scenario/{name}.yaml`.

- All c-shell task scripts are moved to the `bin/` directory.

- A single `SuiteBase` class (`initialize/suites/SuiteBase.py`) is instantiated by `Run.py`, and is used to generate the `Cylc` `suite.rc` file.

- Several suite-specific classes are derived from `SuiteBase`, e.g., `Cycle`, and are located in the same directory.  Each of the `Component` objects instantiated  (e.g., `DA`, `Forecast`, `ExtendedForecast`, `ExternalAnalyses`) by the derived suite classes is associated with a single root node in the scenario yaml file.  In the case of `DA`, it can instantiate `Variational`, `RTPP`, and `VerifyObs`, each associated with a root yaml node with a corresponding lowercase name (same as current develop branch practice).  There is no `da` root node at this time.

- All non-hpc-specific yaml configuration elements are described in the associated python class. As an example, for `ExtendedForecast`, we have:
```
class ExtendedForecast(Component):
  ...
  variablesWithDefaults = {
    # length of verification extended forecasts
    'lengthHR': [240, int],

    # interval between OMF verification times of an individual forecast
    'outIntervalHR': [12, int],

    # UTC times to run extended forecast from mean or single analysis
    # formatted as comma-separated string, e.g., T00,T06,T12,T18
    # note: must be supplied in order to do single-state verification
    'meanTimes': [None, str],

    # UTC times to run ensemble of extended forecasts
    # formatted as comma-separated string, e.g., T00,T06,T12,T18
    # note: must be supplied in order to do ensemble-state verification
    'ensTimes': [None, str],

    ## post
    # list of tasks for Post
    'post': [['verifyobs', 'verifymodel'], list]
  }
```
Each of the configuration elements has a full description, and in this case, all have default values.  The `meanTimes` option is a `str` and must be supplied in order to conduct extended forecast verification.  After the extended forecasts are complete, users can select from several `post` options.  By default, both `verifyobs` and `verifymodel` (associated with `VerifyObs` and `VerifyModel` classes and their respective shell scripts) are supplied.  Setting `post: []` means that no post-processing is performed and only the forecasts are run (so long as `meanTimes` is set appropriately).

- The `Variational` and `Forecast` classes have similar post-processing functionality via their `post` yaml nodes.

- All functionality previously provided in `SetupWorkflow.csh` and `setupExperiment/` (and most provided by `config/*.csh`, and `config/applications/*.csh`) are migrated to and divided among similarly named python classes.  There is much less cross-application dependence between those classes and their respective shell scripts so that the individual pieces can be moved around.

- Adding a new post-processing task only requires adding a shell script (under `bin/`) and an associated class (under `initialize/post/`) that describes how that shell script is engaged by `Cylc`.  See `VerifyObs` and `VerifyModel` for examples.  The `valid tasks` of the `Post` configuration also need to be updated in the application after which the post-processing will be applied. E.g., in `Forecast.py`:

```python
    self.postconf = {
      'tasks': self['post'],
      'valid tasks': ['hofx', 'verifyobs', 'verifymodel'],
      'verifyobs': {
        'hpc': hpc,
        'mesh': mesh,
        'model': model,
        'sub directory': 'bg',
        'dependencies': [self.previousForecast, obs['PrepareObservations']],
      },
      ...
    }
```

- HPC-specific configuration elements, like `job` resource settings and default data source directory structures are kept in `scenarios/defaults/*.yaml`.  These are not migrated to python, because extending portability for additional HPC's will require further refactoring.  In the interest of that later development, the HPC-specific settings are held to the side.  Future work might include creating several copies of the `scenarios/defaults` directories, one for each compatible HPC.  That would require more refactoring in the python class structure.

### Issue closed
Closes #147
Closes #194


### Tests completed
All tests are successful, including the non-cycling suites.

 - [x] 3dvar_OIE120km_WarmStart
 - [x] 3denvar_OIE120km_WarmStart
 - [x] 3dvar_OIE120km_ColdStart
 - [x] 3dvar_O30kmIE60km_ColdStart
 - [x] 3denvar_O30kmIE60km_WarmStart
 - [x] eda_OIE120km_WarmStart
 - [x] ./Run.py scenarios/GenerateGFSAnalyses.yaml
 - [x] ./Run.py scenarios/GenerateObs.yaml
 - [x] ./Run.py scenarios/ForecastFromGFSAnalyses.yaml


### List of modified files
M	.github/pull_request_template.md
M	.gitignore
D	AppAndVerify.csh
D	CleanHofX.csh
D	LinkExternalAnalysis.csh
A	NOTICE
D	PrepRTPP.csh
M	README.md
A	Run.py
D	SetupWorkflow.csh
A	bin/CleanHofX.csh
R052	CleanRTPP.csh	bin/CleanRTPP.csh
R076	CleanVariational.csh	bin/CleanVariational.csh
R089	EnsembleOfVariational.csh	bin/EnsembleOfVariational.csh
R050	ExternalAnalysisToMPAS.csh	bin/ExternalAnalysisToMPAS.csh
R079	forecast.csh	bin/Forecast.csh
R085	GenerateABEInflation.csh	bin/GenerateABEInflation.csh
R075	GetGDASAnalysisFromFTP.csh	bin/GetGDASAnalysisFromFTP.csh
R070	GetGFSAnalysisFromFTP.csh	bin/GetGFSAnalysisFromFTP.csh
R070	GetGFSAnalysisFromRDA.csh	bin/GetGFSAnalysisFromRDA.csh
R092	GetObs.csh	bin/GetObs.csh
R067	HofX.csh	bin/HofX.csh
A	bin/InitRTPP.csh
R096	PrepVariational.csh	bin/InitVariationals.csh
A	bin/LinkExternalAnalysis.csh
R062	LinkWarmStartBackgrounds.csh	bin/LinkWarmStartBackgrounds.csh
R055	MeanAnalysis.csh	bin/MeanAnalysis.csh
R056	MeanBackground.csh	bin/MeanBackground.csh
R078	ObsToIODA.csh	bin/ObsToIODA.csh
R078	PrepJEDI.csh	bin/PrepJEDI.csh
R086	RTPP.csh	bin/RTPP.csh
R060	UngribExternalAnalysis.csh	bin/UngribExternalAnalysis.csh
R086	Variational.csh	bin/Variational.csh
R058	verifymodel.csh	bin/VerifyModel.csh
R059	verifyobs.csh	bin/VerifyObs.csh
R078	comparemodel.csh	bin/comparemodel.csh
R074	compareobs.csh	bin/compareobs.csh
A	bin/getCycleVars.csh
D	config/applications/ensvariational.csh
D	config/applications/forecast.csh
D	config/applications/hofx.csh
D	config/applications/initic.csh
D	config/applications/rtpp.csh
D	config/applications/variational.csh
D	config/applications/verifymodel.csh
D	config/applications/verifyobs.csh
A	config/auto/README.md
D	config/benchmark.csh
D	config/builds.csh
M	config/config.csh
M	config/environmentJEDI.csh
D	config/externalanalyses.csh
D	config/firstbackground.csh
M	config/getConfigOrNone.csh
D	config/job.csh
D	config/members.csh
D	config/model.csh
D	config/naming.csh
D	config/observations.csh
D	config/scenario.csh
M	config/setConfig.csh
M	config/setNestedConfig.csh
D	config/staticstream.csh
D	config/workflow.csh
D	drive.csh
D	getCycleVars.csh
D	include/dependencies/auto/README.md
D	include/dependencies/criticalpath.rc
D	include/dependencies/da.rc
D	include/dependencies/forecast.rc
D	include/dependencies/verifymodel.rc
D	include/dependencies/verifyobs.rc
D	include/tasks/auto/README.md
D	include/tasks/base.rc
D	include/tasks/criticalpath.rc
D	include/tasks/verify.rc
D	include/variables/auto/README.md
A	initialize/applications/DA.py
A	initialize/applications/ExtendedForecast.py
A	initialize/applications/Forecast.py
A	initialize/applications/HofX.py
A	initialize/applications/InitIC.py
A	initialize/applications/Members.py
A	initialize/applications/RTPP.py
A	initialize/applications/Variational.py
A	initialize/config/Component.py
A	initialize/config/Config.py
A	initialize/config/Configurable.py
A	initialize/config/Resource.py
A	initialize/config/Scenario.py
A	initialize/config/SubConfig.py
A	initialize/config/Task.py
A	initialize/config/TaskFamily.py
A	initialize/data/DataList.py
A	initialize/data/ExternalAnalyses.py
A	initialize/data/FirstBackground.py
A	initialize/data/Model.py
A	initialize/data/ObsEnsemble.py
A	initialize/data/Observations.py
A	initialize/data/StateEnsemble.py
A	initialize/data/StaticStream.py
A	initialize/framework/Build.py
A	initialize/framework/Experiment.py
A	initialize/framework/HPC.py
A	initialize/framework/Naming.py
A	initialize/framework/Workflow.py
A	initialize/post/Benchmark.py
A	initialize/post/Post.py
A	initialize/post/VerifyModel.py
A	initialize/post/VerifyObs.py
A	initialize/suites/Cycle.py
A	initialize/suites/ForecastFromExternalAnalyses.py
A	initialize/suites/GenerateExternalAnalyses.py
A	initialize/suites/GenerateObs.py
A	initialize/suites/SuiteBase.py
A	initialize/util/ExampleComponent.py
D	run.csh
D	runs/120km3denvar.yaml
D	runs/120km3denvarIAU.yaml
D	runs/120km3dvar.yaml
D	runs/120kmEDA.yaml
D	runs/30km-60km3denvar.yaml
D	runs/30km-60km3denvarSpecifiedEnsemble.yaml
D	runs/30km-60km3dhybridSpecifiedEnsemble.yaml
D	runs/60kmEDA.yaml
D	runs/ABIAHI120km3denvar.yaml
D	runs/ForecastFromGFSAnalyses.yaml
D	runs/GenerateGFSAnalyses.yaml
D	runs/GenerateObs.yaml
D	runs/GetGDASanalysis.yaml
D	runs/IASI120km3denvar.yaml
D	runs/IASI30kmIE60km3denvar.yaml
D	runs/RealTime.yaml
D	runs/base.yaml
D	runs/test.yaml
M	scenarios/3denvar_O30kmIE60km_WarmStart.yaml
M	scenarios/3denvar_O30kmIE60km_WarmStart_ABEI.yaml
M	scenarios/3denvar_O30kmIE60km_WarmStart_SpecifiedEnsemble.yaml
M	scenarios/3denvar_OIE120km_WarmStart_IAU.yaml
M	scenarios/3dhybrid_O30kmIE60km_SpecifiedEnsemble.yaml
M	scenarios/3dvar_O30kmIE60km_ColdStart.yaml
M	scenarios/3dvar_OIE120km_ColdStart.yaml
M	scenarios/ABIAHI120km3denvar.yaml
M	scenarios/ForecastFromGFSAnalyses.yaml
M	scenarios/GEFSVerify_OIE120km.yaml
M	scenarios/GenerateGFSAnalyses.yaml
M	scenarios/GenerateObs.yaml
M	scenarios/GetGDASanalysis.yaml
M	scenarios/IASI120km3denvar.yaml
M	scenarios/IASI30kmIE60km3denvar.yaml
M	scenarios/RealTime.yaml
A	scenarios/VerifyingGFSAnalysesFromRDA.yaml
D	scenarios/base/benchmark.yaml
D	scenarios/base/builds.yaml
D	scenarios/base/ensvariational.yaml
D	scenarios/base/experiment.yaml
D	scenarios/base/externalanalyses.yaml
D	scenarios/base/firstbackground.yaml
D	scenarios/base/hofx.yaml
D	scenarios/base/job.yaml
D	scenarios/base/members.yaml
D	scenarios/base/model.yaml
D	scenarios/base/observations.yaml
D	scenarios/base/rtpp.yaml
D	scenarios/base/staticstream.yaml
D	scenarios/base/verifymodel.yaml
D	scenarios/base/workflow.yaml
A	scenarios/defaults/externalanalyses.yaml
A	scenarios/defaults/firstbackground.yaml
R052	scenarios/base/forecast.yaml	scenarios/defaults/forecast.yaml
A	scenarios/defaults/hofx.yaml
R062	scenarios/base/initic.yaml	scenarios/defaults/initic.yaml
A	scenarios/defaults/model.yaml
A	scenarios/defaults/observations.yaml
A	scenarios/defaults/rtpp.yaml
A	scenarios/defaults/staticstream.yaml
R067	scenarios/base/variational.yaml	scenarios/defaults/variational.yaml
A	scenarios/defaults/verifymodel.yaml
R052	scenarios/base/verifyobs.yaml	scenarios/defaults/verifyobs.yaml
M	scenarios/eda_OIE60km_WarmStart.yaml
D	scenarios/testinput/3denvar_O30kmIE60km_WarmStart.yaml
D	scenarios/testinput/3dvar_OIE120km_ColdStart.yaml
D	scenarios/testinput/3dvar_OIE120km_WarmStart.yaml
D	setupExperiment/base.csh
D	setupExperiment/cycling.csh
D	setupExperiment/generateExperimentConfig.csh
D	setupExperiment/parseConfig.csh
A	submit.csh
D	suites/Cycle.rc
D	suites/ForecastFromExternalAnalyses.rc
D	suites/GenerateExternalAnalyses.rc
D	suites/GenerateObs.rc
M	test.csh
A	test/testinput/3denvar_O30kmIE60km_WarmStart.yaml
R057	scenarios/testinput/3denvar_OIE120km_WarmStart.yaml	test/testinput/3denvar_OIE120km_IAU_WarmStart.yaml
R078	scenarios/testinput/3dvar_O30kmIE60km_ColdStart.yaml	test/testinput/3dvar_O30kmIE60km_ColdStart.yaml
A	test/testinput/3dvar_OIE120km_ColdStart.yaml
A	test/testinput/3dvar_OIE120km_WarmStart.yaml
R064	scenarios/testinput/eda_OIE120km_WarmStart.yaml	test/testinput/eda_OIE120km_WarmStart.yaml
A	test/testinput/test.yaml
A	tools/dateFormats.py
D	unit-tests/DriveTest.csh
D	unit-tests/TestConda.csh
  • Loading branch information
JJ Guerrette authored Apr 3, 2023
1 parent 20c31b8 commit 91c739f
Show file tree
Hide file tree
Showing 203 changed files with 7,384 additions and 5,728 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Closes #(if applicable)

### Tests completed
- [ ] 3dvar_OIE120km_WarmStart
- [ ] 3denvar_OIE120km_WarmStart
- [ ] 3denvar_OIE120km_IAU_WarmStart
- [ ] 3dvar_OIE120km_ColdStart
- [ ] 3dvar_O30kmIE60km_ColdStart
- [ ] 3denvar_O30kmIE60km_WarmStart
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ignore these files anywhere in the tree
include/variables/auto/*.rc
include/tasks/auto/*.rc
include/dependencies/auto/*.rc

config/auto/*.csh
suite.rc

~*

58 changes: 0 additions & 58 deletions AppAndVerify.csh

This file was deleted.

72 changes: 0 additions & 72 deletions CleanHofX.csh

This file was deleted.

68 changes: 0 additions & 68 deletions LinkExternalAnalysis.csh

This file was deleted.

23 changes: 23 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
`MPAS-Workflow` is provided by NCAR/MMM as an example for carrying out DA and non-DA
workflows with MPAS and JEDI-MPAS. The contributors have provided any of the following:
- GitHub pull requests and/or review
- data
- shell scripts used by workflow tasks
- workflow design
- source code
- other critical consultation

Contributors:
- Maryam Abdi-Oskouei
- Junmei Ban
- Ivette Hernandez Banos
- Jamie Bresch
- JJ Guerrette
- Soyoung Ha
- BJ Jung
- Zhiquan Liu
- Chris Snyder
- Craig Schwartz
- Steven Vahl
- Yali Wu
- Yonggang Yu
19 changes: 0 additions & 19 deletions PrepRTPP.csh

This file was deleted.

Loading

0 comments on commit 91c739f

Please sign in to comment.