usgs-data-download

v0.1.0

Download water level data from USGS using the dataretrieval package. Use when accessing real-time or historical streamflow data, downloading gage height or d...

0· 70·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for wu-uk/flood-risk-analysis-usgs-data-download.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "usgs-data-download" (wu-uk/flood-risk-analysis-usgs-data-download) from ClawHub.
Skill page: https://clawhub.ai/wu-uk/flood-risk-analysis-usgs-data-download
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install flood-risk-analysis-usgs-data-download

ClawHub CLI

Package manager switcher

npx clawhub@latest install flood-risk-analysis-usgs-data-download
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description match the content: the SKILL.md explains how to use the dataretrieval package to fetch USGS gage data (instantaneous and daily), including code examples and parameter codes. Nothing requested is unrelated to downloading USGS data.
Instruction Scope
Runtime instructions are narrowly scoped to installing dataretrieval, calling nwis.get_iv/get_dv/get_info, handling empty results, and rate-limiting. The guide does not instruct reading unrelated files, accessing environment variables, or sending data to unexpected endpoints.
Install Mechanism
There is no platform install spec (instruction-only), but the guide tells the user to run `pip install dataretrieval`. This is expected for a Python-based HOWTO; be aware pip installs code from PyPI (unreviewed) — consider using a virtualenv, pinning a version, and reviewing the package source before installation.
Credentials
The skill declares no required environment variables, credentials, or config paths and the instructions do not reference any secrets. Network access to USGS endpoints is required, which is appropriate for the stated purpose.
Persistence & Privilege
Skill is instruction-only with no install-time persistence requested and always:false. It does not request permanent presence or modify other skills or system-wide configurations.
Assessment
This guide appears coherent and appropriate for downloading USGS data. Before using it: run pip install in an isolated virtualenv, pin or review the dataretrieval package/version you install, be aware that downloads can be large and USGS may rate-limit requests (add delays or split date ranges), and verify station IDs and date ranges to avoid empty downloads. No credentials are required by the guide.

Like a lobster shell, security has layers — review code before you run it.

latestvk975btftzwjsckq6r4ateavpth84x7m6
70downloads
0stars
1versions
Updated 1w ago
v0.1.0
MIT-0

USGS Data Download Guide

Overview

This guide covers downloading water level data from USGS using the dataretrieval Python package. USGS maintains thousands of stream gages across the United States that record water levels at 15-minute intervals.

Installation

pip install dataretrieval

nwis Module (Recommended)

The NWIS module is reliable and straightforward for accessing gage height data.

from dataretrieval import nwis

# Get instantaneous values (15-min intervals)
df, meta = nwis.get_iv(
    sites='<station_id>',
    start='<start_date>',
    end='<end_date>',
    parameterCd='00065'
)

# Get daily values
df, meta = nwis.get_dv(
    sites='<station_id>',
    start='<start_date>',
    end='<end_date>',
    parameterCd='00060'
)

# Get site information
info, meta = nwis.get_info(sites='<station_id>')

Parameter Codes

CodeParameterUnitDescription
00065Gage heightfeetWater level above datum
00060DischargecfsStreamflow volume

nwis Module Functions

FunctionDescriptionData Frequency
nwis.get_iv()Instantaneous values~15 minutes
nwis.get_dv()Daily valuesDaily
nwis.get_info()Site informationN/A
nwis.get_stats()Statistical summariesN/A
nwis.get_peaks()Annual peak dischargeAnnual

Returned DataFrame Structure

The DataFrame has a datetime index and these columns:

ColumnDescription
site_noStation ID
00065Water level value
00065_cdQuality code (can ignore)

Downloading Multiple Stations

from dataretrieval import nwis

station_ids = ['<id_1>', '<id_2>', '<id_3>']
all_data = {}

for site_id in station_ids:
    try:
        df, meta = nwis.get_iv(
            sites=site_id,
            start='<start_date>',
            end='<end_date>',
            parameterCd='00065'
        )
        if len(df) > 0:
            all_data[site_id] = df
    except Exception as e:
        print(f"Failed to download {site_id}: {e}")

print(f"Successfully downloaded: {len(all_data)} stations")

Extracting the Value Column

# Find the gage height column (excludes quality code column)
gage_col = [c for c in df.columns if '00065' in str(c) and '_cd' not in str(c)]

if gage_col:
    water_levels = df[gage_col[0]]
    print(water_levels.head())

Common Issues

IssueCauseSolution
Empty DataFrameStation has no data for date rangeTry different dates or use get_iv()
get_dv() returns emptyNo daily gage height dataUse get_iv() and aggregate
Connection errorNetwork issueWrap in try/except, retry
Rate limitedToo many requestsAdd delays between requests

Best Practices

  • Always wrap API calls in try/except for failed downloads
  • Check len(df) > 0 before processing
  • Station IDs are 8-digit strings with leading zeros (e.g., '04119000')
  • Use get_iv() for gage height, as daily data is often unavailable
  • Filter columns to exclude quality code columns (_cd)
  • Break up large requests into smaller time periods to avoid timeouts

Comments

Loading comments...