-
Notifications
You must be signed in to change notification settings - Fork 62
Updates in template.cupid and config_workflow.xml for cupid workflow #210
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 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7dfbe36
very preliminary updates in template.cupid for cupid workflow
TeaganKing 9739ebf
Update template.cupid with bash += string format
TeaganKing bca903e
Update template.cupid for glc
TeaganKing 3308bd2
Update template.cupid in response to Bill's review
TeaganKing 6cb38e1
Update template.cupid to move if postprocessing
TeaganKing f3f6f55
Update template.cupid - logic fix for all components flag
TeaganKing 615153d
Update template.cupid to include new arguments for generate_cupid_con…
TeaganKing 9268ab1
Update template.cupid to use cupid example directory rather than PWD
TeaganKing 1d0783a
Updates to CUPiD workflow
mnlevy1981 cc9b543
Update template.cupid to include ADF xml var
TeaganKing c99f044
Update template.cupid in response to Bill's review
TeaganKing 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
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 |
|---|---|---|
| @@ -1,5 +1,16 @@ | ||
| #!/bin/bash -e | ||
|
|
||
| # Function to add some number of years to a string that | ||
| # is formatted as YYYY-MM-DD and print out the updated | ||
| # string in the same format | ||
| add_years() { | ||
| YEAR=`echo $1 | cut -d '-' -f 1` | ||
| MM=`echo $1 | cut -d '-' -f 2` | ||
| DD=`echo $1 | cut -d '-' -f 3` | ||
| NEW_YEAR=`printf '%04d' "$((YEAR + $2))"`-`printf '%02d' "${MM}"`-`printf '%02d' "${DD}"` | ||
| echo $NEW_YEAR | ||
| } | ||
|
|
||
| # Batch system directives | ||
| {{ batchdirectives }} | ||
|
|
||
|
|
@@ -11,37 +22,108 @@ source .env_mach_specific.sh | |
| # by setting $PYTHONPATH; since this is conda-based we | ||
| # want an empty PYTHONPATH environment variable | ||
| MACH=`./xmlquery --value MACH` | ||
| unset PYTHONPATH | ||
| conda activate cupid-infrastructure | ||
|
|
||
| # Set variables that should eventually come from environment file | ||
| CUPID_EXAMPLE=key_metrics | ||
| RUN_CUPID_ANALYSIS=TRUE | ||
| RUN_CUPID_TIMESERIES=TRUE | ||
|
|
||
| if [ "${RUN_CUPID_ANALYSIS}" == "TRUE" ]; then | ||
| # 1. Generate CUPiD config file | ||
| {{ srcroot }}/tools/CUPiD/helper_scripts/generate_cupid_config_for_cesm_case.py \ | ||
| --cesm-root {{ SRCROOT }} | ||
|
|
||
| # 2. Generate ADF config file | ||
| {{ srcroot }}/tools/CUPiD/helper_scripts/generate_adf_config_file.py \ | ||
| --cesm-root {{ SRCROOT }} \ | ||
| --cupid-config-loc ${PWD} \ | ||
| --adf-template {{ SRCROOT }}/tools/CUPiD/externals/ADF/config_amwg_default_plots.yaml \ | ||
| --out-file adf_config.yml | ||
|
|
||
| # 3. Generate timeseries files and run ADF | ||
| if [ "${RUN_CUPID_TIMESERIES}" == "TRUE" ]; then | ||
| {{ srcroot }}/tools/CUPiD/cupid/run_timeseries.py | ||
|
|
||
| # Set variables that come from environment file | ||
| CUPID_EXAMPLE=`./xmlquery --value CUPID_EXAMPLE` | ||
| CUPID_GEN_TIMESERIES=`./xmlquery --value CUPID_GEN_TIMESERIES` | ||
| CUPID_GEN_DIAGNOSTICS=`./xmlquery --value CUPID_GEN_DIAGNOSTICS` | ||
| CUPID_GEN_HTML=`./xmlquery --value CUPID_GEN_HTML` | ||
| CUPID_BASELINE_CASE=`./xmlquery --value CUPID_BASELINE_CASE` | ||
| CUPID_BASELINE_ROOT=`./xmlquery --value CUPID_BASELINE_ROOT` | ||
| CUPID_START_YEAR=`./xmlquery --value CUPID_START_YEAR` | ||
| CUPID_NYEARS=`./xmlquery --value CUPID_NYEARS` | ||
| CUPID_END_YEAR=`add_years $CUPID_START_YEAR $CUPID_NYEARS` | ||
| CUPID_BASE_START_YEAR=`./xmlquery --value CUPID_BASE_START_YEAR` | ||
| CUPID_BASE_NYEARS=`./xmlquery --value CUPID_BASE_NYEARS` | ||
| CUPID_BASE_END_YEAR=`add_years $CUPID_BASE_START_YEAR $CUPID_BASE_NYEARS` | ||
| CUPID_RUN_ALL=`./xmlquery --value CUPID_RUN_ALL` | ||
| CUPID_RUN_ATM=`./xmlquery --value CUPID_RUN_ATM` | ||
| CUPID_RUN_OCN=`./xmlquery --value CUPID_RUN_OCN` | ||
| CUPID_RUN_LND=`./xmlquery --value CUPID_RUN_LND` | ||
| CUPID_RUN_ICE=`./xmlquery --value CUPID_RUN_ICE` | ||
| CUPID_RUN_ROF=`./xmlquery --value CUPID_RUN_ROF` | ||
| CUPID_RUN_GLC=`./xmlquery --value CUPID_RUN_GLC` | ||
| CUPID_RUN_ADF=`./xmlquery --value CUPID_RUN_ADF` | ||
| CUPID_INFRASTRUCTURE_ENV=`./xmlquery --value CUPID_INFRASTRUCTURE_ENV` | ||
| CUPID_ANALYSIS_ENV=`./xmlquery --value CUPID_ANALYSIS_ENV` | ||
|
|
||
| # Create directory for running CUPiD | ||
| mkdir -p cupid-postprocessing | ||
| cd cupid-postprocessing | ||
|
|
||
| # If CUPID_RUN_ALL is TRUE, we don't add any component flags. | ||
| # The lack of any component flags tells CUPiD to run all components. | ||
| CUPID_FLAG_STRING="" | ||
| if [ "${CUPID_RUN_ALL}" == "FALSE" ]; then | ||
| if [ "${CUPID_RUN_ATM}" == "TRUE" ]; then | ||
| CUPID_FLAG_STRING+=" --atm" | ||
| fi | ||
| if [ "${CUPID_RUN_OCN}" == "TRUE" ]; then | ||
| CUPID_FLAG_STRING+=" --ocn" | ||
| fi | ||
| if [ "${CUPID_RUN_LND}" == "TRUE" ]; then | ||
| CUPID_FLAG_STRING+=" --lnd" | ||
| fi | ||
| if [ "${CUPID_RUN_ICE}" == "TRUE" ]; then | ||
| CUPID_FLAG_STRING+=" --ice" | ||
| fi | ||
| if [ "${CUPID_RUN_ROF}" == "TRUE" ]; then | ||
| CUPID_FLAG_STRING+=" --rof" | ||
| fi | ||
| if [ "${CUPID_RUN_GLC}" == "TRUE" ]; then | ||
| CUPID_FLAG_STRING+=" --glc" | ||
| fi | ||
| if [ "${CUPID_FLAG_STRING}" == "" ]; then | ||
| echo "If CUPID_RUN_ALL is False, user must set at least one component" | ||
| exit 1 | ||
| fi | ||
| fi | ||
| if [ "${CUPID_RUN_ALL}" == "TRUE" ]; then | ||
| echo "CUPID_RUN_ALL is True, running diagnostics for all components" | ||
| fi | ||
|
|
||
| unset PYTHONPATH | ||
| conda activate $CUPID_INFRASTRUCTURE_ENV | ||
|
|
||
| # 1. Generate CUPiD config file | ||
| {{ SRCROOT }}/tools/CUPiD/helper_scripts/generate_cupid_config_for_cesm_case.py \ | ||
| --cesm-root {{ SRCROOT }} \ | ||
| --case-root {{ CASEROOT }} \ | ||
| --cupid-example $CUPID_EXAMPLE \ | ||
| --cupid-baseline-case $CUPID_BASELINE_CASE \ | ||
| --cupid-baseline-root $CUPID_BASELINE_ROOT \ | ||
| --cupid-start-year $CUPID_START_YEAR \ | ||
| --cupid-end-year $CUPID_END_YEAR \ | ||
| --cupid-base-start-year $CUPID_BASE_START_YEAR \ | ||
| --cupid-base-end-year $CUPID_BASE_END_YEAR \ | ||
|
|
||
| # 2. Generate ADF config file | ||
| if [ "${CUPID_RUN_ADF}" == "TRUE" ]; then | ||
| {{ SRCROOT }}/tools/CUPiD/helper_scripts/generate_adf_config_file.py \ | ||
| --cesm-root {{ SRCROOT }} \ | ||
| --cupid-config-loc {{ SRCROOT }}/tools/CUPiD/examples/{{ CUPID_EXAMPLE }} \ | ||
|
||
| --adf-template {{ SRCROOT }}/tools/CUPiD/externals/ADF/config_amwg_default_plots.yaml \ | ||
| --out-file adf_config.yml | ||
| fi | ||
|
|
||
| # 3. Generate timeseries files | ||
| if [ "${CUPID_GEN_TIMESERIES}" == "TRUE" ]; then | ||
| {{ SRCROOT }}/tools/CUPiD/cupid/run_timeseries.py $CUPID_FLAG_STRING | ||
| fi | ||
|
|
||
| #4. Run ADF | ||
| if [ "${CUPID_RUN_ADF}" == "TRUE" ]; then | ||
| conda deactivate | ||
| conda activate cupid-analysis | ||
| conda activate $CUPID_ANALYSIS_ENV | ||
| {{ SRCROOT }}/tools/CUPiD/externals/ADF/run_adf_diag adf_config.yml | ||
| fi | ||
|
|
||
| # 4. Run CUPiD and build webpage | ||
| conda deactivate | ||
| conda activate cupid-infrastructure | ||
| {{ srcroot }}/tools/CUPiD/cupid/run_diagnostics.py | ||
| {{ srcroot }}/tools/CUPiD/cupid/cupid_webpage.py | ||
| # 5. Run CUPiD and build webpage | ||
| conda deactivate | ||
| conda activate $CUPID_INFRASTRUCTURE_ENV | ||
| if [ "${CUPID_GEN_DIAGNOSTICS}" == "TRUE" ]; then | ||
| {{ SRCROOT }}/tools/CUPiD/cupid/run_diagnostics.py $CUPID_FLAG_STRING | ||
| fi | ||
| if [ "${CUPID_GEN_HTML}" == "TRUE" ]; then | ||
| {{ SRCROOT }}/tools/CUPiD/cupid/cupid_webpage.py | ||
| fi | ||
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.