Exemplo n.º 1
0
 def read(self, fpath):
     if os.path.exists(fpath):
         with open(fpath, 'r') as f_in:
             raw = schism_yaml.load_raw(f_in)
             return SchismPolygonDictConverter().read(raw)
     else:
         raise ValueError('File not found')
Exemplo n.º 2
0
    def read_flow_input(self, fpath):
        """ Read in 'flowlines.yaml'

            Parameters
            ----------
            fpath: a file path of the input
        """
        # yaml.add_representer(collections.OrderedDict, dict_representer)
        # yaml.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
        #                      dict_constructor)
        with open(fpath, 'r') as f:
            flowlines = load_raw(f)['linestrings']
            self._stations = flowlines
            self._map_station_ids()
Exemplo n.º 3
0
def get_params(fname):
    """ Read in parameters from a YAML file
    """
    with open(fname, 'r') as fin:
        params = schism_yaml.load_raw(fin)
    return params