-
Notifications
You must be signed in to change notification settings - Fork 217
Description
The regex patterns for matching history/restart files for archiving are partial hard-coded. Updates require PRs like #4788 to be made when the naming changes. We should update these patterns to be fully definable in config_archive.xml
.
Line 142 in 2343dba
string = model + r"\d?_?(\d{4})?\." + ext Line 253 in 2343dba
full_regex_str = model + r"\d?_?(\d{4})?\.(" + ext_regex + r")[-\w\.]*"
This would also be a good opportunity to refactor case_st_archive.py
, some of this code belongs in CIME/XML/archive_base.py
and CIME/XML/archive.py
. There's also a bit of component specific code that should be moved out into config_archive.xml
.
cime/CIME/case/case_st_archive.py
Lines 320 to 326 in c63fd0b
if compname == "nemo": archive_rblddir = os.path.join(dout_s_root, compclass, "rebuild") if not os.path.exists(archive_rblddir): os.makedirs(archive_rblddir) logger.debug("created directory {}".format(archive_rblddir)) sfxrbld = r"mesh_mask_" + r"[0-9]*" cime/CIME/case/case_st_archive.py
Lines 576 to 591 in c63fd0b
if compname.find("mpas") == 0 or compname == "mali": pattern = ( casename + r"\." + compname + r"\." + suffix + r"\." + "_".join(datename_str.rsplit("-", 1)) ) pfile = re.compile(pattern) restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] elif compname == "nemo": pattern = r"_*_" + suffix + r"[0-9]*" pfile = re.compile(pattern) restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] cime/CIME/case/case_st_archive.py
Lines 686 to 697 in c63fd0b
if compname == "nemo": flist = glob.glob(rundir + "/" + casename + "_*_restart*.nc") logger.debug("nemo restart file {}".format(flist)) if len(flist) > 2: flist0 = glob.glob( rundir + "/" + casename + "_*_restart_0000.nc" ) if len(flist0) > 1: rstfl01 = flist0[0] rstfl01spl = rstfl01.split("/") logger.debug("splitted name {}".format(rstfl01spl)) rstfl01nm = rstfl01spl[-1]