/** * USGS SDK — typed API client for earthquake data and water data. * * Standalone — no MCP server required. Usage: * * import { searchEarthquakes, getWaterData } from "us-gov-open-data-mcp/sdk/usgs"; * * const quakes = await searchEarthquakes({ minmagnitude: 5, starttime: "2024-01-01" }); * const water = await getWaterData({ sites: "01646500", parameterCd: "00060" }); * * Earthquakes need no key. The USGS Water Data APIs (api.waterdata.usgs.gov) * allow a few anonymous requests per hour; they run on api.data.gov, so an * existing DATA_GOV_API_KEY raises the limit to 1,000/hour. * Docs: * Earthquake: https://earthquake.usgs.gov/fdsnws/event/1/ * Water Data APIs: https://api.waterdata.usgs.gov/docs/ogcapi/ * Water statistics: https://api.waterdata.usgs.gov/statistics/v0/docs * (these replace waterservices.usgs.gov, decommissioned Nov 2026–Feb 2027) */ /** "01646500" or "USGS-01646500" → "USGS-01646500". */ export declare function toMonitoringLocationId(site: string): string; /** Earthquake Feature. */ export interface EarthquakeFeature { type: "Feature"; properties: { mag?: number; place?: string; time?: number; updated?: number; tz?: number; url?: string; detail?: string; felt?: number; cdi?: number; mmi?: number; alert?: string; status?: string; tsunami?: number; sig?: number; net?: string; code?: string; ids?: string; sources?: string; types?: string; nst?: number; dmin?: number; rms?: number; gap?: number; magType?: string; type?: string; title?: string; [key: string]: unknown; }; geometry: { type: "Point"; coordinates: [number, number, number]; }; id: string; } /** Earthquake Response. */ export interface EarthquakeResponse { type: "FeatureCollection"; metadata: { generated: number; url: string; title: string; status: number; api: string; count: number; }; features: EarthquakeFeature[]; } /** Earthquake Count. */ export interface EarthquakeCount { count: number; maxAllowed: number; } /** Common USGS water parameter codes. */ export declare const WATER_PARAMS: { readonly "00060": "Discharge (cubic feet per second)"; readonly "00065": "Gage height (feet)"; readonly "00010": "Temperature, water (°C)"; readonly "00400": "pH"; readonly "00300": "Dissolved oxygen (mg/L)"; readonly "00095": "Specific conductance (µS/cm)"; readonly "00045": "Precipitation (inches)"; readonly "72019": "Depth to water level (feet below land surface)"; }; /** Earthquake alert levels. */ export declare const ALERT_LEVELS: { readonly green: "Limited impact — no damage expected"; readonly yellow: "Regional impact — some damage possible"; readonly orange: "National/international impact — significant damage likely"; readonly red: "Massive impact — extensive damage and casualties expected"; }; /** * Search for earthquakes using USGS FDSN Event Web Service. * * Example: * const quakes = await searchEarthquakes({ minmagnitude: 5, starttime: "2024-01-01" }); * const nearby = await searchEarthquakes({ latitude: 37.77, longitude: -122.42, maxradiuskm: 100 }); */ export declare function searchEarthquakes(opts: { starttime?: string; endtime?: string; minmagnitude?: number; maxmagnitude?: number; mindepth?: number; maxdepth?: number; latitude?: number; longitude?: number; maxradiuskm?: number; minlatitude?: number; maxlatitude?: number; minlongitude?: number; maxlongitude?: number; limit?: number; orderby?: "time" | "time-asc" | "magnitude" | "magnitude-asc"; alertlevel?: "green" | "yellow" | "orange" | "red"; }): Promise; /** * Count earthquakes matching the given criteria. * * Example: * const count = await countEarthquakes({ minmagnitude: 4, starttime: "2024-01-01" }); */ export declare function countEarthquakes(opts: { starttime?: string; endtime?: string; minmagnitude?: number; maxmagnitude?: number; latitude?: number; longitude?: number; maxradiuskm?: number; }): Promise; /** * Get the latest significant earthquakes (last 30 days, magnitude 4.5+). */ export declare function getSignificantEarthquakes(): Promise; /** One observation from the continuous or daily collections. */ export interface WaterObservation { monitoringLocationId: string; /** Identifies one sensor/record series; a site can have several per parameter. */ timeSeriesId: string | null; parameterCode: string; statisticId: string | null; time: string; value: number | null; unit: string | null; approvalStatus: string | null; } /** Summary of one time series (site × parameter × statistic). */ export interface WaterSeries { monitoringLocationId: string; siteNo: string; siteName: string | null; parameterCode: string; statisticId: string | null; unit: string | null; count: number; earliest: { time: string; value: number | null; } | null; latest: { time: string; value: number | null; } | null; min: number | null; max: number | null; mean: number | null; } /** Most observations fetched per request (the API pages at 10 by default). */ export declare const WATER_OBSERVATION_LIMIT = 10000; /** * Get real-time ("continuous", formerly instantaneous-value) water data. * * With `sites`, returns every reading in the time window (default: last day). * With only `stateCd`, returns the latest reading of each reporting site in * the state (the window is ignored). The continuous collection allows at * most three years per request. * * Example: * const { series } = await getWaterData({ sites: "01646500", parameterCd: "00060" }); * const { series } = await getWaterData({ stateCd: "CA", parameterCd: "00060" }); */ export declare function getWaterData(opts: { /** Site numbers or monitoring-location IDs, comma-separated. */ sites?: string; /** State as USPS code, name, or FIPS (used when `sites` is omitted). */ stateCd?: string; parameterCd?: string; /** ISO 8601 duration, default P1D. */ period?: string; startDT?: string; endDT?: string; }): Promise<{ series: WaterSeries[]; truncated: boolean; mode: "window" | "latest"; }>; /** A USGS monitoring location (from the Water Data APIs). */ export interface WaterSite { /** "USGS-01646500" */ monitoringLocationId: string; /** "01646500" */ siteNo: string; name: string | null; siteTypeCode: string | null; siteType: string | null; state: string | null; county: string | null; hucCode: string | null; /** Drainage area, square miles. */ drainageArea: number | null; latitude: number | null; longitude: number | null; } /** Default and maximum sites returned by searchWaterSites. */ export declare const WATER_SITES_DEFAULT_LIMIT = 200; export declare const WATER_SITES_MAX_LIMIT = 1000; /** * Search USGS water monitoring locations by state, county, and site type. * Includes inactive/historical sites (the Water Data APIs have no "active" * filter). `truncated` is true when the limit was reached. * * Example: * const { sites } = await searchWaterSites({ stateCd: "MD", siteType: "ST" }); */ export declare function searchWaterSites(opts: { /** State as USPS code, name, or FIPS. */ stateCd?: string; /** County FIPS: 5 digits (state + county, e.g. "24031") or 3 digits with stateCd. */ countyCd?: string; /** ST (stream, default), GW (groundwater), LK (lake), SP (spring), etc. */ siteType?: string; limit?: number; }): Promise<{ sites: WaterSite[]; truncated: boolean; }>; /** * Get USGS daily values (daily summaries of the continuous record; by * default the daily mean, statistic 00003). * * With `sites`, returns the daily values in the window (default: last 30 * days). With only `stateCd`, returns daily values for every site in the * state over the window, which can hit the observation limit for large * states or long windows (`truncated`). * * Example: * const { series } = await getDailyWaterData({ sites: "01646500", parameterCd: "00060", period: "P30D" }); * const { series } = await getDailyWaterData({ sites: "01646500", startDT: "2024-01-01", endDT: "2024-12-31" }); */ export declare function getDailyWaterData(opts: { /** Site numbers or monitoring-location IDs, comma-separated. */ sites?: string; /** State as USPS code, name, or FIPS (used when `sites` is omitted). */ stateCd?: string; parameterCd?: string; /** ISO 8601 duration, default P30D. */ period?: string; startDT?: string; endDT?: string; /** Statistic code: 00003 mean (default), 00001 max, 00002 min, 00008 median. */ statCd?: string; }): Promise<{ series: WaterSeries[]; truncated: boolean; }>; /** Period-of-record statistics for one day of the year (daily) or month (monthly). */ export interface WaterStatRow { site: string; month: number; /** Day of month; null for monthly statistics. */ day: number | null; /** Years of daily values the statistics are computed from. */ yearsOfRecord: number | null; min: number | null; p05: number | null; p10: number | null; p25: number | null; median_p50: number | null; mean: number | null; p75: number | null; p90: number | null; p95: number | null; max: number | null; } /** Statistics of the daily means within one calendar year. */ export interface WaterAnnualRow { site: string; year: number; mean: number | null; min: number | null; max: number | null; median: number | null; /** Days of record in the year. */ daysOfRecord: number | null; } /** * Get period-of-record water statistics for sites and a parameter. * * - `daily`: for each day of the year, min/mean/max and p05–p95 across all * years of record — "is today's flow historically high or low?" * - `monthly`: the same per month of the year. * - `annual`: mean/min/max/median of the daily means in each calendar year. * * Uses the Water Data statistics API (observationNormals / observationIntervals). */ export declare function getWaterStatistics(opts: { /** Site numbers or monitoring-location IDs, comma-separated. */ sites: string; parameterCd?: string; statReportType?: "daily" | "monthly" | "annual"; /** Month (1-12) to filter daily or monthly statistics. */ month?: number; /** Day of month (requires month; daily only). */ day?: number; }): Promise<{ reportType: "daily" | "monthly" | "annual"; rows: WaterStatRow[] | WaterAnnualRow[]; }>; /** Clear all USGS caches. */ export declare function clearCache(): void; //# sourceMappingURL=sdk.d.ts.map