hydromt.model.processes.mesh.create_mesh2d_from_region#

hydromt.model.processes.mesh.create_mesh2d_from_region(region: Dict[str, Any], *, crs: int | None = None, region_crs: int = 4326, res: float | None = None, align: bool = True, data_catalog: DataCatalog | None = None)[source]#

HYDROMT CORE METHOD: Create an 2D unstructured mesh or reads an existing 2D mesh according UGRID conventions.

Grids are read according to UGRID conventions. An 2D unstructured mesh will be created as 2D rectangular grid from a geometry (geom_filename) 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.

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/mesh_file’, ‘grid_name’: ‘mesh2d’, ‘bounds’: [xmin, ymin, xmax, ymax]}

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

  • crs (int, optional) – Optional EPSG code of the model. If None using the one from region, and else 4326.

  • region_crs (int, optional) – EPSG code of the region geometry, by default None. Only applies if region is of kind ‘bbox’or if geom crs is not defined in the file itself.

  • align (bool, default True) – Align the mesh to the resolution. Required for ‘bbox’ and ‘geom’ region types.

  • logger (logging.Logger) – Logger object, a default module logger is used if not specified.

  • data_catalog (DataCatalog, optional) – Optional data catalog to use for reading data. Required if region is based on ‘geom’.

Returns:

mesh2d – Generated mesh2d.

Return type:

xu.UgridDataset