-
Notifications
You must be signed in to change notification settings - Fork 15
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
ILAMB task revision #230
Merged
Merged
ILAMB task revision #230
Changes from 2 commits
Commits
Show all changes
3 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 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 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 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 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 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,100 @@ | ||
import os | ||
import pprint | ||
|
||
import jinja2 | ||
|
||
from zppy.utils import checkStatus, getTasks, getYears, submitScript | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
def ilamb_run(config, scriptDir): | ||
|
||
# Initialize jinja2 template engine | ||
templateLoader = jinja2.FileSystemLoader( | ||
searchpath=config["default"]["templateDir"] | ||
) | ||
templateEnv = jinja2.Environment(loader=templateLoader) | ||
template = templateEnv.get_template("ilamb_run.bash") | ||
|
||
# --- List of ilamb_run tasks --- | ||
tasks = getTasks(config, "ilamb_run") | ||
if len(tasks) == 0: | ||
return | ||
|
||
# --- Generate and submit ilamb_run scripts --- | ||
dependencies = [] | ||
|
||
for c in tasks: | ||
|
||
if "ts_num_years" in c.keys(): | ||
c["ts_num_years"] = int(c["ts_num_years"]) | ||
|
||
# Loop over year sets | ||
year_sets = getYears(c["years"]) | ||
for s in year_sets: | ||
c["year1"] = s[0] | ||
c["year2"] = s[1] | ||
c["scriptDir"] = scriptDir | ||
if c["subsection"]: | ||
c["sub"] = c["subsection"] | ||
else: | ||
c["sub"] = c["grid"] | ||
|
||
# List of dependencies | ||
dependencies.append( | ||
os.path.join( | ||
scriptDir, | ||
"ts_%s_%04d-%04d-%04d.status" | ||
% ( | ||
c["ts_land_subsection"], | ||
c["year1"], | ||
c["year2"], | ||
c["ts_num_years"], | ||
), | ||
), | ||
) | ||
if not c["land_only"]: | ||
dependencies.append( | ||
os.path.join( | ||
scriptDir, | ||
"ts_%s_%04d-%04d-%04d.status" | ||
% ( | ||
c["ts_atm_subsection"], | ||
c["year1"], | ||
c["year2"], | ||
c["ts_num_years"], | ||
), | ||
), | ||
) | ||
|
||
prefix = "ilamb_run_%04d-%04d" % ( | ||
c["year1"], | ||
c["year2"], | ||
) | ||
c["prefix"] = prefix | ||
print(prefix) | ||
scriptFile = os.path.join(scriptDir, "%s.bash" % (prefix)) | ||
statusFile = os.path.join(scriptDir, "%s.status" % (prefix)) | ||
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix)) | ||
skip = checkStatus(statusFile) | ||
if skip: | ||
continue | ||
|
||
# Create script | ||
with open(scriptFile, "w") as f: | ||
f.write(template.render(**c)) | ||
|
||
with open(settingsFile, "w") as sf: | ||
p = pprint.PrettyPrinter(indent=2, stream=sf) | ||
p.pprint(c) | ||
p.pprint(s) | ||
|
||
if not c["dry_run"]: | ||
# Submit job | ||
# Note --export=All is needed to make sure the executable is copied and executed on the nodes. | ||
jobid = submitScript(scriptFile, dependFiles=dependencies, export="ALL") | ||
|
||
if jobid != -1: | ||
# Update status file | ||
with open(statusFile, "w") as f: | ||
f.write("WAITING %d\n" % (jobid)) |
This file contains 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 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,107 @@ | ||
{ | ||
"#note_source_type": "explanation of what source_type is goes here", | ||
|
||
"source_type": "AOGCM AER", | ||
|
||
"#note_experiment_id": "CMIP6 valid experiment_ids are found in CMIP6_CV.json", | ||
|
||
"experiment_id": "piControl", | ||
|
||
"activity_id": "CMIP", | ||
|
||
"sub_experiment_id": "none", | ||
|
||
"realization_index": "1", | ||
|
||
"initialization_index": "1", | ||
|
||
"physics_index": "1", | ||
|
||
"forcing_index": "1", | ||
|
||
"#note_run_variant": "Text stored in attribute variant_info (recommended, not required description of run variant)", | ||
|
||
"run_variant": "", | ||
|
||
"parent_experiment_id": "piControl-spinup", | ||
|
||
"parent_activity_id": "CMIP", | ||
|
||
"parent_source_id": "E3SM-1-0", | ||
|
||
"parent_variant_label": "r1i1p1f1", | ||
|
||
"parent_time_units": "days since 0001-01-01", | ||
|
||
"branch_method": "standard", | ||
|
||
"branch_time_in_child": 0.0, | ||
|
||
"branch_time_in_parent": 0.0, | ||
|
||
"#note_institution_id": "institution_id must be registered at https://github.com/WCRP-CMIP/CMIP6_CVs/issues/new ", | ||
|
||
"institution_id": "E3SM-Project", | ||
|
||
"#note_source_id": "source_id (model name) must be registered at https://github.com/WCRP-CMIP/CMIP6_CVs/issues/new ", | ||
|
||
"source_id": "E3SM-1-0", | ||
|
||
"calendar": "noleap", | ||
|
||
"grid": "data regridded to a CMIP6 standard 1x1 degree lonxlat grid from the native grid using an area-average preserving method.", | ||
|
||
"grid_label": "gr", | ||
|
||
"nominal_resolution": "100 km", | ||
|
||
"license": "CMIP6 model data produced by E3SM is licensed under a Creative Commons Attribution ShareAlike 4.0 International License (https://creativecommons.org/licenses). Consult https://pcmdi.llnl.gov/CMIP6/TermsOfUse for terms of use governing CMIP6 output, including citation requirements and proper acknowledgment. Further information about this data, including some limitations, can be found via the further_info_url (recorded as a global attribute in this file) and at https:///pcmdi.llnl.gov/. The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law.", | ||
|
||
"#output": "Root directory for output (can be either a relative or full path)", | ||
|
||
"outpath": "CMIP6", | ||
|
||
"#note_optional": " **** The following descriptors are optional and may be set to an empty string ", | ||
|
||
"project PI": "Dave Bader ([email protected])", | ||
|
||
"data contact": "[email protected]", | ||
|
||
"history": "Output from 20180129.DECKv1b_piControl.ne30_oEC.edison. compset = A_WCYCL1850S_CMIP6", | ||
|
||
"comment": "This is the default metadata file, any data should only be used for testing purposes", | ||
|
||
"references": "Golaz, J.-C., P. M. Caldwell, L. P. Van Roekel and co-authors, 2019: The DOE E3SM coupled model version 1: Overview and evaluation at standard resolution. JAMES, doi: 10.1029/2018MS001603; http://e3sm.org'", | ||
|
||
"#note_CV": " **** The following will be obtained from the CV and do not need to be defined here", | ||
|
||
"sub_experiment": "none", | ||
|
||
"institution": "E3SM-Project", | ||
|
||
"source": "E3SM 1.0 (2018)", | ||
|
||
"#note_CMIP6": " **** The following are set correctly for CMIP6 and should not normally need editing", | ||
|
||
"_control_vocabulary_file": "CMIP6_CV.json", | ||
|
||
"_AXIS_ENTRY_FILE": "CMIP6_coordinate.json", | ||
|
||
"_FORMULA_VAR_FILE": "CMIP6_formula_terms.json", | ||
|
||
"_cmip6_option": "CMIP6", | ||
|
||
"mip_era": "CMIP6", | ||
|
||
"parent_mip_era": "CMIP6", | ||
|
||
"tracking_prefix": "hdl:21.14100", | ||
|
||
"_history_template": "%s ;rewrote data to be consistent with <activity_id> for variable <variable_id> found in table <table_id>.", | ||
|
||
"#output_path_template": "Template for output path directory using tables keys or global attributes, these should follow the relevant data reference syntax", | ||
|
||
"output_path_template": "<mip_era><activity_id><institution_id><source_id><experiment_id><_member_id><table><variable_id><grid_label><version>", | ||
|
||
"output_file_template": "<variable_id><table><source_id><experiment_id><_member_id><grid_label>" | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be [[ atm_monthly_180x360_aave ]]? I think the logic is if ts_fmt=cmip, both nco convention time series and cmip time series are generated.
And this sub session can be both a dependency of both e3sm_diags and ilamb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it must have been some issue in debugging that made me think it required a separate subtask. It looks like it works fine using the same subtask.