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

Pynhd: GeoConnex NameError #62

Closed
nluft2 opened this issue Aug 21, 2022 · 9 comments
Closed

Pynhd: GeoConnex NameError #62

nluft2 opened this issue Aug 21, 2022 · 9 comments

Comments

@nluft2
Copy link

nluft2 commented Aug 21, 2022

I'm using PythonWin with Python version 3.10 on a windows PC. I was trying out the quick start code for the pynhd package. Once I hit the code: gcx = GeoConnex("gages"). I get a NameError: name GeoConnex is not defined.

I expected my code to assign the value GeoConnex("gages") to the variable gcx.

import pynhd
gcx = GeoConnex("gages")

@cheginit
Copy link
Collaborator

It seems that you forgot to import GeoConnecx. So instead of import pynhd you should have from pynhd import GeoConnex. Alternatively, you can directly use the geoconnex function instead of the GeoConnex class, like so:

import pynhd
gage = pynhd.geoconnex("gages", query={"provider_id": "01031500"})

@nluft2
Copy link
Author

nluft2 commented Aug 21, 2022

I just tried it with gage = pynhd.geoconnex("gages", query={"provider_id": "01031500"}) and I still got a name error.

@cheginit
Copy link
Collaborator

What's the output of pynhd.show_versions()?

@nluft2
Copy link
Author

nluft2 commented Aug 21, 2022

apparently my python version has been reverted to my 3.7 version in this IDE so I will have to change that to python 3.10 but other than that, would any of these other things be an issue?

INSTALLED VERSIONS

commit: None
python: 3.7.11 [MSC v.1927 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
libhdf5: 1.12.0
libnetcdf: 4.8.0

aiodns: 3.0.0
aiohttp: 3.8.1
aiohttp-client-cache: 0.7.3
aiosqlite: 0.17.0
async-retriever: 0.3.2
bottleneck: 1.3.4
brotli: installed
cchardet: 2.1.7
click: 7.1.2
cytoolz: 0.12.0
dask: 2022.02.0
defusedxml: 0.7.1
folium: None
geopandas: 0.9.0
lxml: 4.6.3
matplotlib: 3.4.3
netCDF4: 1.5.7
networkx: 2.5
numpy: 1.20.1
owslib: 0.26.0
pandas: 1.3.5
py3dep: None
pyarrow: 1.0.1
pydantic: 1.9.1
pydaymet: None
pygeohydro: None
pygeoogc: 0.13.1
pygeos: 0.10.2
pygeoutils: 0.13.1
pynhd: 0.13.1
pyproj: 3.1.0
pytest: 6.2.4
pytest-cov: None
rasterio: 1.2.4
requests: 2.28.1
requests-cache: 0.9.5
richdem: None
rioxarray: 0.9.1
scipy: 1.6.2
shapely: 1.7.1
tables: None
ujson: 4.0.2
urllib3: 1.26.11
xarray: 0.20.2
xdist: None
yaml: 5.4.1

@cheginit
Copy link
Collaborator

Since GeoConnex has been added to pynhd in the 0.13.1 version, you shouldn't have any issue using it. Can you please update your pynhd version to the latest (0.13.3) just to make sure you have this issue with the latest version as well. I just tested it with 0.13.3 and it works as expected.

@nluft2
Copy link
Author

nluft2 commented Aug 21, 2022

I can't seem to update the pynhd version.

@cheginit
Copy link
Collaborator

Right, the reason is that pynhd 0.13.2+ only supports Python 3.8+ since many of its dependencies (like xarray, pandas, and geopandas) have already dropped support for Python 3.7. So, first, you need to update your Python version to 3.8+ then you can update pynhd to the latest version.

@cheginit
Copy link
Collaborator

Did you still have this issue after the update?

@nluft2
Copy link
Author

nluft2 commented Aug 25, 2022

No, issue resolved. Thanks.

@nluft2 nluft2 closed this as completed Aug 25, 2022
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