# TORRENT generic tools Standalone utilities for working with (and extending) the TORRENT dataset. They talk only to public agency services — USGS NWIS, USGS NLDI, and the Iowa State MT MRMS archive — and never require the authors' build environment. Requirements: Python ≥3.9, `pandas`, `requests`; `download_forcing.py` also needs `rasterio` (GDAL with the GRIB driver), `shapely`, `numpy`. | Tool | Purpose | |---|---| | `find_gauges.py` | List stream gauges near an episode (by TORRENT episode ID or lat/lon) and optionally check NWIS discharge/stage availability over the event window — the candidate-generation step as a utility. | | `download_streamflow.py` | Fetch the NWIS IV discharge record for a gauge over the standard window (begin −24 h … end +72 h) → `streamflow.csv`. | | `get_watershed.py` | Retrieve the NLDI contributing watershed for a gauge → `watershed.geojson` (retries transient NLDI failures). | | `download_forcing.py` | Download 2-min MRMS PrecipRate for a window, clip to a watershed, write the basin-mean series → `mrms_2min_precip_basin_mean.csv`. Use it to add forcing to the 115 light packages. | | `build_testbed.py` | Compose the above into a candidate testbed package (watershed + streamflow + summary) for any episode–gauge pair. | ## Typical session ```bash # which gauges could observe this episode? python find_gauges.py --episode FF_2025_07_TX_ep002 --radius 50 --check-iv # build a candidate package for one of them python build_testbed.py --episode FF_2025_07_TX_ep002 --gauge 08165500 --outdir ./my_testbeds # add forcing (also works for the released light packages) python download_forcing.py \ --watershed ./my_testbeds/FF_2025_07_TX_ep002/08165500/watershed.geojson \ --begin 2025-07-04T02:00 --end 2025-07-04T17:41 --cache ./mrms_cache \ --out ./my_testbeds/FF_2025_07_TX_ep002/08165500/mrms_2min_precip_basin_mean.csv ``` Notes - Basin-mean values from `download_forcing.py` agree with the released series to within a few percent (mask-rasterization details differ slightly from the release pipeline). - Packages built this way are **candidates**: apply the screening criteria in `code/pipeline` (paper Sect. 3.4) before comparing them with benchmark testbeds. - NLDI throttles around 800 requests/hour; most failures are transient — retry.