hydromt.workflows.basin_mask.parse_region#

hydromt.workflows.basin_mask.parse_region(region, logger=<Logger hydromt.workflows.basin_mask (WARNING)>, data_catalog=None)[source]#

Check and return parsed region arguments.

Parameters:
  • region (dict) –

    Dictionary describing region of interest.

    For an exact clip of the region:

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

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

    For a region based of another models grid:

    • {‘<model_name>’: root}

    For a region based of the grid of a raster file:

    • {‘grid’: /path/to/raster}

    For a region based on a mesh grid of a mesh file:

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

    Entire basin can be defined based on an ID, one or multiple point location (x, y), or a region of interest (bounding box or geometry) for which the basin IDs are looked up. The basins withint the area of interest can be further filtered to only include basins with their outlet within the area of interest (‘outlets’: true) of stream threshold arguments (e.g.: ‘uparea’: 1000).

    Common use-cases include:

    • {‘basin’: ID}

    • {‘basin’: [ID1, ID2, ..]}

    • {‘basin’: [x, y]}

    • {‘basin’: [[x1, x2, ..], [y1, y2, ..]]}

    • {‘basin’: /path/to/point_geometry}

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

    • {‘basin’: [xmin, ymin, xmax, ymax], ‘outlets’: true}

    • {‘basin’: [xmin, ymin, xmax, ymax], ‘<variable>’: threshold}

    Subbasins are defined by its outlet locations and include all area upstream from these points. The outlet locations can be passed as xy coordinate pairs, but also derived from the most downstream cell(s) within a area of interest defined by a bounding box or geometry, optionally refined by stream threshold arguments.

    The method can be speed up by providing an additional bounds argument which should contain all upstream cell. If cells upstream of the subbasin are not within the provide bounds a warning will be raised. Common use-cases include:

    • {‘subbasin’: [x, y], ‘<variable>’: threshold}

    • {

      ‘subbasin’: [[x1, x2, ..], [y1, y2, ..]], ‘<variable>’: threshold, ‘bounds’: [xmin, ymin, xmax, ymax] }

    • {‘subbasin’: /path/to/point_geometry, ‘<variable>’: threshold}

    • {‘subbasin’: [xmin, ymin, xmax, ymax], ‘<variable>’: threshold}

    • {‘subbasin’: /path/to/polygon_geometry, ‘<variable>’: threshold}

    Interbasins are similar to subbasins but are bounded by a bounding box or geometry and do not include all upstream area. Common use-cases include:

    • {‘interbasin’: [xmin, ymin, xmax, ymax], ‘<variable>’: threshold}

    • {‘interbasin’: [xmin, ymin, xmax, ymax], ‘xy’: [x, y]}

    • {‘interbasin’: /path/to/polygon_geometry, ‘outlets’: true}

  • logger – The logger to use.

Returns:

  • kind ({'basin', 'subbasin', 'interbasin', 'geom', 'bbox', 'grid'}) – region kind

  • kwargs (dict) – parsed region json