You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked that this issue has not already been reported.
I have checked that this bug exists on the latest version of HydroMT-SFINCS.
Reproducible Example
# Every single grid cell of the flux grid of the size inp.dx by inp.dy is defined into subgrid pixels (default is 20, nr_subgrid_pixels = 20).# For every subgrid pixel the topobathy data is loaded, ideally this consists also of high-resolution DEM datasets that you specify as user.sf.setup_subgrid(
datasets_dep=datasets_dep,
datasets_rgh=datasets_rgh,
datasets_riv=datasets_riv,
nr_subgrid_pixels=5,
write_dep_tif=True,
write_man_tif=False,
)
Current behaviour
pardon my vscode pathing
---------------------------------------------------------------------------TypeErrorTraceback (mostrecentcalllast)
CellIn[38], [line1](vscode-notebook-cell:?execution_count=38&line=1)
----> [1](vscode-notebook-cell:?execution_count=38&line=1) sf.setup_subgrid(
[2](vscode-notebook-cell:?execution_count=38&line=2) datasets_rgh=datasets_rgh,
[3](vscode-notebook-cell:?execution_count=38&line=3) datasets_dep=datasets_dep,
[4](vscode-notebook-cell:?execution_count=38&line=4) datasets_riv=datasets_riv,
[5](vscode-notebook-cell:?execution_count=38&line=5) nr_subgrid_pixels=5,
[6](vscode-notebook-cell:?execution_count=38&line=6) write_dep_tif=False,
[7](vscode-notebook-cell:?execution_count=38&line=7) write_man_tif=False,
[8](vscode-notebook-cell:?execution_count=38&line=8) )
File~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:744, inSfincsModel.setup_subgrid(self, datasets_dep, datasets_rgh, datasets_riv, buffer_cells, nbins, nr_subgrid_pixels, nrmax, max_gradient, z_minimum, manning_land, manning_sea, rgh_lev_land, write_dep_tif, write_man_tif)
[741](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:741) highres_dir=None
[743](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:743) ifself.grid_type=="regular":
--> [744](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:744) self.reggrid.subgrid.build(
[745](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:745) da_mask=self.mask,
[746](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:746) datasets_dep=datasets_dep,
[747](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:747) datasets_rgh=datasets_rgh,
[748](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:748) datasets_riv=datasets_riv,
[749](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:749) buffer_cells=buffer_cells,
[750](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:750) nbins=nbins,
[751](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:751) nr_subgrid_pixels=nr_subgrid_pixels,
[752](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:752) nrmax=nrmax,
[753](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:753) max_gradient=max_gradient,
[754](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:754) z_minimum=z_minimum,
[755](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:755) manning_land=manning_land,
[756](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:756) manning_sea=manning_sea,
[757](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:757) rgh_lev_land=rgh_lev_land,
[758](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:758) write_dep_tif=write_dep_tif,
[759](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:759) write_man_tif=write_man_tif,
[760](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:760) highres_dir=highres_dir,
[761](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:761) logger=self.logger,
[762](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:762) )
[763](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:763) self.subgrid=self.reggrid.subgrid.to_xarray(
[764](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:764) dims=self.mask.raster.dims, coords=self.mask.raster.coords
[765](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:765) )
[766](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/sfincs.py:766) elifself.grid_type== "quadtree":
File~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:456, inSubgridTableRegular.build(self, da_mask, datasets_dep, datasets_rgh, datasets_riv, nbins, nr_subgrid_pixels, nrmax, max_gradient, z_minimum, manning_land, manning_sea, rgh_lev_land, buffer_cells, write_dep_tif, write_man_tif, highres_dir, logger)
[454](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:454) logger.debug("Burn rivers in bathymetry and manning data")
[455](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:455) forriv_kwargsindatasets_riv:
--> [456](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:456) da_dep, da_man=workflows.bathymetry.burn_river_rect(
[457](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:457) da_elv=da_dep, da_man=da_man, logger=logger, **riv_kwargs
[458](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:458) )
[460](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:460) # optional write tile to file
[461](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:461) # NOTE tiles have overlap! da_dep[:-refi,:-refi]
[462](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/subgrid.py:462) x_dim_dep, y_dim_dep=da_dep.raster.x_dim, da_dep.raster.y_dimFile~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:255, inburn_river_rect(da_elv, gdf_riv, da_man, gdf_zb, gdf_riv_mask, segment_length, riv_bank_q, rivwth_name, rivdph_name, rivbed_name, manning_name, logger)
[253](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:253) gdf_riv["buf"] =res/2
[254](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:254) ifgdf_riv_maskisNone:
--> [255](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:255) gdf_riv_mask=gdf_riv.assign(geometry=gdf_riv.buffer(gdf_riv["buf"]))
[256](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:256) else:
[257](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:257) # get gdf_riv outside of mask and buffer these lines
[258](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:258) # then merge with gdf_riv_mask to get the full river mask
[259](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:259) gdf_mask=gpd.GeoDataFrame(
[260](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:260) geometry=[gdf_riv_mask.buffer(0).unary_union],
[261](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:261) crs=gdf_riv_mask.crs,
[262](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/hydromt_sfincs/workflows/bathymetry.py:262) ) # create single polygon to clip
.
.
.
File~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:323, inGeometryArray.__init__(self, data, crs)
[321](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:321) data=data._data
[322](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:322) elifnotisinstance(data, np.ndarray):
--> [323](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:323) raiseTypeError(
[324](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:324) "'data' should be array of geometry objects. Use from_shapely, "
[325](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:325) "from_wkb, from_wkt functions to construct a GeometryArray."
[326](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:326) )
[327](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:327) elifnotdata.ndim==1:
[328](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:328) raiseValueError(
[329](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:329) "'data' should be a 1-dimensional array of geometry objects."
[330](https://file+.vscode-resource.vscode-cdn.net/Users/taddbindas/projects/hydromt_sfincs/examples/~/miniconda3/envs/test/lib/python3.10/site-packages/geopandas/array.py:330) )
TypeError: 'data'shouldbearrayofgeometryobjects. Usefrom_shapely, from_wkb, from_wktfunctionstoconstructaGeometryArray.
Desired behaviour
A successful burn of rivers into the DEM.
Additional context
There is a bug that has been documented in GeoPandas v1.0.0 which does not allow for distance buffers when using a pd.Series object: geopandas/geopandas#3362
This bug was fixed, and a patch was put out. In the hydromt_sfincspyproject.toml file there is a requirement for geopandas>=1.0 this allows someone to download the buggy geopandas version and their code to fail. The pyproject.toml should be updated to state geopandas>1.0
The text was updated successfully, but these errors were encountered:
HydroMT-SFINCS version checks
Reproducible Example
Current behaviour
pardon my vscode pathing
Desired behaviour
A successful burn of rivers into the DEM.
Additional context
There is a bug that has been documented in GeoPandas v1.0.0 which does not allow for distance buffers when using a
pd.Series
object: geopandas/geopandas#3362This bug was fixed, and a patch was put out. In the
hydromt_sfincs
pyproject.toml
file there is a requirement forgeopandas>=1.0
this allows someone to download the buggy geopandas version and their code to fail. Thepyproject.toml
should be updated to stategeopandas>1.0
The text was updated successfully, but these errors were encountered: