azavea / noaa-hydro-data

NOAA Phase 2 Hydrological Data Processing
11 stars 3 forks source link

Task 3-1: Develop NHDPlus Library for Python #35

Closed lewfish closed 2 years ago

lewfish commented 2 years ago

Azavea will develop an NHDPlus data access library for Python and publish it under an open source license to support a wider audience for its ongoing contribution and stewardship. The availability of this library will greatly simplify the use of NWM outputs by modelers in the Jupyter Notebook environment.

rajadain commented 2 years ago

Designing a library depends on the kinds of queries we'll have to run. Tasks 1 and 2 will inform that design.

lewfish commented 2 years ago

We should also see if HyRiver already has this functionality.

rajadain commented 2 years ago

HyRiver does provide NHD access through the PyNHD package. This queries the WaterData web service under the hood, and supports both Medium Resolution and High Resolution querying.

A full demo can be seen in this notebook: https://github.com/hyriver/HyRiver-examples/blob/main/notebooks/nhdplus.ipynb. Specifically, these lines show how PyNHD is used to query streams:

from pynhd import NHDPlusHR, WaterData

geometry = ???

nhdp_mr = WaterData("nhdflowline_network")
flw_mr = nhdp_mr.bybox(geometry.bounds)

nhdp_hr = NHDPlusHR("flowline")
flw_hr = nhdp_hr.bygeom(geometry.bounds)
rajadain commented 2 years ago

In addition, it also pulls data from NHD MR and NHDPlus HR web services.