hydromt.workflows.mesh.create_mesh2d#

hydromt.workflows.mesh.create_mesh2d(region: ~typing.Dict, res: float | None = None, crs: int | None = None, align: bool = True, logger=<Logger hydromt.workflows.mesh (WARNING)>) UgridDataset[source]#

Create an 2D unstructured mesh or reads an existing 2D mesh.

Grids are read according to UGRID conventions. An 2D unstructured mesh will be created as 2D rectangular grid from a geometry (geom_fn) or bbox. If an existing 2D mesh is given, then no new mesh will be generated but an extent can be extracted using the bounds argument of region.

Note Only existing meshed with only 2D grid can be read.

Adds/Updates model layers:

  • grid_name mesh topology: add grid_name 2D topology to mesh object

Parameters:
  • region (dict) –

    Dictionary describing region of interest, bounds can be provided for type ‘mesh’. In case of ‘mesh’, if the file includes several grids, the specific 2D grid can be selected using the ‘grid_name’ argument. CRS for ‘bbox’ and ‘bounds’ should be 4326; e.g.:

    • {‘bbox’: [xmin, ymin, xmax, ymax]}

    • {‘geom’: ‘path/to/polygon_geometry’}

    • {‘mesh’: ‘path/to/2dmesh_file’}

    • {‘mesh’: ‘path/to/2dmesh_file’, ‘grid_name’: ‘mesh2d’, ‘bounds’: [xmin, ymin, xmax, ymax]}

  • res (float) – Resolution used to generate 2D mesh [unit of the CRS], required if region is not based on ‘mesh’.

  • crs (EPSG code, int, optional) – Optional EPSG code of the model or “utm” to let hydromt find the closest projected CRS. If None using the one from region, and else 4326.

  • align (bool, optional) – Align the mesh to the resolution, by default True.

Returns:

mesh2d – Generated mesh2d.

Return type:

xu.UgridDataset