hyriver / pygeohydro

A part of HyRiver software stack for accessing hydrology data through web services
https://docs.hyriver.io
Other
68 stars 23 forks source link

WBD Feature returning keyerror: 'layers' #103

Closed inskeepjoey closed 1 year ago

inskeepjoey commented 1 year ago

What happened?

image When loading a huc6 byid, received KeyError: "layers"

What did you expect to happen?

Expected huc6 170900 polygon to be loaded into notebook.

Minimal Complete Verifiable Example

No response

MVCE confirmation

Relevant log output

No response

Anything else we need to know?

No response

Environment

inskeepjoey commented 1 year ago

had loaded pygeohydro module: from pygeohydro import WBD

cheginit commented 1 year ago

I am not able to reproduce the error, please make sure you have the latest versions of HyRiver packages and their dependencies.

image

Also, please provide info about your environment, following the issue report guidelines using pygeohydro.show_versions(). For example, this is mine that works without any issues:

```console SYS INFO -------- commit: None python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:17:34) [Clang 14.0.6 ] python-bits: 64 OS: Darwin OS-release: 22.3.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: en_US.UTF-8 libhdf5: 1.12.2 libnetcdf: 4.9.1 PACKAGE VERSION ------------------------------- aiodns 3.0.0 aiohttp 3.8.4 aiohttp-client-cache 0.8.1 aiosqlite 0.18.0 async-retriever 0.14.1.dev11+g08ad47b bottleneck 1.3.7 brotli 1.0.9 click 8.0.3 cytoolz 0.12.0 dask 2023.3.2 defusedxml 0.7.1 folium 0.14.0 geopandas 0.12.2 h5netcdf 1.1.0 hydrosignatures 0.14.0 lxml 4.9.2 matplotlib 3.7.1 netCDF4 1.6.3 networkx 3.0 numba 0.56.4 numpy 1.23.5 owslib 0.28.1 pandas 1.5.3 py3dep 0.14.0 pyarrow 11.0.0 pydaymet 0.14.0 pygeohydro 0.14.1.dev20+gfe3d424.d20230324 pygeoogc 0.14.0 pygeos N/A pygeoutils 0.14.0 pynhd 0.14.0 pynldas2 0.14.0 pyproj 3.4.1 pytest 7.2.2 pytest-cov 4.0.0 rasterio 1.3.6 requests 2.28.2 requests-cache 1.0.1 richdem N/A rioxarray 0.14.0 scipy 1.10.1 shapely 2.0.1 tables 3.7.0 ujson 5.7.0 urllib3 1.26.15 xarray 2023.3.0 xdist N/A yaml N/A ------------------------------- ```
inskeepjoey commented 1 year ago

Ok, sounds good. I did double check that the dependencies were up to date, I may have missed something. Thanks.

inskeepjoey commented 1 year ago

~SYS INFO

commit: 4b9748161d8b0ea1955106322499ea680564179a python: 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:41:22) [MSC v.1929 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 165 Stepping 2, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: English_United States.1252 libhdf5: 1.12.2 libnetcdf: 4.8.1

PACKAGE VERSION

aiodns N/A aiohttp 3.8.4 aiohttp-client-cache 0.8.1 aiosqlite 0.18.0 async-retriever 0.14.0 bottleneck N/A brotli N/A click 8.1.3 cytoolz 0.12.0 dask 2023.1.0 defusedxml 0.7.1 folium 0.14.0 geopandas 0.12.2 h5netcdf 1.1.0 hydrosignatures 0.14.0 lxml 4.9.2 matplotlib 3.7.1 netCDF4 1.6.2 networkx 3.0 numba 0.56.4 numpy 1.23.5 owslib 0.28.1 pandas 1.5.3 py3dep N/A pyarrow 11.0.0 pydaymet N/A pygeohydro 0.14.0 pygeoogc 0.14.0 pygeos 0.14 pygeoutils 0.14.0 pynhd 0.14.0 pynldas2 N/A pyproj 3.4.1 pytest N/A pytest-cov N/A rasterio 1.3.4 requests 2.28.2 requests-cache 1.0.1 richdem N/A rioxarray 0.13.3 scipy 1.10.1 shapely 2.0.1 tables N/A ujson 5.7.0 urllib3 1.26.15 xarray 2022.12.0 xdist N/A yaml N/A -------------------------------~

cheginit commented 1 year ago

It seems that your xarray and python versions are outdated. Please create a new environment and only install pygeohydro so we can narrow down the issue. Also, please report the full traceback so I can see which line of code is throwing this error.

inskeepjoey commented 1 year ago

I have no idea why but I still get the KeyError: 'layers'. I created a new environment and only installed pygeohydro, as well as made sure that the dependencies were the correct versions. I'm not sure what you mean by full traceback. I only get the KeyError: 'layers' message that I included above in the screen shot. image

cheginit commented 1 year ago

Can you try running this in an python REPL instead of notebook? Maybe notebook is suppressing the full traceback. You can just open up a terminal, activate this environment, then type python and write and run your code there. Unless I see which library at what line of code is throwing this error, there's not much I can do, since I cannot reproduce this error on my end. I just created a new env with mamba create -n test python=3.9 pygeohydro to be similar to yours and used python's REPL:

image
inskeepjoey commented 1 year ago

That works when I run in python REPL. I'm curious why notebook is suppressing the full traceback.

image

cheginit commented 1 year ago

I don't know what's wrong with your notebook's instance. I am guessing it has to do with the way that you create python environments that notebook uses.

inskeepjoey commented 1 year ago

I'll focus on that for trouble shooting. Thanks for the help.