-
Notifications
You must be signed in to change notification settings - Fork 14
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
Physics tendency updaters #163
Changes from 18 commits
d3a66a3
fc57eda
4de55c2
caa3f2f
d394909
5e26b26
e6ff6fe
72e25d0
e5b2fd2
21a6bf8
c004ddd
7490848
349c6e5
9907a1f
e588cf5
b4e1bc1
51fbada
7adab47
b8fe050
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ sys.path.append(_LIBDIR) | |
from standard_script_setup import * | ||
from CIME.XML.standard_module_setup import * | ||
from CIME.buildnml import create_namelist_infile, parse_input | ||
from CIME.utils import check_minimum_python_version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we do not really need this now. |
||
from CIME.case import Case | ||
from CIME.utils import expect | ||
from CIME.nmlgen import NamelistGenerator | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -28,6 +28,7 @@ | |||||||||
|
||||||||||
# CCPP framework imports | ||||||||||
# pylint: disable=wrong-import-position | ||||||||||
from framework_env import CCPPFrameworkEnv | ||||||||||
from parse_tools import validate_xml_file, read_xml_file | ||||||||||
from parse_tools import find_schema_file, find_schema_version | ||||||||||
from parse_tools import init_log, CCPPError, ParseInternalError | ||||||||||
|
@@ -433,7 +434,7 @@ def __init__(self, elem_node, parent_name, dimensions, known_types, | |||||||||
', '.join(dimensions))) | ||||||||||
# end if | ||||||||||
local_name = '{}({})'.format(parent_name, self.index_string) | ||||||||||
super(ArrayElement, self).__init__(elem_node, local_name, my_dimensions, | ||||||||||
super().__init__(elem_node, local_name, my_dimensions, | ||||||||||
known_types, parent_type, | ||||||||||
units_default=parent_units, | ||||||||||
kind_default=parent_kind, | ||||||||||
|
@@ -555,7 +556,7 @@ def __init__(self, var_node, known_types, vdict, logger): | |||||||||
# end if | ||||||||||
# end for | ||||||||||
# Initialize the base class | ||||||||||
super(Variable, self).__init__(var_node, local_name, | ||||||||||
super().__init__(var_node, local_name, | ||||||||||
my_dimensions, known_types, ttype, | ||||||||||
protected=protected) | ||||||||||
|
||||||||||
|
@@ -591,7 +592,7 @@ def __init__(self, var_node, known_types, vdict, logger): | |||||||||
def write_metadata(self, outfile): | ||||||||||
"""Write out this variable as CCPP metadata""" | ||||||||||
if self.access != "private": | ||||||||||
super(Variable, self).write_metadata(outfile) | ||||||||||
super().write_metadata(outfile) | ||||||||||
if (self.allocatable == "parameter") or self.protected: | ||||||||||
outfile.write(' protected = True\n') | ||||||||||
# end if | ||||||||||
|
@@ -1430,16 +1431,18 @@ def parse_command_line(args, description): | |||||||||
return pargs | ||||||||||
|
||||||||||
############################################################################### | ||||||||||
def metadata_file_to_files(file_path, known_types, dycore, config, logger): | ||||||||||
def metadata_file_to_files(file_path, known_types, dycore, config, run_env): | ||||||||||
############################################################################### | ||||||||||
"""Read the metadata file at <relative_file_path> and convert it to a | ||||||||||
registry File object. | ||||||||||
""" | ||||||||||
known_ddts = known_types.known_ddt_names() | ||||||||||
mfiles = [] | ||||||||||
if os.path.exists(file_path): | ||||||||||
meta_tables = parse_metadata_file(file_path, known_ddts, logger) | ||||||||||
logger.info("Parsing metadata_file, '{}'".format(file_path)) | ||||||||||
if run_env.logger: | ||||||||||
run_env.logger.info("Parsing metadata_file, '{}'".format(file_path)) | ||||||||||
meta_tables = parse_metadata_file(file_path, known_ddts, run_env) | ||||||||||
# end if | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid confusion, these need to be swapped:
Suggested change
|
||||||||||
else: | ||||||||||
emsg = "Metadata file, '{}', does not exist" | ||||||||||
raise CCPPError(emsg.format(file_path)) | ||||||||||
|
@@ -1455,7 +1458,7 @@ def metadata_file_to_files(file_path, known_types, dycore, config, logger): | |||||||||
section = '<file name="{}" type="{}"></file>'.format(hname, htype) | ||||||||||
sect_xml = ET.fromstring(section) | ||||||||||
mfile = File(sect_xml, known_types, dycore, config, | ||||||||||
logger, gen_code=False, file_path=file_path) | ||||||||||
run_env.logger, gen_code=False, file_path=file_path) | ||||||||||
# Add variables | ||||||||||
# Note, we only support one section per table for host variables | ||||||||||
sections = mtable.sections() | ||||||||||
|
@@ -1497,7 +1500,7 @@ def metadata_file_to_files(file_path, known_types, dycore, config, logger): | |||||||||
# end if | ||||||||||
vnode_str += '\n</variable>' | ||||||||||
var_node = ET.fromstring(vnode_str) | ||||||||||
mfile.add_variable(var_node, logger) | ||||||||||
mfile.add_variable(var_node, run_env.logger) | ||||||||||
# end for | ||||||||||
if htype == 'ddt': | ||||||||||
# We defined the variables, now create the DDT for them. | ||||||||||
|
@@ -1509,8 +1512,8 @@ def metadata_file_to_files(file_path, known_types, dycore, config, logger): | |||||||||
vnode_str += '\n</ddt>' | ||||||||||
var_node = ET.fromstring(vnode_str) | ||||||||||
new_ddt = DDT(var_node, known_types, mfile.var_dict, | ||||||||||
dycore, config, logger) | ||||||||||
mfile.add_ddt(new_ddt, logger=logger) | ||||||||||
dycore, config, run_env.logger) | ||||||||||
mfile.add_ddt(new_ddt, logger=run_env.logger) | ||||||||||
# end if | ||||||||||
mfiles.append(mfile) | ||||||||||
# end for | ||||||||||
|
@@ -1532,6 +1535,10 @@ def write_registry_files(registry, dycore, config, outdir, src_mod, src_root, | |||||||||
""" | ||||||||||
files = [] | ||||||||||
known_types = TypeRegistry() | ||||||||||
logger.debug('hi') | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uhhh, not sure what is going on here. If we need this line, I think the correct syntax is |
||||||||||
# Create a fake CCPPFrameworkEnv object to contain the logger | ||||||||||
run_env = CCPPFrameworkEnv(logger, host_files='', | ||||||||||
scheme_files='', suites='') | ||||||||||
for section in registry: | ||||||||||
sec_name = section.get('name') | ||||||||||
if sec_name: | ||||||||||
|
@@ -1567,7 +1574,7 @@ def write_registry_files(registry, dycore, config, outdir, src_mod, src_root, | |||||||||
# end if | ||||||||||
# end if | ||||||||||
meta_files = metadata_file_to_files(file_path, known_types, | ||||||||||
dycore, config, logger) | ||||||||||
dycore, config, run_env) | ||||||||||
files.extend(meta_files) | ||||||||||
else: | ||||||||||
emsg = "Unknown registry object type, '{}'" | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that for issue #156 we should have the restriction be for a 3.6 minimum (instead of 3.7)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, let's settle this over there (where I have been commenting).