Skip to content

Commit

Permalink
Merge pull request #47 from bertinia/master
Browse files Browse the repository at this point in the history
  • Loading branch information
bertinia authored Dec 11, 2016
2 parents 6625ef7 + d94aabe commit 2bf3031
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 102 deletions.
20 changes: 10 additions & 10 deletions Config/config_postprocess.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,55 +53,55 @@

<entry id="ATM_GRID"
type="string"
valid_values=""
valid_values="0.9x1.25"
value="inherit"
group="case_info"
desc="Atmosphere model grid"
></entry>

<entry id="ICE_GRID"
type="string"
valid_values=""
valid_values="gx1v6"
value="inherit"
group="case_info"
desc="Sea-Ice model grid"
></entry>

<entry id="ICE_NX"
type="string"
valid_values=""
valid_values="320"
value="inherit"
group="case_info"
desc="Sea-Ice model grid NX - default 320 for 1-degree ocean grid"
></entry>

<entry id="ICE_NY"
type="string"
valid_values=""
valid_values="384"
value="inherit"
group="case_info"
desc="Sea-Ice model grid NY - default 384 for 1-degree ocean grid"
></entry>

<entry id="LND_GRID"
type="string"
valid_values=""
valid_values="0.9x1.25"
value="inherit"
group="case_info"
desc="Land model grid"
></entry>

<entry id="OCN_GRID"
type="string"
valid_values=""
valid_values="gx1v6"
value="inherit"
group="case_info"
desc="Ocean model grid"
></entry>

<entry id="CESM_TAG"
type="string"
valid_values=""
valid_values="cesm2_0_beta05"
value="inherit"
group="case_info"
desc="CESM tag used to create this case"
Expand Down Expand Up @@ -215,23 +215,23 @@

<entry id="GLOBAL_WEBHOST"
type="char"
valid_values=""
valid_values="http://some-remote-host"
value=""
group="web_options"
desc="Remote web host machine to serve HTML pages and diagnostics plots."
></entry>

<entry id="GLOBAL_WEBLOGIN"
type="char"
valid_values=""
valid_values="remote-username"
value=""
group="web_options"
desc="Remote web host login name which can be used with ssh keys. If ssh key is not setup, then will prompt for login on remote web host machine."
></entry>

