Return to API Mainpage or the Download Portal.
Documentation on /cgi-bin/request/asos.py
This cgi-bin script provides METAR/ASOS data. It has a IP-based rate limit for requests to prevent abuse. A 503 Service Unavailable response will be returned if the server is under heavy load.
Changelog:
- 2024-04-01 Fix recently introduced bug with time sort order.
- 2024-03-29 This service had an intermediate bug whereby if the tz value was not provided, it would default to America/Chicago instead of UTC.
- 2024-03-29 Migrated to pydantic based request validation. Will be monitoring for any issues.
- 2024-03-14 Initial documentation release.
Example Usage
Get the past 24 hours of air temperature and dew point for Des Moines and Mason City, Iowa.
CGI Arguments
The following table lists the CGI arguments that are accepted by this service. A HTTP GET request is required. Fields of type Multi-Params or CSV value can accept either a comma separated list or multiple parameter and value combinations. For example, ?foo=1&foo=2 is equivalent to ?foo=1,2.
Field | Type | Description |
---|---|---|
data | Multi-Params or CSV value | The data columns to return, defaults to all. The available options are: tmpf, dwpf, relh, drct, sknt, p01i, alti, mslp, vsby, gust, skyc1, skyc2, skyc3, skyc4, skyl1, skyl2, skyl3, skyl4, wxcodes, ice_accretion_1hr, ice_accretion_3hr, ice_accretion_6hr, peak_wind_gust, peak_wind_drct, peak_wind_time, feel, metar, snowdepth |
direct | boolean | If set to 'yes', the data will be directly downloaded as a file. |
elev | boolean | If set to 'yes', the elevation (m) of the station will be included in the output. |
ets | string | The end time of the data request. |
format | string | The format of the data, defaults to onlycomma. The available options are: onlycomma, tdf. |
hours | integer | The number of hours of data to return prior to the current timestamp. Can not be more than 24 if no stations are specified. |
latlon | boolean | If set to 'yes', the latitude and longitude of the station will be included in the output. |
missing | string | How to represent missing values, defaults to M. Other options are 'null' and 'empty'. |
nometa | boolean | If set to 'yes', the column headers will not be included in the output. |
network | Multi-Params or CSV value | The network to query, defaults to all networks. |
report_type | Multi-Params or CSV value | The report type to query, defaults to all. The available options are: 1 (HFMETAR), 3 (Routine), 4 (Specials). |
station | Multi-Params or CSV value | The station identifier to query, defaults to all stations and if you do not specify any stations, you can only request 24 hours of data. |
sts | string | The start time of the data request. |
trace | string | How to represent trace values, defaults to 0.0001. Other options are 'null' and 'empty'. |
tz | string | The timezone to use for the request timestamps (when not providing already tz-aware sts and ets values) and the output valid timestamp. It is highly recommended to set this to UTC to ensure it is set. This string should be something that the Python zoneinfo library can understand. |
year1 | integer | The year of the start time, defaults to the time zone provided by tzname. If sts is not provided. |
month1 | integer | The month of the start time, defaults to the time zone provided by tzname. If sts is not provided. |
day1 | integer | The day of the start time, defaults to the time zone provided by tzname. If sts is not provided. |
hour1 | integer | The hour of the start time, defaults to the time zone provided by tzname. If sts is not provided. |
minute1 | integer | The minute of the start time, defaults to the time zone provided by tzname. If sts is not provided. |
year2 | integer | The year of the end time, defaults to the time zone provided by tzname. If ets is not provided. |
month2 | integer | The month of the end time, defaults to the time zone provided by tzname. If ets is not provided. |
day2 | integer | The day of the end time, defaults to the time zone provided by tzname. If ets is not provided. |
hour2 | integer | The hour of the end time, defaults to the time zone provided by tzname. If ets is not provided. |
minute2 | integer | The minute of the end time, defaults to the time zone provided by tzname. If ets is not provided. |