/** * Type definitions for NOAA Weather API responses */ /** * Common properties in NOAA API responses */ export interface NOAAResponse { '@context'?: unknown; type?: string; geometry?: { type: string; coordinates: number[]; }; properties: T; } /** * Response from /points/{lat},{lon} endpoint */ export interface PointsProperties { '@id': string; cwa: string; forecastOffice: string; gridId: string; gridX: number; gridY: number; forecast: string; forecastHourly: string; forecastGridData: string; observationStations: string; relativeLocation: { type: string; geometry: { type: string; coordinates: number[]; }; properties: { city: string; state: string; distance: { unitCode: string; value: number; }; bearing: { unitCode: string; value: number; }; }; }; forecastZone: string; county: string; fireWeatherZone: string; timeZone: string; radarStation: string; } export type PointsResponse = NOAAResponse; /** * Forecast period from /gridpoints/{office}/{x},{y}/forecast */ export interface ForecastPeriod { number: number; name: string; startTime: string; endTime: string; isDaytime: boolean; temperature: number; temperatureUnit: 'F' | 'C'; temperatureTrend?: string | null; probabilityOfPrecipitation: { unitCode: string; value: number | null; }; dewpoint: { unitCode: string; value: number; }; relativeHumidity: { unitCode: string; value: number; }; windSpeed: string; windDirection: string; icon: string; shortForecast: string; detailedForecast: string; } /** * Response from forecast endpoints */ export interface ForecastProperties { updated?: string; units: string; forecastGenerator: string; generatedAt: string; updateTime?: string; validTimes: string; elevation: { unitCode: string; value: number; }; periods: ForecastPeriod[]; } export type ForecastResponse = NOAAResponse; /** * Quantitative value with unit */ export interface QuantitativeValue { unitCode: string; value: number | null; qualityControl?: string; } /** * Observation data from /stations/{id}/observations */ export interface ObservationProperties { '@id': string; '@type': string; elevation: QuantitativeValue; station: string; timestamp: string; rawMessage?: string; textDescription?: string; icon?: string; presentWeather?: Array<{ intensity?: string; modifier?: string; weather: string; rawString: string; }>; temperature: QuantitativeValue; dewpoint: QuantitativeValue; windDirection?: QuantitativeValue; windSpeed: QuantitativeValue; windGust?: QuantitativeValue; barometricPressure?: QuantitativeValue; seaLevelPressure?: QuantitativeValue; visibility?: QuantitativeValue; maxTemperatureLast24Hours?: QuantitativeValue; minTemperatureLast24Hours?: QuantitativeValue; precipitationLastHour?: QuantitativeValue; precipitationLast3Hours?: QuantitativeValue; precipitationLast6Hours?: QuantitativeValue; relativeHumidity: QuantitativeValue; windChill?: QuantitativeValue; heatIndex?: QuantitativeValue; cloudLayers?: Array<{ base: QuantitativeValue; amount: string; }>; snowDepth?: QuantitativeValue; } export type ObservationResponse = NOAAResponse; /** * Collection of observations */ export interface ObservationCollectionResponse { '@context'?: unknown; type: string; features: ObservationResponse[]; } /** * Weather station information */ export interface StationProperties { '@id': string; '@type': string; elevation: QuantitativeValue; stationIdentifier: string; name: string; timeZone: string; forecast?: string; county?: string; fireWeatherZone?: string; } export type StationResponse = NOAAResponse; /** * Collection of stations */ export interface StationCollectionResponse { '@context'?: unknown; type: string; features: StationResponse[]; observationStations?: string[]; } /** * Error response from NOAA API */ export interface NOAAErrorResponse { correlationId: string; title: string; type: string; status: number; detail: string; instance?: string; } /** * Weather alert properties from /alerts endpoint */ export interface AlertProperties { '@id': string; '@type': string; id: string; areaDesc: string; geocode: { SAME?: string[]; UGC?: string[]; }; affectedZones: string[]; references: Array<{ '@id': string; identifier: string; sender: string; sent: string; }>; sent: string; effective: string; onset: string | null; expires: string; ends: string | null; status: 'Actual' | 'Exercise' | 'System' | 'Test' | 'Draft'; messageType: 'Alert' | 'Update' | 'Cancel' | 'Ack' | 'Error'; category: 'Met' | 'Geo' | 'Safety' | 'Security' | 'Rescue' | 'Fire' | 'Health' | 'Env' | 'Transport' | 'Infra' | 'CBRNE' | 'Other'; severity: 'Extreme' | 'Severe' | 'Moderate' | 'Minor' | 'Unknown'; certainty: 'Observed' | 'Likely' | 'Possible' | 'Unlikely' | 'Unknown'; urgency: 'Immediate' | 'Expected' | 'Future' | 'Past' | 'Unknown'; event: string; sender: string; senderName: string; headline: string | null; description: string; instruction: string | null; response: 'Shelter' | 'Evacuate' | 'Prepare' | 'Execute' | 'Avoid' | 'Monitor' | 'Assess' | 'AllClear' | 'None'; parameters: { [key: string]: string[]; }; } export type AlertResponse = NOAAResponse; /** * Collection of alerts from /alerts endpoint */ export interface AlertCollectionResponse { '@context'?: unknown; type: string; features: AlertResponse[]; title?: string; updated?: string; } /** * Helper type for converting units */ export type TemperatureUnit = 'F' | 'C' | 'K'; export type SpeedUnit = 'mph' | 'kph' | 'mps' | 'knots'; export type DistanceUnit = 'miles' | 'km' | 'meters' | 'feet'; export type PressureUnit = 'mb' | 'hPa' | 'inHg' | 'Pa'; /** * Gridpoint data value with time range */ export interface GridpointValue { validTime: string; value: number; } /** * Gridpoint data series */ export interface GridpointDataSeries { uom?: string; values: GridpointValue[]; } /** * Fire weather properties from gridpoint data */ export interface GridpointFireWeather { grasslandFireDangerIndex?: GridpointDataSeries; hainesIndex?: GridpointDataSeries; redFlagThreatIndex?: GridpointDataSeries; atmosphericDispersionIndex?: GridpointDataSeries; mixingHeight?: GridpointDataSeries; transportWindSpeed?: GridpointDataSeries; transportWindDirection?: GridpointDataSeries; twentyFootWindSpeed?: GridpointDataSeries; twentyFootWindDirection?: GridpointDataSeries; } /** * Severe weather properties from gridpoint data */ export interface GridpointSevereWeather { probabilityOfThunder?: GridpointDataSeries; probabilityOfTropicalStormWinds?: GridpointDataSeries; probabilityOfHurricaneWinds?: GridpointDataSeries; potentialOf15mphWinds?: GridpointDataSeries; potentialOf20mphWindGusts?: GridpointDataSeries; potentialOf25mphWinds?: GridpointDataSeries; potentialOf30mphWindGusts?: GridpointDataSeries; potentialOf35mphWinds?: GridpointDataSeries; potentialOf40mphWindGusts?: GridpointDataSeries; potentialOf45mphWinds?: GridpointDataSeries; potentialOf50mphWindGusts?: GridpointDataSeries; potentialOf60mphWindGusts?: GridpointDataSeries; lightningActivityLevel?: GridpointDataSeries; } /** * Marine forecast properties from gridpoint data (Great Lakes and coastal areas) */ export interface GridpointMarineForecast { waveHeight?: GridpointDataSeries; wavePeriod?: GridpointDataSeries; wavePeriod2?: GridpointDataSeries; waveDirection?: GridpointDataSeries; windWaveHeight?: GridpointDataSeries; primarySwellHeight?: GridpointDataSeries; primarySwellDirection?: GridpointDataSeries; secondarySwellHeight?: GridpointDataSeries; secondarySwellDirection?: GridpointDataSeries; } /** * Gridpoint properties from /gridpoints/{office}/{gridX},{gridY} endpoint * Contains detailed forecast data including fire weather indices, severe weather, and marine conditions */ export interface GridpointProperties extends GridpointFireWeather, GridpointSevereWeather, GridpointMarineForecast { '@id': string; '@type': string; updateTime: string; validTimes: string; elevation: QuantitativeValue; forecastOffice: string; gridId: string; gridX: number; gridY: number; temperature?: GridpointDataSeries; dewpoint?: GridpointDataSeries; relativeHumidity?: GridpointDataSeries; apparentTemperature?: GridpointDataSeries; heatIndex?: GridpointDataSeries; windChill?: GridpointDataSeries; skyCover?: GridpointDataSeries; windDirection?: GridpointDataSeries; windSpeed?: GridpointDataSeries; windGust?: GridpointDataSeries; snowfallAmount?: GridpointDataSeries; iceAccumulation?: GridpointDataSeries; snowLevel?: GridpointDataSeries; weather?: { values: Array<{ validTime: string; value: Array<{ coverage: string | null; weather: string | null; intensity: string | null; visibility: QuantitativeValue | null; attributes: string[]; }>; }>; }; hazards?: { values: Array<{ validTime: string; value: Array<{ phenomenon: string; significance: string; event_number: number | null; }>; }>; }; } export type GridpointResponse = NOAAResponse; /** * NWPS (National Water Prediction Service) River Gauge Types */ /** * One flood-category threshold, as published on the per-gauge detail endpoint. * NWPS emits -9999 for "not published" rather than omitting the field, so * presence of a key says nothing — `isRealValue` on the number is the guard. */ export interface FloodThreshold { stage?: number; flow?: number; } /** * Flood category thresholds for a river gauge. All four keys are present on every * gauge sampled live, but a gauge may publish thresholds for only some levels * (3 of 14 sampled publish action+minor only, 2 publish none). */ export interface FloodCategories { action?: FloodThreshold; minor?: FloodThreshold; moderate?: FloodThreshold; major?: FloodThreshold; } /** * Historical crest data for a river gauge, as returned by NWPS. There is no * impact-description field on this shape; `preliminary` is "O" (observed) or * "R" (recorded). */ export interface HistoricCrest { occurredTime?: string; stage?: number; flow?: number; preliminary?: string; olddatum?: boolean; } /** * Current status for a river gauge (observed or forecast) */ export interface GaugeStatus { primary: number | null; secondary: number | null; floodCategory: 'major' | 'moderate' | 'minor' | 'action' | 'no_flooding' | 'not_defined' | null; validTime: string; primaryUnit?: string; secondaryUnit?: string; } /** * River gauge metadata and current status from NWPS API */ /** * Office reference returned by the NWPS API (state, WFO, RFC). */ export interface NWPSOfficeRef { abbreviation: string; name: string; } export interface NWPSGauge { lid: string; usgsId?: string; name: string; latitude: number; longitude: number; state: NWPSOfficeRef; county?: string; timeZone?: string; wfo?: NWPSOfficeRef; rfc?: NWPSOfficeRef; status: { observed?: GaugeStatus; forecast?: GaugeStatus; }; flood?: { stageUnits?: string; flowUnits?: string; categories?: FloodCategories; crests?: { historic?: HistoricCrest[]; recent?: HistoricCrest[]; }; }; inService?: boolean; upstreamLid?: string; downstreamLid?: string; } /** * Response wrapper for the NWPS /gauges endpoint. */ export interface NWPSGaugesResponse { gauges: NWPSGauge[]; } /** * Stage/flow time series data point from NWPS stageflow endpoint. * primary/secondary may be null OR a -999-style sentinel — filter every * point through the river handler's isRealValue guard before use. */ export interface StageFlowDataPoint { validTime: string; generatedTime: string; primary: number | null; secondary: number | null; } /** * One series (observed or forecast) from the NWPS stageflow endpoint. * Shape verified live 2026-07-17 against /gauges/{lid}/stageflow. */ export interface StageFlowSeries { pedts?: string; issuedTime?: string; wfo?: string; timeZone?: string; primaryName?: string; primaryUnits?: string; secondaryName?: string; secondaryUnits?: string; data?: StageFlowDataPoint[]; } /** * Stage/flow time series response from NWPS. Either series may be absent or * empty — most small-river gauges carry an observed series but no forecast. */ export interface NWPSStageFlowResponse { observed?: StageFlowSeries; forecast?: StageFlowSeries; } /** * USGS Water Services API Types */ /** * USGS site information */ export interface USGSSite { siteName: string; siteCode: string; network: string; geoLocation: { geogLocation: { latitude: number; longitude: number; srs: string; }; localSiteXY?: unknown[]; }; timeZoneInfo: { defaultTimeZone: { zoneOffset: string; zoneAbbreviation: string; }; daylightSavingsTimeZone?: { zoneOffset: string; zoneAbbreviation: string; }; }; siteProperty?: Array<{ name: string; value: string; }>; } /** * USGS variable definition (e.g., streamflow parameter 00060) */ export interface USGSVariable { variableCode: string; variableName: string; variableDescription: string; unit: { unitCode: string; }; noDataValue: number; } /** * USGS time series value (observation) */ export interface USGSValue { value: string; qualifiers: string[]; dateTime: string; } /** * USGS time series data */ export interface USGSTimeSeries { sourceInfo: USGSSite; variable: USGSVariable; values: Array<{ value: USGSValue[]; method: string[]; }>; } /** * USGS Instantaneous Values (IV) response */ export interface USGSIVResponse { name: string; declaredType: string; scope: string; value: { queryInfo: { queryURL: string; criteria: { locationParam: string; variableParam: string; }; note: Array<{ value: string; title: string; }>; }; timeSeries: USGSTimeSeries[]; }; nil: boolean; globalScope: boolean; typeSubstituted: boolean; } //# sourceMappingURL=noaa.d.ts.map