Commit 9a0b2909 authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

pyfabm: support multiple model objects

parent 48ff4132
This diff is collapsed.
......@@ -100,7 +100,8 @@ def processFile(infile,outfile,subtract_background=False,add_missing=False):
if len(path)==1 and path[0]=='instances':
for key in list(d.keys()):
instance = d[key]
if isinstance(instance,dict) and not instance.get('use',True): del d[key]
if isinstance(instance, dict) and not instance.get('use', True):
del d[key]
# If processing a model dictionary, reorder according to prescribed order.
if len(path)==2 and path[0]=='instances':
......
......@@ -17,39 +17,42 @@ def main():
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('path',help='Path to a YAML file with the model configuration (typically fabm.yaml)',nargs='?',default='fabm.yaml')
parser.add_argument('path', help='Path to a YAML file with the model configuration (typically fabm.yaml)', nargs='?', default='fabm.yaml')
parser.add_argument('--all', '-a', action='store_true', help='Show diagnostics that are by default excluded from output')
args = parser.parse_args()
# Create model object from YAML file.
model = pyfabm.Model(args.path)
print('Interior state variables:')
for variable in model.bulk_state_variables:
print(' %s = %s (%s)' % (variable.name,variable.long_name,variable.units))
for variable in model.interior_state_variables:
print(' %s = %s (%s)' % (variable.name, variable.long_name, variable.units))
print('Surface-attached state variables:')
for variable in model.surface_state_variables:
print(' %s = %s (%s)' % (variable.name,variable.long_name,variable.units))
print(' %s = %s (%s)' % (variable.name, variable.long_name, variable.units))
print('Bottom-attached state variables:')
for variable in model.bottom_state_variables:
print(' %s = %s (%s)' % (variable.name,variable.long_name,variable.units))
print(' %s = %s (%s)' % (variable.name, variable.long_name, variable.units))
print('Interior diagnostic variables:')
for variable in model.bulk_diagnostic_variables:
print(' %s = %s (%s)' % (variable.name,variable.long_name,variable.units))
for variable in model.interior_diagnostic_variables:
if variable.output or args.all:
print(' %s = %s (%s)' % (variable.name, variable.long_name, variable.units))
print('Horizontal diagnostic variables:')
for variable in model.horizontal_diagnostic_variables:
print(' %s = %s (%s)' % (variable.name,variable.long_name,variable.units))
if variable.output or args.all:
print(' %s = %s (%s)' % (variable.name, variable.long_name, variable.units))
print('Conserved quantities:')
for variable in model.conserved_quantities:
print(' %s (%s)' % (variable.name,variable.units))
print(' %s (%s)' % (variable.name, variable.units))
print('Dependencies:')
for variable in model.dependencies:
print(' %s = %s (%s)' % (variable.name,variable.long_name,variable.units))
print(' %s = %s (%s)' % (variable.name, variable.long_name, variable.units))
if __name__ == "__main__":
# execute only if run as a script
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment