environmentaltools.spatiotemporal.raster.compute_contours

environmentaltools.spatiotemporal.raster.compute_contours(continuous_stack, info)[source]

Compute the largest connected contour for each time slice in a 3D raster stack.

This function processes a stack of 2D continuous raster fields (e.g., thresholded or probability maps) and extracts the largest connected region (contour) from each time slice. The extraction is performed in parallel for efficiency. The refinement parameter is passed to the region extraction function.

Parameters:
  • continuous_stack (np.ndarray) – 3D array of shape (T, Y, X), where T is the number of time slices, and Y, X are spatial dimensions. Each slice continuous_stack[t] is a 2D field to be processed.

  • info (dict) –

    Configuration dictionary containing analysis parameters. Must include:
    • ”refinement”bool

      Whether to apply grid refinement in contour extraction.

    • ”n_workers”int

      Number of parallel workers to use for processing.

Returns:

contours – List of extracted contours (one per time slice), as returned by largest_region_from_field.

Return type:

list