hydromt_sfincs.SfincsModel.setup_merge_topobathy

SfincsModel.setup_merge_topobathy(topobathy_fn, elv_min=None, elv_max=None, mask_fn=None, max_width=0, offset_fn=None, offset_constant=0, merge_buffer=0, merge_method='first', reproj_method='bilinear', interp_method='linear')[source]

Updates the existing model topobathy data (dep file) with a new topobathy source within the current model extent.

By default (merge_method=”first”) invalid (nodata) cells in the current topobathy data are replaced with values from the new topobathy source.

Use offset_fn for a spatially varying, or offset_constant for a spatially uniform offset to convert the vertical datum of the new source before merging.

Gaps in the data (i.e. areas with nodata cells surrounded areas with valid elevation) are interpolated based on interp_method, by deafult ‘linear’. Gaps are not interpolated if interp_method = None

Updates model layer:

  • dep map: combined elevation/bathymetry [m+ref]

Parameters
  • topobathy_fn (str, optional) –

    Path or data source name for topobathy raster data.

    • Required variables: [‘elevtn’]

  • mask_fn (str, optional) – Path or data source name of polygon with valid new topobathy cells.

  • max_width (int, optional) – Maximum width (number of cells) to append to valid dep cells if larger than zero. By default 0.

  • elv_min (float, optional) – Minimum and maximum elevation caps for new topobathy cells, cells outside this range are linearly interpolated. Note: applied after offset!

  • elv_max (float, optional) – Minimum and maximum elevation caps for new topobathy cells, cells outside this range are linearly interpolated. Note: applied after offset!

  • offset_fn (float, optional) – Path or data source name for Spatially varying map with difference between the vertical reference of the current model topobathy and the new data source [m]. The offset is added to the new source before merging.

  • offset_fn – Same as offset_fn but spatially uniform value [m].

  • merge_buffer (int, optional) – Buffer (number of cells) around the original (merge_method = ‘first’) or new (merge_method = ‘last’) data source where values are interpolated using interp_method. Not recommended to use in combination with merge_methods ‘min’ or ‘max’

  • merge_method ({'first','last','min','max'}, optional) –

    merge method, by default ‘first’:

    • first: use valid new where existing invalid

    • last: use valid new

    • min: pixel-wise min of existing and new

    • max: pixel-wise max of existing and new

  • reproj_method ({'bilinear', 'cubic', 'nearest'}) – Method used to reproject the offset and second dataset to the grid of the new topobathy dataset, by default ‘bilinear’

  • interp_method – Method used to interpolate holes of nodata in the merged dataset, by default ‘linear’. If None holes are not interpolated.

  • {'linear' – Method used to interpolate holes of nodata in the merged dataset, by default ‘linear’. If None holes are not interpolated.

  • 'nearest' – Method used to interpolate holes of nodata in the merged dataset, by default ‘linear’. If None holes are not interpolated.

  • 'rio_idw'} – Method used to interpolate holes of nodata in the merged dataset, by default ‘linear’. If None holes are not interpolated.

  • optional – Method used to interpolate holes of nodata in the merged dataset, by default ‘linear’. If None holes are not interpolated.