You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过API(R语言)正确获取NOAA Local Climatological Data?

Solution for NOAA LCD API Request in R

Key Issues with Your Original Request

  • Future Date Range: NOAA's Local Climatological Data (LCD) doesn't include future data—your request for 2025-01-01 to 2025-01-31 returns no actual records, hence only headers.
  • Redundant Parameter: boundingBox is unnecessary when you explicitly specify stations, as it filters results to a geographic area that already includes your target stations.

Corrected R Code

Use a valid past date range and clean up parameters. Here's a working example using httr and readr:

library(httr)
library(readr)

# Define API parameters
api_url <- "https://www.ncei.noaa.gov/access/services/data/v1"
params <- list(
  dataset = "local-climatological-data",
  dataTypes = "DailyAverageDewPointTemperature",
  stations = "USW0013874", # Add multiple stations separated by commas (e.g., "USW0013874,USW00012345")
  startDate = "2024-01-01",
  endDate = "2024-01-31",
  format = "csv" # Explicitly request CSV format for easy parsing
)

# Send request and parse data
response <- GET(api_url, query = params)
lcd_data <- read_csv(content(response, as = "text"))

# View results
head(lcd_data)

Notes for Multi-Site Data

  • To fetch data from multiple stations, separate station IDs with commas in the stations parameter (e.g., stations = "USW0013874,USW00012894" for Atlanta and another location).
  • Ensure all stations you request have data for your specified date range—some stations may have gaps or stop reporting.

Verifying Data Types

If you're unsure about data type names, refer to NOAA's LCD dataset documentation for official metric codes/names. For daily average dew point temperature, DailyAverageDewPointTemperature is the correct value for the v1 API.

内容的提问来源于stack exchange,提问作者Stephen Hilton

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 11:34:55