pyflwdir.regions.region_bounds#

pyflwdir.regions.region_bounds(regions, transform=Affine(1.0, 0.0, 0.0, 0.0, -1.0, 0.0))[source]#

Returns the bounding box each unique label in regions.

NOTE: a region must be a connected area with the same ID, where ID are integer values larger than zero.

Parameters:
  • regions (2D array of int) – raster with unique IDs for each region, must have the same shape as data.

  • transform (Affine) – Coefficients mapping pixel coordinates to coordinate reference system.

Returns:

  • lbs (1D array) – array of the unique region IDs

  • bboxs (2D array with shape (lbs.size, 4)) – bounding box [xmin, ymin, xmax, ymax] for each label

  • total_bbox (1D array) – total bounding box of all regions