Skill Tracer
Skills › Scientific Agent Skills › database-lookup › noaa.md

noaa.md

201 lines · skills/database-lookup/references/noaa.md at 5f2bc03

Open on GitHub
1# NOAA Climate Data Online (CDO) API Reference
2

NOAA Climate Data Online (CDO) API Reference

Raw lines 1 to 2
3## Base URL
4```
5https://www.ncdc.noaa.gov/cdo-web/api/v2
6```
7

Base URL

https://www.ncdc.noaa.gov/cdo-web/api/v2
Raw lines 3 to 7
8## Authentication
9- **API Token: REQUIRED.** Request a free token at https://www.ncdc.noaa.gov/cdo-web/token
10- Pass as HTTP header: `Token: YOUR_TOKEN`

Authentication

  • API Token: REQUIRED. Request a free token at https://www.ncdc.noaa.gov/cdo-web/token
  • Pass as HTTP header: Token: YOUR_TOKEN
Raw lines 8 to 11
12## Rate Limits
13- **5 requests per second** per token.
14- **10,000 requests per day** per token.
15- Queries are limited to **1,000 results per request** (use `offset` for pagination).
16- Date ranges limited to **1 year per request** for the `/data` endpoint.

Rate Limits

  • 5 requests per second per token.
  • 10,000 requests per day per token.
  • Queries are limited to 1,000 results per request (use offset for pagination).
  • Date ranges limited to 1 year per request for the /data endpoint.
Raw lines 12 to 17
18## Common Parameters (apply to most endpoints)
19| Parameter | Type | Required | Default | Description |
20|---------------|--------|----------|---------|-------------|
21| `datasetid` | string | Varies | - | Dataset ID (e.g. `GHCND`, `GSOM`). |
22| `datatypeid` | string | No | - | Data type filter (e.g. `TMAX`, `PRCP`). |
23| `locationid` | string | No | - | Location ID (e.g. `FIPS:37`, `ZIP:28801`, `CITY:US390029`). |
24| `stationid` | string | No | - | Station ID (e.g. `GHCND:USW00013874`). |
25| `startdate` | string | Varies | - | ISO date `YYYY-MM-DD`. |
26| `enddate` | string | Varies | - | ISO date `YYYY-MM-DD`. |
27| `units` | string | No | native/unscaled | `standard` or `metric`. |
28| `limit` | int | No | 25 | Results per page (max 1000). |
29| `offset` | int | No | 1 | Pagination offset (1-based). |
30| `sortfield` | string | No | - | Field to sort by (e.g. `date`, `name`). |
31| `sortorder` | string | No | `asc` | `asc` or `desc`. |
33---

Common Parameters (apply to most endpoints)

ParameterTypeRequiredDefaultDescription
datasetidstringVaries-Dataset ID (e.g. GHCND, GSOM).
datatypeidstringNo-Data type filter (e.g. TMAX, PRCP).
locationidstringNo-Location ID (e.g. FIPS:37, ZIP:28801, CITY:US390029).
stationidstringNo-Station ID (e.g. GHCND:USW00013874).
startdatestringVaries-ISO date YYYY-MM-DD.
enddatestringVaries-ISO date YYYY-MM-DD.
unitsstringNonative/unscaledstandard or metric.
limitintNo25Results per page (max 1000).
offsetintNo1Pagination offset (1-based).
sortfieldstringNo-Field to sort by (e.g. date, name).
sortorderstringNoascasc or desc.

Raw lines 18 to 34
35## Key Endpoints

Key Endpoints

