Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using nhd.byids("COMID", main.index.tolist()) (River Elevation and Cross-Section example) #60

Closed
LucRSquared opened this issue Jul 18, 2022 · 2 comments

Comments

@LucRSquared
Copy link

What happened:
I'm just trying to run the example notebook "River Elevation and Cross-Section"

I got an error at cell 13 when trying to query the flowlines by COMID

image

I get a JSONDecodeError

image

Minimal Complete Verifiable Example:
This simple code produces the same error:

nhd = NHD("flowline_mr")
main_nhd = nhd.byids('COMID',['1722317'])

Environment:

Output of pynhd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:50:36) [MSC v.1929 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 141 Stepping 1, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: English_United States.1252
libhdf5: 1.12.1
libnetcdf: 4.8.1

aiodns: 3.0.0
aiohttp: 3.8.1
aiohttp-client-cache: 0.7.1
aiosqlite: 0.17.0
async-retriever: 0.3.3
bottleneck: 1.3.4
brotli: installed
cchardet: 2.1.7
click: 8.1.3
cytoolz: 0.11.2
dask: 2022.6.1
defusedxml: 0.7.1
folium: 0.12.1.post1
geopandas: 0.11.0
lxml: 4.9.0
matplotlib: 3.4.3
netCDF4: 1.5.8
networkx: 2.8.4
numpy: 1.23.0
owslib: 0.25.0
pandas: 1.4.3
py3dep: 0.0
pyarrow: 6.0.0
pydantic: 1.9.1
pydaymet: 0.13.2
pygeohydro: 0.13.2
pygeoogc: 0.13.2
pygeos: 0.12.0
pygeoutils: 0.13.2
pynhd: 0.13.2
pyproj: 3.3.1
pytest: None
pytest-cov: None
rasterio: 1.2.10
requests: 2.28.0
requests-cache: 0.9.4
richdem: None
rioxarray: 0.11.1
scipy: 1.8.1
shapely: 1.8.2
tables: None
ujson: 5.3.0
urllib3: 1.26.9
xarray: 2022.3.0
xdist: None
yaml: 6.0
@cheginit
Copy link
Collaborator

It sounds like when you ran the notebook the NHD web service that the NHD class uses was down. I just reran the notebook and it worked just fine.

You can see that the function throws ServiceError exception (below JSONDecodeError) which indicates that service is not working.

By the way, other than the NHD class you can also use WaterData class to get the medium-res flowlines.

@LucRSquared
Copy link
Author

Thank you! I just retried and it worked. Thanks for the WaterData tip! I'm closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants