Replies: 1 comment
-
This seems to be fixed here: Deltares/hydromt_sfincs#230 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, everyone, I tried to execute the build from script.ipynb, but encountered the following issue. I have checked the data source, and there is no problem. I have attached my environment details. Can someone help me? Thanks.
my_environment.txt
IndexError Traceback (most recent call last)
Cell In[22], line 4
1 # derive river from hydrography data based on a minimum river length (river_len)
2 # and minimum upstream area (river_upa)
----> 4 sf.setup_river_inflow(
5 hydrography="merit_hydro", river_len=1000, river_upa=50, keep_rivers_geom=True
6 )
8 # Make a plot of model
9 # note the src points and derived river network
10 fig, ax = sf.plot_basemap(variable="dep", plot_bounds=False, bmap="sat", zoomlevel=12)
File ~\anaconda3\envs\hydromt-sfincs\lib\site-packages\hydromt_sfincs\sfincs.py:907, in SfincsModel.setup_river_inflow(self, rivers, hydrography, buffer, river_upa, river_len, river_width, merge, first_index, keep_rivers_geom, reverse_river_geom, src_type)
903 gdf_riv = self.data_catalog.get_geodataframe(
904 rivers, geom=self.region
905 ).to_crs(self.crs)
906 elif hydrography is not None:
--> 907 gdf_riv = workflows.river_centerline_from_hydrography(
908 da_flwdir=ds["flwdir"],
909 da_uparea=da_uparea,
910 river_upa=river_upa,
911 river_len=river_len,
912 gdf_mask=self.region,
913 )
914 elif hydrography is None:
915 raise ValueError("Either hydrography or rivers must be provided.")
File ~\anaconda3\envs\hydromt-sfincs\lib\site-packages\hydromt_sfincs\workflows\flwdir.py:71, in river_centerline_from_hydrography(da_flwdir, da_uparea, river_upa, river_len, gdf_mask)
69 return gdf_riv
70 # accumulate to get river length from outlet
---> 71 flwdir = pyflwdir.from_dataframe(gdf_riv.set_index("idx"), ds_col="idx_ds")
72 gdf_riv["rivdst"] = flwdir.accuflux(gdf_riv["seglen"].values, direction="down")
73 # get maximum river length from outlet (at headwater segments) for each river segment
File ~\anaconda3\envs\hydromt-sfincs\lib\site-packages\pyflwdir\flwdir.py:53, in from_dataframe(df, ds_col)
51 idxs_ds = df[ds_col].values
52 idxs = df.index.values
---> 53 return Flwdir(idxs_ds=get_loc_idx(idxs=idxs, idxs_ds=idxs_ds))
File ~\anaconda3\envs\hydromt-sfincs\lib\site-packages\pyflwdir\flwdir.py:32, in get_loc_idx(idxs, idxs_ds)
30 idx_map.fill(-1) # Fill with -1 to indicate missing values
31 idx_map[idxs] = np.arange(idxs.size)
---> 32 return idx_map[idxs_ds]
IndexError: index 16162 is out of bounds for axis 0 with size 10589
Beta Was this translation helpful? Give feedback.
All reactions