Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mvertens/manage case #1285

Merged
merged 2 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions config/cesm/config_grids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
=========================================
GRID naming convention
=========================================
The long grid name has the order atm,lnd,ocn/ice,river,mask,glc
The following shortname is used
a% => atm, l% => lnd, oi% => ocn/ice, r% => river, m% => mask, g% => glc, w% => wav

The notation for the grid longname is
a%name_l%name_oi%name_r%name_m%mask_g%name_w%name
a%name_l%name_oi%name_r%name_m%mask_g%name_w%name
where
a% => atm, l% => lnd, oi% => ocn/ice, r% => river, m% => mask, g% => glc, w% => wav

Supported out of the box grid configurations are given via alias specification in
the file "config_grids.xml". Futhermore, each grid alias can also be associated
with the following optional attributes
the file "config_grids.xml". Each grid alias can also be associated with the
following optional attributes

compset (Regular expression for compset matches that are required for this grid)
not_compset (Regular expression for compset matches that are not permitted this grid)

Expand Down Expand Up @@ -872,8 +871,8 @@

<domain name="01col">
<nx>1</nx> <ny>1</ny>
<file lnd_mask="01col">domain.ocn.01col.ArcticOcean.20150824.nc</file>
<file ocn_mask="01col">domain.ocn.01col.ArcticOcean.20150824.nc</file>
<file>domain.ocn.01col.ArcticOcean.20150824.nc</file>
<file>domain.ocn.01col.ArcticOcean.20150824.nc</file>
<desc>01col is a single-column grid for datm and POP:</desc>
</domain>

Expand Down Expand Up @@ -1134,7 +1133,7 @@

<domain name="oQU120">
<nx>28574</nx> <ny>1</ny>
<file ocn_mask="oQU120">$DIN_LOC_ROOT/share/domains/domain.ocn.oQU120.160325.nc</file>
<file mask="oQU120">$DIN_LOC_ROOT/share/domains/domain.ocn.oQU120.160325.nc</file>
<desc>oQU120 is a MPAS ocean grid that is roughly 1 degree resolution:</desc>
<support>Experimental, under development</support>
</domain>
Expand Down Expand Up @@ -1170,8 +1169,8 @@

<domain name="ww3a">
<nx>90</nx> <ny>50</ny>
<file lnd_mask="ww3a">$DIN_LOC_ROOT/share/domains/domain.lnd.ww3a_ww3a.120222.nc</file>
<file ocn_mask="ww3a">$DIN_LOC_ROOT/share/domains/domain.ocn.ww3a_ww3a.120222.nc</file>
<file mask="ww3a">$DIN_LOC_ROOT/share/domains/domain.lnd.ww3a_ww3a.120222.nc</file>
<file mask="ww3a">$DIN_LOC_ROOT/share/domains/domain.ocn.ww3a_ww3a.120222.nc</file>
<desc>WW3 90 x 50 global grid</desc>
<support>For testing of the WAV model</support>
</domain>
Expand Down
85 changes: 81 additions & 4 deletions scripts/lib/CIME/XML/grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ def get_grid_info(self, name, compset):

return gridinfo




def _read_config_grids(self, name, compset):
if self._version == 1.0:
return self._read_config_grids_v1(name, compset)
Expand Down Expand Up @@ -119,7 +116,7 @@ def _read_config_grids_v1(self, name, compset):
"grid '%s' is not supported, use manage_case to determine supported grids " %name)


def _read_config_grids_v2(self, name,compset):
def _read_config_grids_v2(self, name, compset):
"""
read config_grids.xml with version 2.0 schema
"""
Expand Down Expand Up @@ -411,6 +408,86 @@ def print_values(self, long_output=None):
helptext = self.get_element_text("help")
logger.info("%s " %helptext)

if self._version == 1.0:
self._print_values_v1(long_output=long_output)
elif self._version >= 2.0:
self._print_values_v2(long_output=long_output)

def _print_values_v2(self, long_output=None):

logger.info("%5s-------------------------------------------------------------" %(""))
logger.info("%10s default component grids:\n" %(""))
logger.info(" component compset value " )
logger.info("%5s-------------------------------------------------------------" %(""))
default_nodes = self.get_nodes(nodename="model_grid_defaults")
for default_node in default_nodes:
grid_nodes = self.get_nodes(nodename="grid", root=default_node)
for grid_node in grid_nodes:
name = grid_node.get("name")
compset = grid_node.get("compset")
value = grid_node.text
logger.info(" %6s %15s %10s" %(name, compset, value))
logger.info("%5s-------------------------------------------------------------" %(""))

domains = {}
if long_output is not None:
domain_nodes = self.get_nodes(nodename="domain")
for domain_node in domain_nodes:
name = domain_node.get("name")
if name == 'null':
continue
nx = self.get_node("nx", root=domain_node).text
ny = self.get_node("ny", root=domain_node).text
desc = self.get_node("desc", root=domain_node).text
#support = self.get_optional_node("support", root=domain_node).text
files = ""
file_nodes = self.get_nodes("file", root=domain_node)
for file_node in file_nodes:
filename = file_node.text
mask_attrib = file_node.get("mask")
grid_attrib = file_node.get("grid")
files += "\n " + filename
if mask_attrib or grid_attrib:
files += " (only for"
if mask_attrib:
files += " mask: " + mask_attrib
if grid_attrib:
files += " grid match: " + grid_attrib
if mask_attrib or grid_attrib:
files += ")"
domains[name] = "\n %s with domain file(s): %s " %(desc, files)

model_grid_nodes = self.get_nodes(nodename="model_grid")
for model_grid_node in model_grid_nodes:
alias = model_grid_node.get("alias")
compset = model_grid_node.get("compset")
not_compset = model_grid_node.get("not_compset")
restriction = ""
if compset:
restriction += "only for compsets that are %s " %compset
if not_compset:
restriction += "only for compsets that are not %s " %not_compset
if restriction:
logger.info("\n alias: %s (%s)" % (alias,restriction))
else:
logger.info("\n alias: %s" % (alias))
grid_nodes = self.get_nodes("grid", root=model_grid_node)
grids = ""
gridnames = []
for grid_node in grid_nodes:
gridnames.append(grid_node.text)
grids += grid_node.get("name") + ":" + grid_node.text + " "
logger.info(" non-default grids are: %s" %grids)
mask_nodes = self.get_nodes("mask", root=model_grid_node)
for mask_node in mask_nodes:
logger.info(" mask is: %s" %(mask_node.text))
if long_output is not None:
gridnames = set(gridnames)
for gridname in gridnames:
if gridname != "null":
logger.info (" %s" %(domains[gridname]))

def _print_values_v1(self, long_output=None):
# write out grid elements
grid_nodes = self.get_nodes(nodename="grid")
for grid_node in grid_nodes:
Expand Down
3 changes: 0 additions & 3 deletions scripts/manage_case
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ def parse_command_line(args):
parser.add_argument("--query-grids", action="store_true",
help="Query supported model grids for %s model" %cime_model)

parser.add_argument("--grids-shortname",
help="Query model grids for input grid short name for %s model - not implemented yet" %cime_model)

parser.add_argument("--grids-alias",
help="Query model grids for input grid alias for %s model - not implemented yet" %cime_model)

Expand Down