NOAA-OWP / inundation-mapping

Flood inundation mapping and evaluation software configured to work with U.S. National Water Model.
Other
92 stars 27 forks source link

[21pt] Create a tool for identifying catchment boundary issues #1063

Closed CarsonPruitt-NOAA closed 1 day ago

CarsonPruitt-NOAA commented 8 months ago

I'm open to suggestions on this tool, but my vision is for this new module to be able to produce inundation and a geopackage of catchment boundary issues given a flow file and a FIM directory. It should be structured similar to the interpolate_water_surface.py module where the catchment boundary function is inserted into the inundation process.

def find_catchment_boundary_issues(
    hydrofabric_dir,
    inundation_tif
):
    ## Your code to identify issues

def inundate_with_catchment_boundaries(
    hydrofabric_dir,
    hucs,
    flow_file,
    inundation_raster,
    output_fileNames=None,
    num_workers=1,
    keep_intermediate=False,
    log_file=None,
    verbose=False,
):
    print("Running Inundation")
    map_file = Inundate_gms(
        hydrofabric_dir=hydrofabric_dir,
        forecast=flow_file,
        num_workers=num_workers,
        hucs=hucs,
        inundation_raster=inundation_raster,
        verbose=verbose,
        log_file=log_file,
        output_fileNames=output_fileNames,
    )
    print("Mosaicking branches together")
    Mosaic_inundation(
        map_file,
        mosaic_attribute='depths_rasters',
        mosaic_output=depths_raster,
        mask=None,
        unit_attribute_name='huc8',
        nodata=elev_raster_ndv,
        workers=1,
        remove_inputs=not keep_intermediate,
        subset=None,
        verbose=verbose,
    )

    print("Determining locations for catchment boundary issues")
    find_catchment_boundary_issues(
        hydrofabric_dir=hydrofabric_dir,

    )

if __name__ == '__main__':
    ## This part should be mostly identical to the interpolate_water_surface.py module linked above
    ## with a few tweaks, like replace depth_raster with inundation_raster, etc.
CarsonPruitt-NOAA commented 8 months ago

Some hints to get your started on your function:

  1. Convert the inundation raster to vector.
  2. Merge all of the catchment geopackages into one geodataframe.
  3. Convert both the inundation polygon and merged catchment polygons to lines
  4. Find where the inundation extent lines are coincident with any catchment boundary
RileyMcDermott-NOAA commented 6 months ago

Here are some example outputs from the catchment boundary identification tool from HUC 17110010. With catchment boundary layer on:

Image

Image

How view would appear on waterview/FIM review:

Image

Image

RileyMcDermott-NOAA commented 6 months ago

Updated Catchment Boundary Example Maps:

Image

Image

Image

Image