<entry id="GLOBAL_REMOTE_WEBDIR"
type="char"
valid_values=""
valid_values="/path/to/diags/$CASE/"
value=""
group="web_options"
desc="Remote machine path to diagnostics directory."
Expand Down
12 changes: 6 additions & 6 deletions Machines/machine_postprocess.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@
</modules>
<components>
<component name="atm">
<averages_pes queue="regular" pes_per_node="15" wallclock="00:30">128</averages_pes>
<diagnostics_pes queue="geyser" pes_per_node="8" wallclock="02:00">16</diagnostics_pes>
<averages_pes queue="geyser" pes_per_node="4" wallclock="2:00">16</averages_pes>
<diagnostics_pes queue="geyser" pes_per_node="4" wallclock="02:00">16</diagnostics_pes>
<regrid_pes queue="geyser" pes_per_node="2" wallclock="02:00">6</regrid_pes>
<obs_root>/glade/p/cesm/amwg/amwg_data</obs_root>
</component>
<component name="ice">
<averages_pes queue="regular" pes_per_node="15" wallclock="00:30">128</averages_pes>
<averages_pes queue="geyser" pes_per_node="4" wallclock="02:00">16</averages_pes>
<diagnostics_pes queue="geyser" pes_per_node="2" wallclock="01:00">4</diagnostics_pes>
<obs_root>/glade/p/cesm/pcwg/ice/data</obs_root>
</component>
<component name="lnd">
<averages_pes queue="regular" pes_per_node="15" wallclock="02:00">128</averages_pes>
<averages_pes queue="geyser" pes_per_node="4" wallclock="02:00">16</averages_pes>
<diagnostics_pes queue="geyser" pes_per_node="4" wallclock="02:00">12</diagnostics_pes>
<regrid_pes queue="geyser" pes_per_node="2" wallclock="02:00">6</regrid_pes>
<obs_root>/glade/p/cesm/lmwg/diag/lnd_diag_data</obs_root>
</component>
<component name="ocn">
<averages_pes queue="regular" pes_per_node="15" wallclock="00:30">128</averages_pes>
<averages_pes queue="geyser" pes_per_node="4" wallclock="02:00">16</averages_pes>
<diagnostics_pes queue="geyser" pes_per_node="4" wallclock="02:00">16</diagnostics_pes>
<obs_root>/glade/p/cesm</obs_root>
<obs_root>/glade/p/cesm/</obs_root>
</component>
</components>
</machine>
Expand Down
3 changes: 2 additions & 1 deletion Templates/env_diags.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
<!-- {{ comment }} -->
<!-- ======================================================================= -->
{% for xml in v %}
<!-- {{ xml._desc }} -->
<!-- ** Description: {{ xml._desc }} -->
<!-- ** Valid Values: {{ xml._valid_values }} -->
<entry id="{{ xml._id }}" value="{{ xml._value }}" />
{% endfor %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion Templates/env_postprocess.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- {{ comment }} -->
<!-- ======================================================================= -->
{% for xml in v %}
<!-- {{ xml._desc }} -->
<!-- ** Description: {{ xml._desc }} -->
<entry id="{{ xml._id }}" value="{{ xml._value }}" />
{% endfor %}
{% endif %}
Expand Down
56 changes: 35 additions & 21 deletions cesm_utils/cesm_utils/create_postprocess
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ import jinja2
# define a class to be used for the xml entry, id, desc values
# -------------------------------------------------------------------------------
class XmlEntry(object):
def __init__(self, id, value, desc):
def __init__(self, id, value, desc, valid_values):
self._id = id
self._value = value
self._desc = desc
self._valid_values = valid_values

def id(self):
return self._id
Expand All @@ -108,6 +109,9 @@ class XmlEntry(object):
def desc(self):
return self._desc

def valid_values(self):
return self._valid_values

# -------------------------------------------------------------------------------
# commandline_options - parse any command line options
# -------------------------------------------------------------------------------
Expand Down Expand Up @@ -204,9 +208,11 @@ def create_env_file(envDict, configFile, tmplFile, envFile, obs_root, comp, stan
for entry_tag in group_tag.findall('entry'):
# check if the value needs to be inherited from the envDict
if entry_tag.get('value') == 'inherit':
xml_list.append(XmlEntry(entry_tag.get('id'), envDict[entry_tag.get('id')], entry_tag.get('desc')))
xml_list.append(XmlEntry(entry_tag.get('id'), envDict[entry_tag.get('id')],
entry_tag.get('desc'), entry_tag.get('valid_values')))
else:
xml_list.append(XmlEntry(entry_tag.get('id'), entry_tag.get('value'), entry_tag.get('desc')))
xml_list.append(XmlEntry(entry_tag.get('id'), entry_tag.get('value'),
entry_tag.get('desc'), entry_tag.get('valid_values')))

group_dict = { 'order' : order, 'name' : name, 'comment' : comment, 'xml_list' : xml_list }
group_list.append(group_dict)
Expand All @@ -217,9 +223,8 @@ def create_env_file(envDict, configFile, tmplFile, envFile, obs_root, comp, stan
xml_list = list()
if obs_root:
if len(obs_root) > 0:
xml_obs = XmlEntry('{0}DIAG_DIAGOBSROOT'.format(comp.upper()),
obs_root,
'Machine dependent diagnostics observation files root path')
xml_obs = XmlEntry('{0}DIAG_DIAGOBSROOT'.format(comp.upper()), obs_root,
'Machine dependent diagnostics observation files root path', '')
xml_list.append(xml_obs)

# the xml_list now contains a list of XmlEntry classes that can be written to the template
Expand Down Expand Up @@ -562,7 +567,8 @@ def main(options):
config_file = '{0}/diagnostics/diagnostics/{1}/Config/config_diags_{1}.xml'.format(envDict['POSTPROCESS_PATH'], comp)
tmpl_file = 'env_diags.tmpl'
env_file = '{0}/env_diags_{1}.xml'.format(envDict['PP_CASE_PATH'], comp)
create_env_file(envDict, config_file, tmpl_file, env_file, machine['{0}_obs_root'.format(comp)], comp, standalone)
create_env_file(envDict, config_file, tmpl_file, env_file, machine['{0}_obs_root'.format(comp)],
comp, standalone)

# define the template files for the batch scripts
batch_tmpl = 'batch_{0}.tmpl'.format(envDict['MACH'])
Expand All @@ -575,39 +581,47 @@ def main(options):

create_batch(envDict['POSTPROCESS_PATH'], machine['timeseries_pes'], batch_tmpl, run_tmpl, postProcessCmd,
machine['mpi_command'], outFile, processName, machine['project'], machine['pythonpath'],
envDict['PP_CASE_PATH'], machine['reset_modules'], machine['modules'], machine['timeseries_queue'],
machine['timeseries_ppn'], machine['timeseries_wallclock'], options, standalone)
envDict['PP_CASE_PATH'], machine['reset_modules'], machine['modules'],
machine['timeseries_queue'], machine['timeseries_ppn'], machine['timeseries_wallclock'],
options, standalone)

# generate the diagnostics batch submit scripts from template files
for comp in compList:
# generate the averages batch submit script
postProcessCmd = '{0}_avg_generator.py'.format(comp)
processName = '{0}_averages'.format(comp)
outFile = '{0}/{1}'.format(envDict['PP_CASE_PATH'], processName)
create_batch(envDict['POSTPROCESS_PATH'], machine['{0}_averages_pes'.format(comp)], batch_tmpl, run_tmpl, postProcessCmd,
machine['mpi_command'], outFile, processName, machine['project'], machine['pythonpath'],
envDict['PP_CASE_PATH'], machine['reset_modules'], machine['modules'], machine['{0}_averages_queue'.format(comp)],
machine['{0}_averages_ppn'.format(comp)], machine['{0}_averages_wallclock'.format(comp)], options, standalone)
create_batch(envDict['POSTPROCESS_PATH'], machine['{0}_averages_pes'.format(comp)], batch_tmpl,
run_tmpl, postProcessCmd, machine['mpi_command'], outFile, processName,
machine['project'], machine['pythonpath'], envDict['PP_CASE_PATH'],
machine['reset_modules'], machine['modules'], machine['{0}_averages_queue'.format(comp)],
machine['{0}_averages_ppn'.format(comp)], machine['{0}_averages_wallclock'.format(comp)],
options, standalone)

# generate the diagnostics batch submit script
postProcessCmd = '{0}_diags_generator.py'.format(comp)
processName = '{0}_diagnostics'.format(comp)
outFile = '{0}/{1}'.format(envDict['PP_CASE_PATH'], processName)
create_batch(envDict['POSTPROCESS_PATH'], machine['{0}_diagnostics_pes'.format(comp)], batch_tmpl, run_tmpl, postProcessCmd,
machine['mpi_command'], outFile, processName, machine['project'], machine['pythonpath'],
envDict['PP_CASE_PATH'], machine['reset_modules'], machine['modules'], machine['{0}_diagnostics_queue'.format(comp)],
machine['{0}_diagnostics_ppn'.format(comp)], machine['{0}_diagnostics_wallclock'.format(comp)], options, standalone)
create_batch(envDict['POSTPROCESS_PATH'], machine['{0}_diagnostics_pes'.format(comp)], batch_tmpl,
run_tmpl, postProcessCmd, machine['mpi_command'], outFile, processName,
machine['project'], machine['pythonpath'], envDict['PP_CASE_PATH'],
machine['reset_modules'], machine['modules'],
machine['{0}_diagnostics_queue'.format(comp)],
machine['{0}_diagnostics_ppn'.format(comp)],
machine['{0}_diagnostics_wallclock'.format(comp)], options, standalone)

# generate the regrid batch submit scripts from template files
for comp in regridList:
# generate the regrid batch submit script
postProcessCmd = '{0}_regrid_generator.py'.format(comp)
processName = '{0}_regrid'.format(comp)
outFile = '{0}/{1}'.format(envDict['PP_CASE_PATH'], processName)
create_batch(envDict['POSTPROCESS_PATH'], machine['{0}_regrid_pes'.format(comp)], batch_tmpl, run_tmpl, postProcessCmd,
machine['mpi_command'], outFile, processName, machine['project'], machine['pythonpath'],
envDict['PP_CASE_PATH'], machine['reset_modules'], machine['modules'], machine['{0}_regrid_queue'.format(comp)],
machine['{0}_regrid_ppn'.format(comp)], machine['{0}_regrid_wallclock'.format(comp)], options, standalone)
create_batch(envDict['POSTPROCESS_PATH'], machine['{0}_regrid_pes'.format(comp)], batch_tmpl,
run_tmpl, postProcessCmd, machine['mpi_command'], outFile, processName,
machine['project'], machine['pythonpath'], envDict['PP_CASE_PATH'],
machine['reset_modules'], machine['modules'], machine['{0}_regrid_queue'.format(comp)],
machine['{0}_regrid_ppn'.format(comp)], machine['{0}_regrid_wallclock'.format(comp)],
options, standalone)

# copy some tools to the PP_CASE_PATH
files_to_copy = ['copy_html', 'pp_config', 'create_env_script', 'env_file.xsd']
Expand Down
10 changes: 10 additions & 0 deletions diagnostics/diagnostics/ice/Config/config_diags_ice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
desc="Controls whether to generate model vs. model diagnostics"
></entry>

<entry id="ICEDIAG_netcdf_format"
type="string"
valid_values="netcdf, netcdf4, netcdf4c, netcdfLarge"
value="netcdf"
group="global"
desc="Output NetCDF file format - either 'netcdf4c' (netcdf4 compressed (lev=1)),
'netcdf4' (netcdf classic), 'netcdf' (netcdf3 classic), or netcdfLarge for high-resolution data sets. DEFAULT = 'netcdf'.
Applies to both model and control cases."
></entry>

<entry id="ICEDIAG_CLEANUP_FILES"
type="logical"
valid_values="True/False"
Expand Down
Loading

0 comments on commit 2bf3031

Please sign in to comment.