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:

  • 2026-01-23: Added a practical limit of 1,000 station years worth of data to be allowed with the request prior to the database query for the actual data. You will get a HTTP 422 in this instance with a message to reduce size.
  • 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.

https://mesonet.agron.iastate.edu/cgi-bin/request/asos.py?data=tmpf&data=dwpf&station=DSM&station=MCW&hours=24

Return all observations for the UTC date on 20 May 2020 for ASOS stations in Iowa and Illinois.

https://mesonet.agron.iastate.edu/cgi-bin/request/asos.py?data=all&network=IA_ASOS,IL_ASOS&sts=2020-05-20T00:00:00Z&ets=2020-05-21T00:00:00Z

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 array or null 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 or null 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 or null 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 array or null 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 array or null 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 or null 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 A time zone string specified by IANA. Common examples include 'America/Chicago', 'UTC', and 'Etc/UTC'. The code implementation passes this provided string to the python ZoneInfo library.
year1 integer or null The year of the start time, defaults to the time zone provided by tzname. If sts is not provided.
month1 integer or null The month of the start time, defaults to the time zone provided by tzname. If sts is not provided.
day1 integer or null 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 or null The year of the end time, defaults to the time zone provided by tzname. If ets is not provided.
month2 integer or null The month of the end time, defaults to the time zone provided by tzname. If ets is not provided.
day2 integer or null 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.