hydromt_sfincs.workflows.merge_topobathy

hydromt_sfincs.workflows.merge_topobathy(da1: ~xarray.core.dataarray.DataArray, da2: ~xarray.core.dataarray.DataArray, da_offset: ~typing.Optional[~typing.Union[~xarray.core.dataarray.DataArray, float]] = None, merge_buffer: int = 0, merge_method: str = 'first', elv_min: ~typing.Optional[float] = None, elv_max: ~typing.Optional[float] = None, reproj_method: str = 'bilinear', interp_method: str = 'linear', max_width: int = 0, logger=<Logger hydromt_sfincs.workflows.bathymetry (WARNING)>) DataArray[source]

Return merged topobathy data from two datasets.

Values from the second dataset are used where da_mask equals True or, if not provided, where the first dataset has missing values.

If merge_buffer > 0, values of da2 are replaced with linearly interpolated values within the buffer.

If da_offset is provided, a (spatially varying) offset is applied to the second dataset to convert the vertical datum before merging.

Parameters
  • da1 (xr.DataArray) – Datasets with topobathy data to be merged.

  • da2 (xr.DataArray) – Datasets with topobathy data to be merged.

  • da_offset (xr.DataArray, float, optional) – Dataset with spatially varying offset or float with uniform offset

  • 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

  • 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!

  • merge_buffer (int, optional) – Buffer (number of cells) within the da_mask==True region where topobathy values are based on linear interpolation for a smooth transition, by default 0.

  • max_width (int, optional) – Maximum width (number of cells) to append to valid da1 cells. By default 0.

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

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

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

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

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

Returns

da_out – Merged topobathy dataset

Return type

xr.DataArray