Skip to content

Commit

Permalink
Merge branch 'rljacob/cime/fix-mpas-starchive' (PR #1334)
Browse files Browse the repository at this point in the history
Allow the case.st_archive script to work with mpaso and mpascice history and restart files.

Also should work with mpasli but not tested.

From the case directory, executing ./case.st_archive should move all history and restart files to the short term archive for all ACME components.

Fixes #1305
S2-131 #close
[BFB]

* rljacob/cime/fix-mpas-starchive:
  fix mpas pattern matching so only interim restart files are deleted
  Add ability to archive MPAS land ice files
  Add ability to handle mpas files
  Change regex for mpaso and mpascice files
  • Loading branch information
rljacob committed May 2, 2017
2 parents d380f3b + 8bbd3c4 commit d359b1f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cime/config/acme/config_archive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<comp_archive_spec compname="mpascice" compclass="ice">
<rest_file_extension>\.rst.*</rest_file_extension>
<hist_file_extension>\.hist.*</hist_file_extension>
<hist_file_extension>\.hist.*\.*\.*\.nc</hist_file_extension>
<rest_history_varname>unset</rest_history_varname>
<rpointer>
<rpointer_file>rpointer.ice</rpointer_file>
Expand Down Expand Up @@ -113,7 +113,7 @@

<comp_archive_spec compname="mpaso" compclass="ocn">
<rest_file_extension>\.rst.*</rest_file_extension>
<hist_file_extension>\.hist.*</hist_file_extension>
<hist_file_extension>\.hist.*\.*\.*\.nc</hist_file_extension>
<rest_history_varname>unset</rest_history_varname>
<rpointer>
<rpointer_file>rpointer.ocn</rpointer_file>
Expand Down
31 changes: 19 additions & 12 deletions cime/scripts/lib/CIME/case_st_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def _archive_history_files(case, archive, archive_entry,
for i in range(ninst):
if compname == 'dart':
newsuffix = casename + suffix
elif compname.find('mpas') == 0:
newsuffix = compname + '.*' + suffix
else:
if ninst_string:
newsuffix = casename + '.' + compname + ".*" + ninst_string[i] + suffix
Expand Down Expand Up @@ -230,22 +232,27 @@ def _archive_restarts(case, archive, archive_entry,
for suffix in archive.get_rest_file_extensions(archive_entry):
for i in range(ninst):
restfiles = ""
pattern = r"%s\.%s\d*.*" % (casename, compname)
if pattern != "dart":
if compname.find("mpas") == 0:
pattern = compname + suffix + '_'.join(datename.rsplit('-', 1))
pfile = re.compile(pattern)
files = [f for f in os.listdir(rundir) if pfile.search(f)]
if ninst_strings:
pattern = ninst_strings[i] + suffix + datename
restfiles = [f for f in os.listdir(rundir) if pfile.search(f)]
else:
pattern = r"%s\.%s\d*.*" % (casename, compname)
if pattern != "dart":
pfile = re.compile(pattern)
restfiles = [f for f in files if pfile.search(f)]
files = [f for f in os.listdir(rundir) if pfile.search(f)]
if ninst_strings:
pattern = ninst_strings[i] + suffix + datename
pfile = re.compile(pattern)
restfiles = [f for f in files if pfile.search(f)]
else:
pattern = suffix + datename
pfile = re.compile(pattern)
restfiles = [f for f in files if pfile.search(f)]
else:
pattern = suffix + datename
pattern = suffix
pfile = re.compile(pattern)
restfiles = [f for f in files if pfile.search(f)]
else:
pattern = suffix
pfile = re.compile(pattern)
restfiles = [f for f in os.listdir(rundir) if pfile.search(f)]
restfiles = [f for f in os.listdir(rundir) if pfile.search(f)]

for restfile in restfiles:
restfile = os.path.basename(restfile)
Expand Down

0 comments on commit d359b1f

Please sign in to comment.