NLDI Flowtools
==============
**Version:** |version|
Basin delineation and flow path tracing for any point within CONUS, powered by
`NHDPlus V2 `_
data and the `Network Linked Data Index `_.
.. code-block:: python
from nldi_flowtools.nldi_flowtools import splitcatchment, flowtrace
# Delineate the full upstream drainage basin
basin = splitcatchment(lon=-93.0, lat=45.0, upstream=True, simplified=True)
# Trace the flow path to the nearest stream
trace = flowtrace(lon=-93.0, lat=45.0, direction="down")
Both functions accept WGS 84 longitude/latitude coordinates and return GeoJSON
FeatureCollections.
Tools
-----
**Split Catchment** — Identifies the NHD catchment containing a point and
delineates the upstream contributing area. Can return either the local split
portion or the full upstream drainage basin merged with all upstream catchments.
**Flow Trace** — Follows the 30m flow direction grid downhill from a point
until it intersects an NHD stream. Returns the traced raindrop path and the
intersected stream segment (upstream, downstream, or full geometry).
.. tip::
When delineating a point on a stream, run it through ``flowtrace`` first to
snap the point to the flowline. Use the returned intersection point as input
to ``splitcatchment`` for the most accurate basin boundary.
Installation
------------
.. code-block:: bash
pip install nldi-flowtools
Requirements: Python 3.10 -- 3.14.
For development setup, see the :doc:`contributing`.
Authors
-------
Anders Hopkins — *Lead Developer* —
`USGS Web Informatics & Mapping `_
Acknowledgments
---------------
- Hydrologic delineations use an algorithm borrowed from
`SS-Delineate `_.
- Developed in collaboration with `@rmcd `_'s
`NLDI XStools `_.
- Cloud-optimized flow direction raster hosted by
`@dblodgett `_.
.. toctree::
:hidden:
:maxdepth: 2
Usage
Modules
Contributing
Code of Conduct
Disclaimer
License
Reference