def compile_pre(environ, **kwargs): with prefix(fmt('source {envconf}', environ)): if environ.get('gengrid_run_this_module', False): with shell_env(environ, keys=[ 'root', 'platform', 'mkmf_template', 'executable_gengrid' ]): with cd(fmt('{execdir}/gengrid', environ)): run(fmt('/usr/bin/tcsh {gengrid_makeconf}', environ)) if environ.get('regrid_3d_run_this_module', False): with shell_env( environ, keys=['root', 'mkmf_template', 'executable_regrid_3d']): with cd(fmt('{execdir}/regrid_3d', environ)): run(fmt('/usr/bin/tcsh {regrid_3d_makeconf}', environ)) if environ.get('regrid_2d_run_this_module', False): with shell_env( environ, keys=['root', 'mkmf_template', 'executable_regrid_2d']): with cd(fmt('{execdir}/regrid_2d', environ)): run(fmt('/usr/bin/tcsh {regrid_2d_makeconf}', environ)) if environ.get('make_xgrids_run_this_module', False): with prefix(fmt('source {make_xgrids_envconf}', environ)): #run(fmt('cc -g -V -O -o {executable_make_xgrids} {make_xgrids_src} -I $NETCDF_DIR/include -L $NETCDF_DIR/lib -lnetcdf -lm -Duse_LARGEFILE -Duse_netCDF -DLARGE_FILE -Duse_libMPI', environ)) fix_MAXLOCAL_make_xgrids(environ) run( fmt( 'cc -g -V -O -o {executable_make_xgrids} {make_xgrids_src} -I $NETCDF_DIR/include -L $NETCDF_DIR/lib -lnetcdf -lm -Duse_LARGEFILE -Duse_netCDF -DLARGE_FILE', environ))
def compile_post(environ, **kwargs): with shell_env(environ, keys=['root', 'platform', 'code_dir', 'mppnccombine', 'name']): with prefix(fmt('source {envconf}', environ)): with cd(environ['comb_exe']): #run(fmt('make -f {comb_src}/Make_combine', environ)) run(fmt('cc -V -O -o {mppnccombine} -I/usr/local/include -L/usr/local/lib {code_dir}/postprocessing/mppnccombine/mppnccombine.c -lnetcdf', environ)) with shell_env(environ, keys=['workdir', 'platform', 'npes', 'mppnccombine']): with prefix(fmt('source {envconf}', environ)): with cd(environ['comb_exe']): #run(fmt('make -f {comb_src}/Make_combine', environ)) run(fmt('{expdir}/runscripts/set_mom5_pos.cray run {npes} {name}', environ))
def regrid_2d(environ, **kwargs): regrid_2d_prepare(environ) with shell_env(environ, keys=['mom4_pre_npes', 'mom4_pre_walltime', 'executable_regrid_2d', 'regrid_2d_workdir', 'regrid_2d_src_file', 'account', 'platform']): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts/mom4_pre', environ)): out = run(fmt('/usr/bin/tcsh regrid_2d_run.csh', environ))
def compile_post(environ, **kwargs): with shell_env(environ, keys=['root', 'platform']): with prefix(fmt('source {envconf}', environ)): with cd(environ['comb_exe']): run(fmt('make -f {comb_src}/Make_combine', environ)) run( fmt('cp {root}/src/shared/drifters/drifters_combine {comb_exe}/', environ))
def generate_grid(environ, **kwargs): run(fmt('cp {topog_file} {gengrid_workdir}/topog_file.nc', environ)) with shell_env( environ, keys=['mom4_pre_npes', 'mom4_pre_walltime', 'RUNTM', 'executable_gengrid', 'gengrid_workdir', 'account', 'topog_file', 'platform']): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts/mom4_pre', environ)): out = run(fmt('/usr/bin/tcsh ocean_grid_run.csh', environ))
def generate_grid(environ, **kwargs): run(fmt('cp {topog_file} {gengrid_workdir}/topog_file.nc', environ)) with shell_env( environ, keys=['mom_pre_npes', 'mom_pre_walltime', 'RUNTM', 'executable_gengrid', 'gengrid_workdir', 'account', 'topog_file', 'platform', 'queue']): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts/preprocessing', environ)): out = run(fmt('/usr/bin/tcsh ocean_grid_run.csh', environ))
def regrid_3d(environ, **kwargs): run(fmt( 'cp {regrid_3d_src_file} {regrid_3d_workdir}/src_file.nc', environ)) with shell_env(environ, keys=['mom4_pre_npes', 'mom4_pre_walltime', 'executable_regrid_3d', 'regrid_3d_workdir', 'regrid_3d_dest_grid', 'regrid_3d_output_filename', 'account', 'platform']): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts/mom4_pre', environ)): out = run(fmt('/usr/bin/tcsh regrid_3d_run.csh', environ))
def compile_pre(environ, **kwargs): with prefix(fmt('source {envconf}', environ)): if environ.get('gengrid_run_this_module', False): with shell_env(environ, keys=['root', 'platform', 'mkmf_template', 'executable_gengrid']): with cd(fmt('{execdir}/gengrid', environ)): run(fmt('/usr/bin/tcsh {gengrid_makeconf}', environ)) if environ.get('regrid_3d_run_this_module', False): with shell_env(environ, keys=['root', 'mkmf_template', 'executable_regrid_3d']): with cd(fmt('{execdir}/regrid_3d', environ)): run(fmt('/usr/bin/tcsh {regrid_3d_makeconf}', environ)) if environ.get('regrid_2d_run_this_module', False): with shell_env(environ, keys=['root', 'mkmf_template', 'executable_regrid_2d']): with cd(fmt('{execdir}/regrid_2d', environ)): run(fmt('/usr/bin/tcsh {regrid_2d_makeconf}', environ)) if environ.get('make_xgrids_run_this_module', False): with prefix(fmt('source {make_xgrids_envconf}', environ)): #run(fmt('cc -g -V -O -o {executable_make_xgrids} {make_xgrids_src} -I $NETCDF_DIR/include -L $NETCDF_DIR/lib -lnetcdf -lm -Duse_LARGEFILE -Duse_netCDF -DLARGE_FILE -Duse_libMPI', environ)) fix_MAXLOCAL_make_xgrids(environ) run(fmt('cc -g -V -O -o {executable_make_xgrids} {make_xgrids_src} -I $NETCDF_DIR/include -L $NETCDF_DIR/lib -lnetcdf -lm -Duse_LARGEFILE -Duse_netCDF -DLARGE_FILE', environ))
def prepare_inputs(environ, **kwargs): #TODO: copy data to pre/datain (look at oper experiment) with cd(fmt('pre_atmos/scripts', environ)): fix_atmos_runpre(environ) envvars = { 'dirhome': fmt('{pre_atmos}', environ), 'dirdata': fmt('{rootexp}/AGCM-1.0', environ), 'direxe': fmt('{execdir}', environ) } with shell_env(envvars): run(fmt('bash/runAll.bash', environ))
def run_model(environ, **kwargs): ''' Submits coupled model Used vars: workdir platform walltime datatable diagtable fieldtable executable execdir TRC LV rootexp mppnccombine comb_exe envconf expdir mode start restart finish npes name JobID_model Depends on: None ''' print(fc.yellow('Submitting coupled model')) trunc = "%04d" % environ['TRC'] lev = "%03d" % environ['LV'] env_vars = environ.copy() env_vars.update({'TRUNC': trunc, 'LEV': lev}) keys = [ 'workdir', 'platform', 'walltime', 'datatable', 'diagtable', 'fieldtable', 'executable', 'execdir', 'TRUNC', 'LEV', 'LV', 'rootexp', 'mppnccombine', 'comb_exe', 'account', 'DHEXT' ] with shell_env(env_vars, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts', environ)): output = run( fmt( '. run_g4c_model.cray {mode} {start} ' '{restart} {finish} {npes} {name}', environ)) environ['JobID_model'] = re.search(".*JobIDmodel:\s*(.*)\s*", output).groups()[0]
def compile_pre(environ, **kwargs): with prefix(fmt('source {envconf}', environ)): if environ.get('gengrid_run_this_module', False): with shell_env(environ, keys=['root', 'platform', 'mkmfTemplate', 'executable_gengrid']): with cd(fmt('{execdir}/gengrid', environ)): run(fmt('/usr/bin/tcsh {gengrid_makeconf}', environ)) if environ.get('regrid_3d_run_this_module', False): with shell_env(environ, keys=['root', 'mkmfTemplate', 'executable_regrid_3d']): with cd(fmt('{execdir}/regrid_3d', environ)): run(fmt('/usr/bin/tcsh {regrid_3d_makeconf}', environ)) if environ.get('regrid_2d_run_this_module', False): with shell_env(environ, keys=['root', 'mkmfTemplate', 'executable_regrid_2d']): with cd(fmt('{execdir}/regrid_2d', environ)): run(fmt('/usr/bin/tcsh {regrid_2d_makeconf}', environ)) # Gui 20140219 # I know it's a one line code deal, but is it the best way to do to # compile the xgrids here? To keep consistency, shouldn't it be # at make_xgrid_compile.csh? if environ.get('make_xgrids_run_this_module', False): with prefix(fmt('source {make_xgrids_envconf}', environ)): #run(fmt('cc -g -V -O -o {executable_make_xgrids} {make_xgrids_src} -I $NETCDF_DIR/include -L $NETCDF_DIR/lib -lnetcdf -lm -Duse_LARGEFILE -Duse_netCDF -DLARGE_FILE -Duse_libMPI', environ)) fix_MAXLOCAL_make_xgrids(environ) run(fmt('cc -g -V -O -o {executable_make_xgrids} {make_xgrids_src} -I $NETCDF_DIR/include -L $NETCDF_DIR/lib -lnetcdf -lm -Duse_LARGEFILE -Duse_netCDF -DLARGE_FILE', environ))
def run_model(environ, **kwargs): ''' Submits coupled model Used vars: workdir platform walltime datatable diagtable fieldtable executable execdir TRC LV rootexp mppnccombine comb_exe envconf expdir mode start restart finish npes name JobID_model Depends on: None ''' print(fc.yellow('Submitting coupled model')) trunc = "%04d" % environ['TRC'] lev = "%03d" % environ['LV'] env_vars = environ.copy() env_vars.update({'TRUNC': trunc, 'LEV': lev}) keys = ['workdir', 'platform', 'walltime', 'datatable', 'diagtable', 'fieldtable', 'executable', 'execdir', 'TRUNC', 'LEV', 'LV', 'rootexp', 'mppnccombine', 'comb_exe', 'account', 'DHEXT'] with shell_env(env_vars, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts', environ)): output = run(fmt('. run_g4c_model.cray {mode} {start} ' '{restart} {finish} {npes} {name}', environ)) environ['JobID_model'] = re.search(".*JobIDmodel:\s*(.*)\s*", output).groups()[0]
def run_model(environ, **kwargs): ''' Submits atmos model Used vars: rootexp workdir executable walltime execdir platform TRC LV envconf expdir start restart finish npes name JobID_model Depends on: None ''' print(fc.yellow('Submitting atmos model')) trunc = "%04d" % environ['TRC'] lev = "%03d" % environ['LV'] env_vars = environ.copy() env_vars.update({'TRUNC': trunc, 'LEV': lev}) keys = [ 'rootexp', 'workdir', 'TRUNC', 'LEV', 'executable', 'walltime', 'execdir', 'platform', 'LV' ] with shell_env(env_vars, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts', environ)): output = run( fmt( '. run_atmos_model.cray run {start} {restart} ' '{finish} {npes} {name}', environ)) job_id = re.search(".*JobIDmodel:\s*(.*)\s*", output).groups()[0] environ['JobID_model'] = job_id
def run_model(environ, **kwargs): ''' Submits atmos model Used vars: rootexp workdir executable walltime execdir platform TRC LV envconf expdir start restart finish npes name JobID_model Depends on: None ''' print(fc.yellow('Submitting atmos model')) trunc = "%04d" % environ['TRC'] lev = "%03d" % environ['LV'] env_vars = environ.copy() env_vars.update({'TRUNC': trunc, 'LEV': lev}) keys = ['rootexp', 'workdir', 'TRUNC', 'LEV', 'executable', 'walltime', 'execdir', 'platform', 'LV'] with shell_env(env_vars, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts', environ)): output = run(fmt('. run_atmos_model.cray run {start} {restart} ' '{finish} {npes} {name}', environ)) job_id = re.search(".*JobIDmodel:\s*(.*)\s*", output).groups()[0] environ['JobID_model'] = job_id
def compile_model(environ, **kwargs): keys = ['comp', 'code_dir', 'root', 'type', 'mkmf_template', 'executable'] with shell_env(environ, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{execdir}', environ)): run(fmt('/usr/bin/tcsh -e {cpld_makeconf}', environ))
def run_model(environ, **kwargs): ''' Submits ocean model Used vars: account queue workdir platform walltime datatable diagtable fieldtable executable execdir mppnccombine comb_exe envconf expdir mode start restart finish npes name JobID_model Depends on: None ''' print(fc.yellow('Submitting ocean model')) # Here goes a series of tests and preparations moved out from the # mom4p1_coupled_run.csh, that are better be done here. # For some reason, this line bellow is not working. The dir does exist # and this gives the error message, and do not stop here with the return. # Didn't understand. #if not exists(fmt('{workdir}/INPUT', environ)): # print(fc.yellow(fmt("Missing the {workdir}/INPUT directory!", environ))) # return #if not exists(fmt('{workdir}', environ)): # print(fc.yellow(fmt("Missing the {workdir} directory!", environ))) # run(fmt('mkdir -p {workdir}', environ)) #if not exists(fmt('{workdir}/RESTART', environ)): # print(fc.yellow(fmt("Missing the {workdir}/INPUT directory!", environ))) # run(fmt('mkdir -p {workdir}/RESTART', environ)) #if not exists(fmt('{workdir}/INPUT/grid_spec.nc', environ)): # print(fc.yellow(fmt("ERROR: required input file does not exist {workdir}/INPUT/grid_spec.nc", environ))) # return #if not exists(fmt('{workdir}/INPUT/ocean_temp_salt.res.nc', environ)): # print(fc.yellow(fmt("ERROR: required input file does not exist {workdir}/INPUT/ocean_temp_salt.res.nc", environ))) # return #run(fmt('cp {ocean_namelist} {workdir}/input.nml', environ)) #run(fmt('cp {datatable} {workdir}/data_table', environ)) #run(fmt('cp {diagtable} {workdir}/diag_table', environ)) #run(fmt('cp {fieldtable} {workdir}/field_table', environ)) keys = [ 'workdir', 'platform', 'walltime', 'datatable', 'diagtable', 'fieldtable', 'executable', 'mppnccombine', 'comb_exe', 'account', 'queue' ] with shell_env(environ, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts', environ)): if environ.get('run_drifters_pos', False): run(fmt('. set_pos_drifters.cray', environ)) output = run( fmt( '. run_g4c_model.cray {mode} {start} ' '{restart} {finish} {npes} {name}', environ)) environ['JobID_model'] = re.search(".*JobIDmodel:\s*(.*)\s*", output).groups()[0]
def compile_model(environ, **kwargs): with shell_env(environ, keys=['root', 'executable']): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{execdir}', environ)): run(fmt('make -f {atmos_makeconf}', environ))
def compile_post(environ, **kwargs): with shell_env(environ, keys=['PATH2']): with prefix(fmt('source {envconf_pos}', environ)): with cd(environ['posgrib_src']): fix_atmos_makefile() run(fmt('make cray', environ))
def compile_pre(environ, **kwargs): with shell_env(environ, keys=['PATH2']): with prefix(fmt('source {envconf_pos}', environ)): with cd(fmt('{pre_atmos}/sources', environ)): fix_atmos_makefile() run(fmt('make cray', environ))
def run_model(environ, **kwargs): ''' Submits ocean model Used vars: workdir platform walltime datatable diagtable fieldtable executable execdir mppnccombine comb_exe envconf expdir mode start restart finish npes name JobID_model Depends on: None ''' print(fc.yellow('Submitting ocean model')) # Here goes a series of tests and preparations moved out from the # mom4p1_coupled_run.csh, that are better be done here. # For some reason, this line bellow is not working. The dir does exist # and this gives the error message, and do not stop here with the return. # Didn't understand. # Probably the right way to do it is a function to check if a list of itens exists. keys = ['workdir', 'datatable', 'diagtable', 'fieldtable', 'executable', 'mppnccombine', 'comb_exe', 'account', 'queue', 'name', 'npes'] with shell_env(environ, keys=keys): if not exists(fmt('{workdir}', environ)): print(fc.yellow(fmt("Missing the {workdir} directory!", environ))) return #run(fmt('mkdir -p {workdir}', environ)) if not exists(fmt('{workdir}/INPUT', environ)): print(fc.yellow(fmt("Missing the {workdir}/INPUT directory!", environ))) return #run(fmt('mkdir -p {workdir}/INPUT', environ)) if not exists(fmt('{workdir}/RESTART', environ)): print(fc.yellow(fmt("Missing the {workdir}/RESTART directory!", environ))) #return run(fmt('mkdir -p {workdir}/RESTART', environ)) # input is copied with adjusts on some variables. Should not be copied here. #run(fmt('cp {ocean_namelist} {workdir}/input.nml', environ)) run(fmt('cp {datatable} {workdir}/data_table', environ)) run(fmt('cp {diagtable} {workdir}/diag_table', environ)) run(fmt('cp {fieldtable} {workdir}/field_table', environ)) if not exists(fmt('{workdir}/INPUT/grid_spec.nc', environ)): print(fc.yellow(fmt("ERROR: required input file does not exist {workdir}/INPUT/grid_spec.nc", environ))) return if not exists(fmt('{workdir}/INPUT/ocean_temp_salt.res.nc', environ)): print(fc.yellow(fmt("ERROR: required input file does not exist {workdir}/INPUT/ocean_temp_salt.res.nc", environ))) return for f in ['{workdir}/input.nml', '{workdir}/data_table', '{workdir}/diag_table', '{workdir}/field_table']: if not exists(fmt(f, environ)): print(fc.yellow(fmt("ERROR: required input file does not exist: %s" % f, environ))) return if not exists(fmt('{workdir}/run_mom5_pos.{platform}', environ)): print(fc.yellow(fmt("ERROR: required pos processing script does not exist {workdir}/run_mom5_pos.{platform}", environ))) return # I should consider to create the MOM_run.csh on the fly and run in the sequence. I still don't have an opinion about the best way to do it, but I don't like to use this csh script to create the effective running scrpit. We don't need to be like that. #input_file = StringIO() #get(fmt('{expdir}/runscripts/MOM_run.csh', environ), input_file) #put(fmt(input_file.getvalue(), environ), fmt('{workdir}/MOM_run.csh', environ)) #input_file.close() keys = ['workdir', 'platform', 'walltime', 'datatable', 'diagtable', 'fieldtable', 'executable', 'mppnccombine', 'comb_exe', 'account', 'queue', 'name', 'npes'] with shell_env(environ, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts', environ)): if environ.get('run_drifters_pos', False): run(fmt('. set_pos_drifters.cray', environ)) #run(fmt('module list', environ)) output = run(fmt('. MOM_run.csh', environ)) #output = run(fmt('export JobIDmodel=`qsub MOM_run.csh`; echo "JobIDmodel: ${JobIDmodel}"', environ)) #environ['JobID_model'] = re.search(".*JobIDmodel:\s*(.*)\s*", output) environ['JobID_model'] = re.search("(\d+\.eslogin\d+)", output).groups()[0]
def compile_model(environ, **kwargs): keys = ['comp', 'code_dir', 'root', 'type', 'mkmf_template', 'executable'] with shell_env(environ, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{execdir}', environ)): run(fmt('/usr/bin/tcsh {ocean_makeconf}', environ))
def compile_post(environ, **kwargs): with shell_env(environ, keys=['root', 'platform']): with prefix(fmt('source {envconf}', environ)): with cd(environ['comb_exe']): run(fmt('make -f {comb_src}/Make_combine', environ)) run(fmt('cp {root}/src/shared/drifters/drifters_combine {comb_exe}/', environ))
def run_model(environ, **kwargs): ''' Submits ocean model Used vars: account queue workdir platform walltime datatable diagtable fieldtable executable execdir mppnccombine comb_exe envconf expdir mode start restart finish npes name JobID_model Depends on: None ''' print(fc.yellow('Submitting ocean model')) # Here goes a series of tests and preparations moved out from the # mom4p1_coupled_run.csh, that are better be done here. # For some reason, this line bellow is not working. The dir does exist # and this gives the error message, and do not stop here with the return. # Didn't understand. #if not exists(fmt('{workdir}/INPUT', environ)): # print(fc.yellow(fmt("Missing the {workdir}/INPUT directory!", environ))) # return #if not exists(fmt('{workdir}', environ)): # print(fc.yellow(fmt("Missing the {workdir} directory!", environ))) # run(fmt('mkdir -p {workdir}', environ)) #if not exists(fmt('{workdir}/RESTART', environ)): # print(fc.yellow(fmt("Missing the {workdir}/INPUT directory!", environ))) # run(fmt('mkdir -p {workdir}/RESTART', environ)) #if not exists(fmt('{workdir}/INPUT/grid_spec.nc', environ)): # print(fc.yellow(fmt("ERROR: required input file does not exist {workdir}/INPUT/grid_spec.nc", environ))) # return #if not exists(fmt('{workdir}/INPUT/ocean_temp_salt.res.nc', environ)): # print(fc.yellow(fmt("ERROR: required input file does not exist {workdir}/INPUT/ocean_temp_salt.res.nc", environ))) # return #run(fmt('cp {ocean_namelist} {workdir}/input.nml', environ)) #run(fmt('cp {datatable} {workdir}/data_table', environ)) #run(fmt('cp {diagtable} {workdir}/diag_table', environ)) #run(fmt('cp {fieldtable} {workdir}/field_table', environ)) keys = ['workdir', 'platform', 'walltime', 'datatable', 'diagtable', 'fieldtable', 'executable', 'mppnccombine', 'comb_exe', 'account', 'queue'] with shell_env(environ, keys=keys): with prefix(fmt('source {envconf}', environ)): with cd(fmt('{expdir}/runscripts', environ)): if environ.get('run_drifters_pos', False): run(fmt('. set_pos_drifters.cray', environ)) output = run(fmt('. run_g4c_model.cray {mode} {start} ' '{restart} {finish} {npes} {name}', environ)) environ['JobID_model'] = re.search( ".*JobIDmodel:\s*(.*)\s*", output).groups()[0]