fre.yamltools.field_table.field_table_to_yaml module

  • This file is part of the GFDL Flexible Modeling System (FMS) YAML tools.

  • FMS_yaml_tools is free software: you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License as published by

  • the Free Software Foundation, either version 3 of the License, or (at
    • your option) any later version.

  • FMS_yaml_tools is distributed in the hope that it will be useful, but WITHOUT

  • ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

  • FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License

  • for more details.

  • You should have received a copy of the GNU Lesser General Public

  • License along with FMS. If not, see <http://www.gnu.org/licenses/>.


Converts a legacy ascii field_table to a yaml field_table.

Author: Eric Stofferahn 07/14/2022

class fre.yamltools.field_table.field_table_to_yaml.Field(in_field_type, entry_tuple)

Bases: object

A Field Object, containing the variable attributes, methods, and subparameters

process_species(prop)

Process a species field

process_tracer(prop)

Process a tracer field

class fre.yamltools.field_table.field_table_to_yaml.FieldYaml(field_file)

Bases: object

convert_yaml()

Convert to list-style yaml

init_ordered_keys()

Get unique combination of field_type and model… in order provided

initialize_lists()

Initialize out_yaml and ordered_keys

main()
make_objects()

Make Tracer and Species objects and assign to out_yaml

populate_entries()

Populate entries as OrderedDicts

writeyaml()

Write yaml out to file

fre.yamltools.field_table.field_table_to_yaml.dont_convert_yaml_val(inval)
fre.yamltools.field_table.field_table_to_yaml.list_items(brief_text, brief_od)

Given text and an OrderedDict, make an OrderedDict and convert to list

fre.yamltools.field_table.field_table_to_yaml.listify_ordered_dict(in_list, in_list2, in_od)

Given two lists and an OrderedDict, return a list of OrderedDicts. Note this function is recursive.

fre.yamltools.field_table.field_table_to_yaml.main()
fre.yamltools.field_table.field_table_to_yaml.pound_signs_within_quotes(in_lines)

Change pound signs within quotes to the word poundsign so they aren’t expunged when eliminating comments.

fre.yamltools.field_table.field_table_to_yaml.process_field_file(my_file)

Parse ascii field table into nested lists for further processing

fre.yamltools.field_table.field_table_to_yaml.zip_uneven(in_even, in_odd)

Re-splice two uneven lists that have been split apart by a stride of 2