Closed onnyyonn closed 2 years ago
Thanks for pointing this out! I missed updating the readme file. I changed the API several versions ago, it should be:
from pygeohydro import NWIS
nwis = NWIS()
query = {
"bBox": ",".join(f"{b:.06f}" for b in bbox),
"hasDataTypeCd": "dv",
"outputDataTypeCd": "dv",
}
info_box = nwis.get_info(query)
dates = ("2000-01-01", "2010-12-31")
stations = info_box[
(info_box.begin_date <= dates[0]) & (info_box.end_date >= dates[1])
].site_no.tolist()
I'll update the readme.
Please feel free to reopen if you found another issue in the readme. You can also check out this tutorial which includes the same examples that are in the readme.
On a related note, are the keys accepted in the query listed anywhere in the docs? I have looked at https://docs.hyriver.io/autoapi/pygeohydro/waterdata/index.html but did not find it.
No, you need to check NWIS's website, there are too many keys and values that can be used and combined. You can find all of them here. I will add this link to NWIS
docstrings.
There's also a helper function in NWIS
class that searches for available codes, called get_parameter_codes
I see. Thank you.
What happened: Running the example code to generate a list of NWIS sites throws the following error
'NWIS' object has no attribute 'query_bybox'
Minimal Complete Verifiable Example:
Environment:
Output of pygeohydro.show_versions()
INSTALLED VERSIONS commit: None python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:10) [GCC 10.3.0] python-bits: 64 OS: Linux OS-release: 4.15.0-167-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US LOCALE: en_US.ISO8859-1 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: 6.7 cytoolz: 0.11.2 dask: 2022.6.1 defusedxml: 0.7.1 folium: 0.12.1.post1 geopandas: 0.11.0 lxml: 4.8.0 matplotlib: 3.4.3 netCDF4: 1.6.0 networkx: 2.8.4 numpy: 1.23.0 owslib: 0.25.0 pandas: 1.4.3 py3dep: 0.13.1 pyarrow: 6.0.1 pydantic: 1.9.1 pydaymet: 0.13.1 pygeohydro: 0.13.2 pygeoogc: 0.13.2 pygeos: 0.12.0 pygeoutils: 0.13.2 pynhd: 0.13.2 pyproj: 3.3.0 pytest: None pytest-cov: None rasterio: 1.2.10 requests: 2.28.1 requests-cache: 0.9.4 richdem: 0.3.4 rioxarray: 0.11.1 scipy: 1.8.1 shapely: 1.8.2 tables: 3.7.0 ujson: 5.3.0 urllib3: 1.26.9 xarray: 2022.3.0 xdist: None yaml: 6.0``` ```