Raw lines 35 to 36
37### 1. Data (Observations)
38```
39GET /data
40```
41Returns actual observation data. This is the primary data retrieval endpoint.
43**Required parameters:** `datasetid`, `startdate`, `enddate`.
45**Example -- daily max temperature for a station:**
46```bash
47curl -H "Token: YOUR_TOKEN" \
48 "https://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&datatypeid=TMAX&stationid=GHCND:USW00013874&startdate=2024-01-01&enddate=2024-01-31&units=metric&limit=31"
49```
51**Response:**
52```json
54 "metadata": {
55 "resultset": {
56 "offset": 1,
57 "count": 31,
58 "limit": 31
59 }
60 },
61 "results": [
62 {
63 "date": "2024-01-01T00:00:00",
64 "datatype": "TMAX",
65 "station": "GHCND:USW00013874",
66 "attributes": ",,W,2400",
67 "value": 12.2
68 },
69 {
70 "date": "2024-01-02T00:00:00",
71 "datatype": "TMAX",
72 "station": "GHCND:USW00013874",
73 "attributes": ",,W,2400",
74 "value": 8.9
75 }
76 ]
78```
79`units=standard` requests scaled US customary units (temperature in Fahrenheit); `units=metric` requests scaled metric units (Celsius). When `units` is omitted, native dataset scaling applies (GHCND raw temperature uses tenths of Celsius). Save the requested units with the observations.

1. Data (Observations)

GET /data

Returns actual observation data. This is the primary data retrieval endpoint.

Required parameters: datasetid, startdate, enddate.

Example -- daily max temperature for a station:

curl -H "Token: YOUR_TOKEN" \
  "https://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&datatypeid=TMAX&stationid=GHCND:USW00013874&startdate=2024-01-01&enddate=2024-01-31&units=metric&limit=31"

Response:

{
  "metadata": {
    "resultset": {
      "offset": 1,
      "count": 31,
      "limit": 31
    }
  },
  "results": [
    {
      "date": "2024-01-01T00:00:00",
      "datatype": "TMAX",
      "station": "GHCND:USW00013874",
      "attributes": ",,W,2400",
      "value": 12.2
    },
    {
      "date": "2024-01-02T00:00:00",
      "datatype": "TMAX",
      "station": "GHCND:USW00013874",
      "attributes": ",,W,2400",
      "value": 8.9
    }
  ]
}

units=standard requests scaled US customary units (temperature in Fahrenheit); units=metric requests scaled metric units (Celsius). When units is omitted, native dataset scaling applies (GHCND raw temperature uses tenths of Celsius). Save the requested units with the observations.

Raw lines 37 to 80
81### 2. Datasets
82```
83GET /datasets
84GET /datasets/{id}
85```
86Lists available datasets or gets details for one.
88**Example:**
89```bash
90curl -H "Token: YOUR_TOKEN" \
91 "https://www.ncdc.noaa.gov/cdo-web/api/v2/datasets?limit=10"
92```
94**Key Dataset IDs:**
95| ID | Name | Description |
96|----------|------|-------------|
97| `GHCND` | Daily Summaries | Global daily station observations (TMAX, TMIN, PRCP, SNOW, etc.) |
98| `GSOM` | Global Summary of the Month | Monthly aggregates |
99| `GSOY` | Global Summary of the Year | Annual aggregates |
100| `NORMAL_DLY` | Climate Normals Daily | 30-year daily normals |
101| `NORMAL_MLY` | Climate Normals Monthly | 30-year monthly normals |
102| `PRECIP_15` | Precipitation 15-Minute | Sub-hourly precipitation |
103| `PRECIP_HLY` | Precipitation Hourly | Hourly precipitation |

2. Datasets

GET /datasets
GET /datasets/{id}

Lists available datasets or gets details for one.

Example:

curl -H "Token: YOUR_TOKEN" \
  "https://www.ncdc.noaa.gov/cdo-web/api/v2/datasets?limit=10"

Key Dataset IDs:

