/** * Service for interacting with NOAA NCEI (National Centers for Environmental Information) * Climate Data Online (CDO) API. * * Documentation: https://www.ncei.noaa.gov/support/access-data-service-api-user-documentation * * Provides official NOAA 1991–2020 climate normals for US locations. The CDO API is * station-based (not coordinate-based), so retrieval works in three steps: * 1. Find nearby stations that carry daily normals (`NORMAL_DLY`) for the coordinate. * 2. For the nearest qualifying station, read the daily high/low temperature normals * (`DLY-TMAX-NORMAL`, `DLY-TMIN-NORMAL`) for the requested month/day. * 3. Read the monthly precipitation normal (`MLY-PRCP-NORMAL` from `NORMAL_MLY`) and * divide by the number of days in the month to express an average daily value. * * Normals are keyed to a fixed reference year (2010) in the CDO dataset. Values are * requested with `units=standard` so temperatures come back in °F and precipitation in * inches. If no nearby station has complete normals, a DataNotFoundError is thrown so the * caller can fall back to Open-Meteo computed normals. */ import type { ClimateNormals } from '../types/openmeteo.js'; export interface NCEIServiceConfig { baseURL?: string; timeout?: number; token?: string; } /** * NCEI Climate Data Online (CDO) Service * * Provides access to official NOAA climate normals for US locations. * Requires API token (free from https://www.ncdc.noaa.gov/cdo-web/token) */ export declare class NCEIService { private client; private token; private cache; constructor(config?: NCEIServiceConfig); /** * Check if NCEI service is available (token configured) */ isAvailable(): boolean; /** * Get official NOAA climate normals for a US location. * * @param latitude - Latitude (US only) * @param longitude - Longitude (US only) * @param month - Month (1-12) * @param day - Day of month (1-31) * @returns Climate normals sourced from NCEI * @throws {DataNotFoundError} - No token, or no nearby station with complete normals * @throws {RateLimitError} - CDO rate limit exceeded * @throws {ServiceUnavailableError} - CDO unavailable or invalid token */ getClimateNormals(latitude: number, longitude: number, month: number, day: number): Promise; /** * Find stations carrying daily normals near a coordinate, sorted by distance. * Expands the search extent once if the initial bounding box is empty. */ private findNearbyStations; /** * Read daily high/low temperature normals (°F) for a station on a given date. * Returns null if either value is missing. */ private fetchDailyTemperatureNormals; /** * Read the monthly precipitation normal (inches) for a station's month. * Returns null if the value is missing. */ private fetchMonthlyPrecipitationNormal; /** * Handle API errors * @private */ private handleError; } //# sourceMappingURL=ncei.d.ts.map