-
Notifications
You must be signed in to change notification settings - Fork 9
Description
What happened?
I utilized your tutorial to split a small watershed at the location of the gage. The geometry results of split_catchment do not match those of the NLDI get_basin. I pulled the NHD flowlines for high and medium resolution. It looks like the difference in geometry is associated with the difference in flowline resolution. Is it safe to assume that split_catchment does not use high resolution flowlines/DEM data for delineation?
What did you expect to happen?
I expected to be able to split the basin at the gage to get upstream watershed geometry that matches the NLDI get_basin geometry.
I was able to use split_catchment successfully on two other small watersheds with no discrepancies. It's possible I found an edge case with this specific gage? I wouldn't expect the difference to matter much on larger watersheds but it could potentially on small watersheds.
Minimal Complete Verifiable Example
from pygeohydro import NWIS
from pynhd import NLDI
import geopandas as gpd
import shapely.geometry as sgeom
import pynhd
import matplotlib.pyplot as plt
station_id = 'USGS-06896500'
site = NWIS().get_info({'site': station_id.split('-')[-1]})
basin = NLDI().get_basins(station_id, split_catchment=False, simplified=False)
gdf = gpd.GeoDataFrame(
{
"upstream": [
False,
]
},
geometry = [sgeom.Point((site.geometry.iloc[0].coords[0]))],
crs=site.crs,
)
split = pynhd.pygeoapi(gdf, 'split_catchment')
nhd_hr = pynhd.NHDPlusHR("flowline")
nhd_mr = pynhd.NHD('flowline_mr')
flw_mr = nhd_mr.bygeom(basin.geometry.iloc[0], basin.crs)
flw_hr = nhd_hr.bygeom(basin.geometry.iloc[0], basin.crs)
ax = split.plot(figsize=(8, 8), facecolor="lightgrey", edgecolor="black", alpha=0.8) #, label='pygeoapi split_catchment')
site.plot(ax=ax, color='r')
basin.boundary.plot(ax=ax, color='r', label='get_basin similified=False')
plt.title(f'{station_id} get_basin vs split_catchment comparison')
flw_hr.plot(ax=ax, color='C0', label='flowline hr')
flw_mr.plot(ax=ax, color='C2', label='flowline mr')
plt.legend(loc='upper left')MVCE confirmation
- Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue.
- Complete example — the example is self-contained, including all data and the text of any traceback.
- New issue — a search of GitHub Issues suggests this is not a duplicate.
Relevant log output
Anything else we need to know?
No response
Environment
SYS INFO
commit: None
python: 3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:06:27) [MSC v.1942 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 186 Stepping 2, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: ('English_United States', '1252')