Skip to content

Instantly share code, notes, and snippets.

@douglatornell
Created July 22, 2014 16:50
Show Gist options
  • Save douglatornell/df31234485c822fc82da to your computer and use it in GitHub Desktop.
Save douglatornell/df31234485c822fc82da to your computer and use it in GitHub Desktop.
Example of a script to execute a series of Salish Sea NEMO model runs.
"""Example script to define and execute a series of Salish Sea NEMO model runs.
"""
from __future__ import absolute_import
import os
import salishsea_cmd.api
def main():
run_desc = base_run_description()
runs = ('RC_amp', 'RC_pha', 'RC_both')
for run_id in runs:
do_run(run_id, run_desc)
def do_run(run_id, run_desc):
run_desc['run_id'] = run_id
run_desc['namelists'][3] = (
'Recenter_M2_amp_phase/mynamelist.lateral.{}'.format(run_id))
salishsea_cmd.api.run_in_subprocess(
run_id,
run_desc,
'iodef_tides.xml',
os.path.join('/home/sallen/MEOPAR/SalishSea/', run_id))
def base_run_description():
# Relative paths from SS-run-sets/SalishSea/tides/Recenter_M2_amp_phase/
run_desc = salishsea_cmd.api.run_description(
walltime='2:30:00',
NEMO_code='../../../NEMO-code/',
forcing='../../../NEMO-forcing/',
runs_dir='../../../SalishSea/',
init_conditions=(
'/home/dlatorne/MEOPAR/SalishSea/spin-up/'
'11apr20apr/SalishSea_01529280_restart.nc'),
)
run_desc['email'] = '[email protected]'
# Relative paths to namelist section files
run_desc['namelists'] = [
'mynamelist.time.21apr25apr',
'../namelist.domain',
'mynamelist.surface',
'mynamelist.lateral',
'../namelist.bottom',
'../namelist.tracers',
'mynamelist.dynamics.15N',
'../namelist.compute.12x27',
]
return run_desc
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment