-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Problem statement
Sometimes, geofabrics do not have any river segment for basins that are non-contributing. An example is the coastal hillslope catchments of MERIT-Basins dataset. In this case, the create_network_topology_file.py throws an error and complains about the mismatch in the length of shp_basin and she_river.
Temporary solution
As a temporary solution, I have added the following lines just before creating the topology netcdf file:
# finding basins without a river network - Non-contributing areas
missing_seg = shp_basin[~shp_basin[river_seg_id].isin(shp_river[river_seg_id])]
missing_ids = missing_seg[basin_hru_id]
last_seg_id = shp_river[river_seg_id].astype(int).max()
# assinging fictitious ids to river segements of NCA basins in the `shp_basin`
missing_seg_ids = range(last_seg_id + 1, last_seg_id + len(missing_ids) + 1)
shp_basin.loc[shp_basin[basin_hru_id].isin(missing_ids), river_seg_id] = missing_seg_ids
# creating fictitious ids for river segments of the NCA basins in the `shp_river`
cols = shp_river.columns.to_list()
fict_seg = pd.DataFrame(data=[[0]*len(cols)]*len(missing_ids), columns=cols)
fict_seg[river_seg_id] = missing_seg_ids
shp_river = gpd.GeoDataFrame(pd.concat([shp_river, fict_seg]))Long-term solution
Something to discuss...
Metadata
Metadata
Assignees
Labels
No labels