hydromt_sfincs.utils.write_geoms#

hydromt_sfincs.utils.write_geoms(fn: str | Path, feats: List[Dict], stype: str = 'thd', fmt='%.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 and thd 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'}) – Geom type polylines (pli), polygons (pol) thin dams (thd) or weirs (weir).

  • fmt (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')