Skip to content

Commit

Permalink
Merge pull request NCAR#7 from climbfuji/update_gsd_develop_from_ncar…
Browse files Browse the repository at this point in the history
…_master

Update gsd/develop from NCAR master
  • Loading branch information
DomHeinzeller authored Aug 7, 2020
2 parents c5ede56 + fa73899 commit 0b84bec
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/ccpp_prebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def check_optional_arguments(metadata, arguments, optional_arguments):
# *DH 2020-05-26
for subroutine_name in optional_arguments[module_name].keys():
# If optional arguments are listed individually, check each of them
if type(optional_arguments[module_name][subroutine_name]) is list:
if isinstance(optional_arguments[module_name][subroutine_name], list):
for var_name in optional_arguments[module_name][subroutine_name]:
if not var_name in arguments[module_name][scheme_name][subroutine_name]:
raise Exception("Explicitly requested optional argument '{}' not known to {}/{}".format(
Expand Down
30 changes: 29 additions & 1 deletion scripts/conversion_tools/unit_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,35 @@ def kg_kg_minus_1__to__g_kg_minus_1():

def g_kg_minus_1__to__kg_kg_minus_1():
"""Convert gram per kilogram to kilogram per kilogram"""
return '{var}/1.0E+3{kind}'
return '1.0E-3{kind}*{var}'

##################
# Plane angle #
##################

def radian__to__degree():
"""Convert radian to degree"""
return '57.295779513{kind}*{var}'

def degree__to__radian():
"""Convert degree to radian"""
return '{var}/57.295779513{kind}'

def radian__to__degree_north():
"""Convert radian to degree north"""
return radian__to__degree()

def degree_north__to__radian():
"""Convert degree north to radian"""
return degree__to__radian()

def radian__to__degree_east():
"""Convert radian to degree east"""
return radian__to__degree()

def degree_east__to__radian():
"""Convert degree east to radian"""
return degree__to__radian()

##################
# Composed units #
Expand Down
2 changes: 1 addition & 1 deletion scripts/metadata2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def import_config(configfile, logger):
def get_metadata_files_from_config(config, logger):
"""Create a list of metadata filenames for a CCPP prebuild configuration"""
filenames = []
for sourcefile in config['variable_definition_files'] + config['scheme_files'].keys():
for sourcefile in config['variable_definition_files'] + config['scheme_files']:
metafile = os.path.splitext(sourcefile)[0]+'.meta'
if os.path.isfile(metafile):
filenames.append(metafile)
Expand Down
4 changes: 2 additions & 2 deletions scripts/mkcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def dimensions(self):

@dimensions.setter
def dimensions(self, value):
if not type(value) is list:
if not isinstance(value, list):
raise TypeError('Invalid type for variable property dimensions, must be a list')
self._dimensions = value

Expand Down Expand Up @@ -170,7 +170,7 @@ def actions(self):

@actions.setter
def actions(self, values):
if type(values)==dict:
if isinstance(values, dict):
for key in values.keys():
if key in ['in', 'out'] and isstring(values[key]):
self._actions[key] = values[key]
Expand Down

0 comments on commit 0b84bec

Please sign in to comment.