Skip to content

Commit

Permalink
Only copy cycled ICs if specified (#626)
Browse files Browse the repository at this point in the history
* Only copy cycled ICs if specified

In cycled mode when --icsdir was not specified, setup would create
a bunch of links to the default location, $HOME, inside of $COMROT.
Since most people don't keep initial conditions there, this resulted
in a bunch of dead links. This may also cause problems when people
go to stage their ICs from elsewhere, as they may get written to
$HOME via the links and on most HPC $HOME space is very limited.

Now the default is changed back to None, and links are only created
if a value is specified. Dead links will still be created if the
target does not exist, but at least users will not unwittingly be
creating them.

Refs: #537

* Change cycled IC links INPUT to RESTART

Changes the links created for cycled ICs from INPUT to RESTART.

Refs: #536
  • Loading branch information
WalterKolczynski-NOAA authored Feb 2, 2022
1 parent 1bbd0d8 commit b7dfd82
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions ush/rocoto/setup_expt.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,25 @@ def fill_COMROT_cycled(host, inputs):
idatestr = inputs.idate.strftime('%Y%m%d%H')
comrot = os.path.join(inputs.comrot, inputs.pslot)

# Link ensemble member initial conditions
enkfdir = f'enkf{inputs.cdump}.{idatestr[:8]}/{idatestr[8:]}'
makedirs_if_missing(os.path.join(comrot, enkfdir))
for ii in range(1, inputs.nens + 1):
makedirs_if_missing(os.path.join(comrot, enkfdir, f'mem{ii:03d}'))
os.symlink(os.path.join(inputs.icsdir, idatestr, f'C{inputs.resens}', f'mem{ii:03d}', 'INPUT'),
os.path.join(comrot, enkfdir, f'mem{ii:03d}', 'INPUT'))

# Link deterministic initial conditions
detdir = f'{inputs.cdump}.{idatestr[:8]}/{idatestr[8:]}'
makedirs_if_missing(os.path.join(comrot, detdir))
os.symlink(os.path.join(inputs.icsdir, idatestr, f'C{inputs.resdet}', 'control', 'INPUT'),
os.path.join(comrot, detdir, 'INPUT'))

# Link bias correction and radiance diagnostics files
for fname in ['abias', 'abias_pc', 'abias_air', 'radstat']:
os.symlink(os.path.join(inputs.icsdir, idatestr, f'{inputs.cdump}.t{idatestr[8:]}z.{fname}'),
os.path.join(comrot, detdir, f'{inputs.cdump}.t{idatestr[8:]}z.{fname}'))
if inputs.icsdir is not None:
# Link ensemble member initial conditions
enkfdir = f'enkf{inputs.cdump}.{idatestr[:8]}/{idatestr[8:]}'
makedirs_if_missing(os.path.join(comrot, enkfdir))
for ii in range(1, inputs.nens + 1):
makedirs_if_missing(os.path.join(comrot, enkfdir, f'mem{ii:03d}'))
os.symlink(os.path.join(inputs.icsdir, idatestr, f'C{inputs.resens}', f'mem{ii:03d}', 'RESTART'),
os.path.join(comrot, enkfdir, f'mem{ii:03d}', 'RESTART'))

# Link deterministic initial conditions
detdir = f'{inputs.cdump}.{idatestr[:8]}/{idatestr[8:]}'
makedirs_if_missing(os.path.join(comrot, detdir))
os.symlink(os.path.join(inputs.icsdir, idatestr, f'C{inputs.resdet}', 'control', 'RESTART'),
os.path.join(comrot, detdir, 'RESTART'))

# Link bias correction and radiance diagnostics files
for fname in ['abias', 'abias_pc', 'abias_air', 'radstat']:
os.symlink(os.path.join(inputs.icsdir, idatestr, f'{inputs.cdump}.t{idatestr[8:]}z.{fname}'),
os.path.join(comrot, detdir, f'{inputs.cdump}.t{idatestr[8:]}z.{fname}'))

return

Expand Down Expand Up @@ -206,7 +207,7 @@ def input_args():
type=str, required=False, default=os.getenv('HOME'))
subp.add_argument('--idate', help='starting date of experiment, initial conditions must exist!', required=True, type=lambda dd: datetime.strptime(dd, '%Y%m%d%H'))
subp.add_argument('--edate', help='end date experiment', required=True, type=lambda dd: datetime.strptime(dd, '%Y%m%d%H'))
subp.add_argument('--icsdir', help='full path to initial condition directory', type=str, required=False, default=os.getenv('HOME'))
subp.add_argument('--icsdir', help='full path to initial condition directory', type=str, required=False, default=None)
subp.add_argument('--configdir', help='full path to directory containing the config files',
type=str, required=False, default=os.path.join(top,'parm/config'))
subp.add_argument('--cdump', help='CDUMP to start the experiment',
Expand Down

0 comments on commit b7dfd82

Please sign in to comment.