IDNameDescription
GHCNDDaily SummariesGlobal daily station observations (TMAX, TMIN, PRCP, SNOW, etc.)
GSOMGlobal Summary of the MonthMonthly aggregates
GSOYGlobal Summary of the YearAnnual aggregates
NORMAL_DLYClimate Normals Daily30-year daily normals
NORMAL_MLYClimate Normals Monthly30-year monthly normals
PRECIP_15Precipitation 15-MinuteSub-hourly precipitation
PRECIP_HLYPrecipitation HourlyHourly precipitation
Raw lines 81 to 104
105### 3. Data Types
106```
107GET /datatypes
108GET /datatypes/{id}
109```
110Lists available data types, optionally filtered by dataset.
112**Example:**
113```bash
114curl -H "Token: YOUR_TOKEN" \
115 "https://www.ncdc.noaa.gov/cdo-web/api/v2/datatypes?datasetid=GHCND&limit=50"
116```
118**Common GHCND Data Types:**
119| ID | Description |
120|--------|-------------|
121| `TMAX` | Maximum temperature |
122| `TMIN` | Minimum temperature |
123| `TAVG` | Average temperature |
124| `PRCP` | Precipitation |
125| `SNOW` | Snowfall |
126| `SNWD` | Snow depth |
127| `AWND` | Average wind speed |
128| `WSF2` | Fastest 2-minute wind speed |

3. Data Types

GET /datatypes
GET /datatypes/{id}

Lists available data types, optionally filtered by dataset.

Example:

curl -H "Token: YOUR_TOKEN" \
  "https://www.ncdc.noaa.gov/cdo-web/api/v2/datatypes?datasetid=GHCND&limit=50"

Common GHCND Data Types:

IDDescription
TMAXMaximum temperature
TMINMinimum temperature
TAVGAverage temperature
PRCPPrecipitation
SNOWSnowfall
SNWDSnow depth
AWNDAverage wind speed
WSF2Fastest 2-minute wind speed
Raw lines 105 to 129
130### 4. Stations
131```
132GET /stations
133GET /stations/{id}
134```
135Find weather stations, optionally filtered by location, dataset, or extent.
137**Additional Parameters:**
138| Parameter | Type | Description |
139|-----------|--------|-------------|
140| `extent` | string | Bounding box: `south_lat,west_lon,north_lat,east_lon`. |
142**Example -- stations near Asheville, NC with daily data:**
143```bash
144curl -H "Token: YOUR_TOKEN" \
145 "https://www.ncdc.noaa.gov/cdo-web/api/v2/stations?datasetid=GHCND&locationid=ZIP:28801&limit=10"
146```
148**Response:**
149```json
151 "metadata": {"resultset": {"offset": 1, "count": 5, "limit": 10}},
152 "results": [
153 {
154 "elevation": 661.1,
155 "mindate": "1893-01-01",
156 "maxdate": "2024-11-15",
157 "latitude": 35.5951,
158 "name": "ASHEVILLE REGIONAL AIRPORT, NC US",
159 "datacoverage": 1,
160 "id": "GHCND:USW00013874",
161 "elevationUnit": "METERS",
162 "longitude": -82.5572
163 }
164 ]
166```

4. Stations

GET /stations
GET /stations/{id}

Find weather stations, optionally filtered by location, dataset, or extent.

Additional Parameters:

ParameterTypeDescription
extentstringBounding box: south_lat,west_lon,north_lat,east_lon.

Example -- stations near Asheville, NC with daily data:

curl -H "Token: YOUR_TOKEN" \
  "https://www.ncdc.noaa.gov/cdo-web/api/v2/stations?datasetid=GHCND&locationid=ZIP:28801&limit=10"

Response:

