hydromt_sfincs.utils.write_geoms#
- hydromt_sfincs.utils.write_geoms(fn: str | Path, feats: List[Dict], stype: str = 'thd', fmt: str = '%.1f', fmt_z: str = '%.1f') None [source]#
Write list of structure dictionaries to file
- Parameters:
fn (str, Path) – Path to output structure file.
feats (list of dict) – List of dictionaries describing structures. For pli, pol, thd anc crs files “x” and “y” are required, “name” is optional. For weir files “x”, “y” and “z” are required, “name” and “par1” are optional.
stype ({'pli', 'pol', 'thd', 'weir', 'crs'}) – Geom type polylines (pli), polygons (pol) thin dams (thd), weirs (weir) or cross-sections (crs).
fmt (str) – format for “x” and “y” fields.
fmt_z (str) – format for “z” and “par1” fields.
Examples
>>> feats = [ { "name": 'WEIR01', "x": [0, 10, 20], "y": [100, 100, 100], "z": 5.0, "par1": 0.6, }, { "name": 'WEIR02', "x": [100, 110, 120], "y": [100, 100, 100], "z": [5.0, 5.1, 5.0], "par1": 0.6, }, ] >>> write_structures('sfincs.weir', feats, stype='weir')