{
  "metadata": {"resultset": {"offset": 1, "count": 5, "limit": 10}},
  "results": [
    {
      "elevation": 661.1,
      "mindate": "1893-01-01",
      "maxdate": "2024-11-15",
      "latitude": 35.5951,
      "name": "ASHEVILLE REGIONAL AIRPORT, NC US",
      "datacoverage": 1,
      "id": "GHCND:USW00013874",
      "elevationUnit": "METERS",
      "longitude": -82.5572
    }
  ]
}
Raw lines 130 to 167
168### 5. Locations & Location Categories
169```
170GET /locations
171GET /locations/{id}
172GET /locationcategories
173GET /locationcategories/{id}
174```
175Browse location hierarchies (countries, states, cities, zip codes, climate regions).
177**Example:**
178```bash
179curl -H "Token: YOUR_TOKEN" \
180 "https://www.ncdc.noaa.gov/cdo-web/api/v2/locations?locationcategoryid=ST&limit=52"
181```
183Location category IDs: `CITY`, `CLIM_DIV`, `CLIM_REG`, `CNTRY`, `CNTY`, `HYD_ACC`, `HYD_CAT`, `HYD_REG`, `HYD_SUB`, `ST`, `ZIP`.
185---

5. Locations & Location Categories

GET /locations
GET /locations/{id}
GET /locationcategories
GET /locationcategories/{id}

Browse location hierarchies (countries, states, cities, zip codes, climate regions).

Example:

curl -H "Token: YOUR_TOKEN" \
  "https://www.ncdc.noaa.gov/cdo-web/api/v2/locations?locationcategoryid=ST&limit=52"

Location category IDs: CITY, CLIM_DIV, CLIM_REG, CNTRY, CNTY, HYD_ACC, HYD_CAT, HYD_REG, HYD_SUB, ST, ZIP.


Raw lines 168 to 186
187## Workflow: Finding and Querying Data
1891. **Find a dataset:** `GET /datasets` to list available datasets.
1902. **Find a station:** `GET /stations?datasetid=GHCND&locationid=ZIP:28801` to find nearby stations.
1913. **Check available data types:** `GET /datatypes?datasetid=GHCND&stationid=GHCND:USW00013874`.
1924. **Query data:** `GET /data?datasetid=GHCND&stationid=GHCND:USW00013874&datatypeid=TMAX,TMIN&startdate=2024-01-01&enddate=2024-12-31&units=metric&limit=1000`.

Workflow: Finding and Querying Data

  1. Find a dataset: GET /datasets to list available datasets.
  2. Find a station: GET /stations?datasetid=GHCND&locationid=ZIP:28801 to find nearby stations.
  3. Check available data types: GET /datatypes?datasetid=GHCND&stationid=GHCND:USW00013874.
  4. Query data: GET /data?datasetid=GHCND&stationid=GHCND:USW00013874&datatypeid=TMAX,TMIN&startdate=2024-01-01&enddate=2024-12-31&units=metric&limit=1000.
Raw lines 187 to 193
194## Notes
195- The `/data` endpoint enforces a **1-year max date range** per request. For multi-year queries, make sequential requests.
196- Pagination: `offset` is 1-based. Loop until `offset + limit > count` from the metadata.
197- Station IDs include a dataset prefix (e.g. `GHCND:USW00013874`).
198- The `attributes` field in data results contains quality flags (comma-separated). Consult dataset documentation for flag meanings.
199- Token goes in the header, not as a query parameter.
201For `/data`, bound daily/subdaily requests to one year; monthly and annual datasets allow up to ten years. Follow the returned resultset offset and count rather than assuming every endpoint starts at the same offset. Official contract: https://www.ncei.noaa.gov/cdo-web/webservices/v2

Notes

  • The /data endpoint enforces a 1-year max date range per request. For multi-year queries, make sequential requests.
  • Pagination: offset is 1-based. Loop until offset + limit > count from the metadata.
  • Station IDs include a dataset prefix (e.g. GHCND:USW00013874).
  • The attributes field in data results contains quality flags (comma-separated). Consult dataset documentation for flag meanings.
  • Token goes in the header, not as a query parameter.

For /data, bound daily/subdaily requests to one year; monthly and annual datasets allow up to ten years. Follow the returned resultset offset and count rather than assuming every endpoint starts at the same offset. Official contract: https://www.ncei.noaa.gov/cdo-web/webservices/v2

Raw lines 194 to 201