Weather and air quality
Two routes answer from station feeds — weather reports from airports, air-quality monitors — and they ask different questions. /v1/conditions is "what is it like near here": every parameter any nearby station reports, the latest value of each./v1/observations is "how has this one thing changed": one parameter as a time series, at the stations nearest a point.
The examples on this page were captured from a fixed copy of these feeds, so their times are older than what the hosted API answers.
Neither is a forecast. A station reports what it measured; a forecast is a gridded field over time, and that is araster.
The latest readings near a point
curl -G "https://api.oslew.com/v1/conditions" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'at=19.4326,-99.1332'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.conditions("19.4326,-99.1332")import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.conditions("19.4326,-99.1332");HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 295
ratelimit-reset: 1
{
"at": [
19.4326,
-99.1332
],
"conditions": [
{
"parameter": "altim_inhg",
"value": 30.4,
"time": 1795103100,
"station": "MMMX",
"distance_m": 6428.533455622266,
"provenance": {
"name": "metar",
"release": "2026-11-19T16:30Z",
"license": "US NWS / aviationweather.gov, public domain"
}
},
{
"parameter": "co",
"value": 0.96,
"time": 1795086000,
"station": "sedema-MER",
"distance_m": 1689.7380487595012,
"provenance": {
"name": "sedema",
"release": "2026-11-19T11:00Z",
"license": "SEDEMA Ciudad de México (SIMAT, RAMA), CC BY 4.0"
}
},
{
"parameter": "dewpoint_c",
"value": 7,
"time": 1795103100,
"station": "MMMX",
"distance_m": 6428.533455622266,
"provenance": {
"name": "metar",
"release": "2026-11-19T16:30Z",
"license": "US NWS / aviationweather.gov, public domain"
}
},
{
"parameter": "no2",
"value": 35,
"time": 1795086000,
"station": "sedema-MER",
"distance_m": 1689.7380487595012,
"provenance": {
"name": "sedema",
"release": "2026-11-19T11:00Z",
"license": "SEDEMA Ciudad de México (SIMAT, RAMA), CC BY 4.0"
}
},
{
"parameter": "o3",
"value": 1,
"time": 1795086000,
"station": "sedema-MER",
"distance_m": 1689.7380487595012,
"provenance": {
"name": "sedema",
"release": "2026-11-19T11:00Z",
"license": "SEDEMA Ciudad de México (SIMAT, RAMA), CC BY 4.0"
}
},
{
"parameter": "pm10",
"value": 47,
"time": 1795086000,
"station": "sedema-MER",
"distance_m": 1689.7380487595012,
"provenance": {
"name": "sedema",
"release": "2026-11-19T11:00Z",
"license": "SEDEMA Ciudad de México (SIMAT, RAMA), CC BY 4.0"
}
},
{
"parameter": "pm25",
"value": 25,
"time": 1795086000,
"station": "sedema-MER",
"distance_m": 1689.7380487595012,
"provenance": {
"name": "sedema",
"release": "2026-11-19T11:00Z",
"license": "SEDEMA Ciudad de México (SIMAT, RAMA), CC BY 4.0"
}
},
{
"parameter": "so2",
"value": 52,
"time": 1795086000,
"station": "sedema-MER",
"distance_m": 1689.7380487595012,
"provenance": {
"name": "sedema",
"release": "2026-11-19T11:00Z",
"license": "SEDEMA Ciudad de México (SIMAT, RAMA), CC BY 4.0"
}
},
{
"parameter": "temp_c",
"value": 15,
"time": 1795103100,
"station": "MMMX",
"distance_m": 6428.533455622266,
"provenance": {
"name": "metar",
"release": "2026-11-19T16:30Z",
"license": "US NWS / aviationweather.gov, public domain"
}
},
{
"parameter": "vis_mi",
"value": 6,
"time": 1795103100,
"station": "MMMX",
"distance_m": 6428.533455622266,
"provenance": {
"name": "metar",
"release": "2026-11-19T16:30Z",
"license": "US NWS / aviationweather.gov, public domain"
}
},
{
"parameter": "wind_dir",
"value": 0,
"time": 1795103100,
"station": "MMMX",
"distance_m": 6428.533455622266,
"provenance": {
"name": "metar",
"release": "2026-11-19T16:30Z",
"license": "US NWS / aviationweather.gov, public domain"
}
},
{
"parameter": "wind_kt",
"value": 0,
"time": 1795103100,
"station": "MMMX",
"distance_m": 6428.533455622266,
"provenance": {
"name": "metar",
"release": "2026-11-19T16:30Z",
"license": "US NWS / aviationweather.gov, public domain"
}
}
],
"took_us": 9783
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
| Parameter | Default | Is |
|---|---|---|
at | required | lat,lon. |
radius_m | 50,000 | Only stations within this many metres. Clamped to 0–50,000. |
The answer has one entry per parameter, sorted by name, and each entry comes from the nearest station that carries that parameter — not from one station for all of them. Above, twelve readings come from two stations. The weather (temperature, dew point, wind, visibility, altimeter) is from MMMX, Mexico City's airport, 6.4 km from the Zócalo, reported at 15:45 UTC. The six pollutants are from SEDEMA's Merced monitor,sedema-MER, 1.7 km away, as the hourly average to 11:00 UTC. Each entry carries its ownstation, distance_m, time and provenance. Read those per entry; do not assume two entries describe the same place or the same moment.
- "Latest" is the latest the layer holds for that station, which is not the same as recent. A station that stopped reporting is still the nearest station. Compare
timewith the clock before you call a value current. - Nothing within the radius is an answer, not an error:
200with an emptyconditionslist. So is a deployment with no station feed loaded at all. - A smaller
radius_mtrades coverage for relevance. Fifty kilometres finds an airport from most cities; it also lets a reading from across a mountain range answer for a valley.
import time
from oslew import Client
client = Client(base_url="https://api.oslew.com")
answer = client.conditions("19.4326,-99.1332", radius_m=20_000)
now = time.time()
current = {
c["parameter"]: c
for c in answer["conditions"]
if now - c["time"] < 3 * 3600 # older than three hours is history, not weather
}
if "temp_c" in current:
t = current["temp_c"]
print(f"{t['value']} °C at {t['station']}, {t['distance_m'] / 1000:.1f} km away")import { Client } from "@oslew/client";
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.conditions("19.4326,-99.1332", { radius_m: 20_000 });
const now = Date.now() / 1000;
const current = new Map(
answer.conditions
.filter((c) => now - c.time < 3 * 3600) // older than three hours is history, not weather
.map((c) => [c.parameter, c]),
);
const t = current.get("temp_c");
if (t) console.log(`${t.value} °C at ${t.station}, ${(t.distance_m / 1000).toFixed(1)} km away`);One parameter over time
curl -G "https://api.oslew.com/v1/observations" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'at=19.4326,-99.1332' \
--data-urlencode 'parameter=temp_c'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.observations("19.4326,-99.1332", "temp_c")import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.observations("19.4326,-99.1332", "temp_c");HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 295
ratelimit-reset: 1
{
"at": [
19.4326,
-99.1332
],
"parameter": "temp_c",
"decimals": 1,
"from": 1795019400,
"to": 1795105800,
"stations": [
{
"station": {
"id": "MMMX",
"name": null,
"lat": 19.436,
"lon": -99.072
},
"distance_m": 6428.533455622266,
"points": [
{
"time": 1795103100,
"value": 15
}
]
}
],
"provenance": {
"name": "metar",
"release": "2026-11-19T16:30Z",
"license": "US NWS / aviationweather.gov, public domain"
},
"took_us": 882
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
| Parameter | Default | Is |
|---|---|---|
at | required | lat,lon. |
parameter | required | The parameter as the feed names it — see below. Exact and case-sensitive. |
to | the feed's end | Unix seconds, inclusive. The default is the last time the answering feed holds, not now. |
from | to − 24 h | Unix seconds, inclusive. After to is a 400, from is after to. |
stations | 1 | How many stations to answer with, nearest first. Clamped to 1–10. |
radius_m | 50,000 | Only stations within this many metres. Clamped to 0–50,000. |
The answer echoes the window it used — from and to — and lists the stations nearest first, each with its points in time order. station.name is null where the feed gives none: METAR identifies an airport only by its ICAO code. Above, Mexico City's airport holds a single report in the default day: a series is only as deep as the history the layer has collected from that feed.
One feed answers. Of the feeds loaded, the one whose nearest station carrying the parameter is closest wins, and every station in the answer comes from it; provenance names it once, at the top.
Two air-quality monitors, hourly
curl -G "https://api.oslew.com/v1/observations" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'at=37.7749,-122.4194' \
--data-urlencode 'parameter=pm25' \
--data-urlencode 'stations=2'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.observations("37.7749,-122.4194", "pm25", stations=2)import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.observations("37.7749,-122.4194", "pm25", { stations: 2 });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 294
ratelimit-reset: 1
{
"at": [
37.7749,
-122.4194
],
"parameter": "pm25",
"decimals": 1,
"from": 1795035600,
"to": 1795122000,
"stations": [
{
"station": {
"id": "060750005",
"name": "San Francisco",
"lat": 37.7658,
"lon": -122.3978
},
"distance_m": 2151.382566508885,
"points": [
{
"time": 1795035600,
"value": 2
},
{
"time": 1795039200,
"value": 1
},
{
"time": 1795042800,
"value": 2
},
{
"time": 1795046400,
"value": 7
}
]
},
{
"station": {
"id": "060010011",
"name": "Oakland West",
"lat": 37.8148,
"lon": -122.282402
},
"distance_m": 12829.247075845218,
"points": [
{
"time": 1795035600,
"value": 3
},
{
"time": 1795039200,
"value": 5
},
{
"time": 1795042800,
"value": 4
},
{
"time": 1795046400,
"value": 1
}
]
}
],
"provenance": {
"name": "airnow",
"release": "2026-11-19T21:00Z",
"license": "US EPA AirNow, public domain"
},
"took_us": 275
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call. Shortened for the page: stations.0.points shows 4 of 23. Shortened for the page: stations.1.points shows 4 of 23.
Two things to read in that answer. decimals is how many decimal places the feed stores this parameter at — the fewest, up to three, that keep every value exact — so it is the precision to format with, and a value is never more exact than that. And the values are as the feed published them: AirNow's hourly PM2.5 near zero can include small negative readings. Clamp them to zero for display if you must; an average that drops them is biased upwards.
At most 10,000 points, and which ones are dropped
One answer carries at most 10,000 points across all its stations. They are filled nearest station first and, within a station, oldest first — so a window too long to fit loses its newest points, and the further stations entirely, without an error. If the points across all stations add up to exactly 10,000, assume the answer was cut and ask for a shorter window. At one reading an hour, 10,000 points is about fourteen months of one station; at one a minute, it is a week.
A station can also come back with an empty points: it carries the parameter, and reported nothing in the window.
from oslew import Client
client = Client(base_url="https://api.oslew.com")
def history(at: str, parameter: str, start: int, end: int, step: int = 7 * 86_400):
"""One station's series over a long window, a week at a time, so no answer is cut."""
t = start
while t <= end:
page = client.observations(at, parameter, from_=t, to=min(t + step - 1, end))
for station in page["stations"][:1]:
yield from station["points"]
t += step
points = list(history("37.7749,-122.4194", "pm25", 1_789_000_000, 1_790_110_800))import { Client } from "@oslew/client";
const client = new Client({ baseUrl: "https://api.oslew.com" });
/** One station's series over a long window, a week at a time, so no answer is cut. */
async function* history(at: string, parameter: string, start: number, end: number, step = 7 * 86_400) {
for (let t = start; t <= end; t += step) {
const page = await client.observations(at, parameter, { from: t, to: Math.min(t + step - 1, end) });
for (const station of page.stations.slice(0, 1)) yield* station.points;
}
}
const points = [];
for await (const p of history("37.7749,-122.4194", "pm25", 1_789_000_000, 1_790_110_800)) points.push(p);Pages of a week each keep hourly data far under the limit, and the - 1 keeps a point that falls on a page boundary from appearing twice, since both ends of a window are inclusive.
Parameter names are the feed's
A parameter is named as its source names it, and nothing translates between them: temp_c, nottemperature; pm25, not PM2.5. The answer carries no units field, because the units are the feed's too:
| Feed | Parameters | Licence |
|---|---|---|
| METAR — airport weather reports, from aviationweather.gov (US National Weather Service) | temp_c and dewpoint_c (°C), wind_dir (degrees true, where the wind blows from), wind_kt and gust_kt (knots), vis_mi (statute miles; a report of 6+ or 10+ is stored as 6 or 10, so read it as "at least"),altim_inhg (altimeter setting, inches of mercury), slp_hpa (sea-level pressure, hPa) | Public domain |
| SEDEMA — Mexico City's monitoring network (SIMAT, RAMA), hourly averages | Stored under AirNow's names and units so the two read alike: pm25 and pm10(µg/m³), o3, no2 and so2 (ppb), co (ppm). Stations aresedema- and the network's three-letter code, sedema-MER for Merced | CC BY 4.0 |
| AirNow — the US EPA's air-quality network | AirNow's own names lower-cased, dots dropped and OZONE shortened: pm25 (µg/m³),o3 (ppb), pm10 and the rest by the same rule | Public domain |
| OpenAQ | As OpenAQ names them: pm25, o3, … | CC-BY |
Which of these are loaded, and for which stations, is a property of the deployment rather than of the API: the box at the top of this page says what the hosted API loads. OpenAQ is a format the ingest reads, not a feed the hosted API loads. An area only answers if its stations are in the layer. To see what is loaded, ask for a name that is not: the 400 says no station within 50000 m carries `x`; parameters loaded: and lists every one. The same message answers a real parameter that no station within the radius carries. With no station feed loaded at all it is no station-series layer loaded.
Each answer's provenance — per entry in conditions, once in observations — names the feed and its licence. Public-domain readings can be stored and republished; OpenAQ's CC-BY asks for attribution. Seedata and licensing.
Forecasts are rasters
A forecast is not a station reading, so it does not come through these routes. ECMWF's open-data forecast fields are raster layers with a time axis, asked for through /v1/rasterwith a time:
curl -G "https://api.oslew.com/v1/raster" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'layer=ecmwf_2t' \
--data-urlencode 'at=19.4326,-99.1332' \
--data-urlencode 'time=1795132800'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.raster("ecmwf_2t", time=1795132800, at="19.4326,-99.1332")import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.raster("ecmwf_2t", { time: 1795132800, at: "19.4326,-99.1332" });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 297
ratelimit-reset: 1
{
"layer": "ecmwf_2t",
"units": "K",
"resolution_m": 27830,
"time": 1795132800,
"between": [
1795132800,
1795132800
],
"results": [
{
"lat": 19.4326,
"lon": -99.1332,
"value": 289.96362847999995
}
],
"provenance": {
"name": "ecmwf-open-data",
"release": "2026111906",
"license": "CC-BY-4.0"
},
"took_us": 80
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
| Layer | Is | Units |
|---|---|---|
ecmwf_2t | Air temperature 2 m above the ground | K — subtract 273.15 for °C |
ecmwf_10u, ecmwf_10v | Wind 10 m above the ground, eastward and northward | m/s |
ecmwf_tp | Total precipitation, accumulated from the start of the forecast run | m of water |
ecmwf_msl | Pressure reduced to mean sea level | Pa |
Each run is loaded with its fields at 0, 6, 12, 18, 24, 36 and 48 hours after it starts, and a run replaces the one before once all of them are published. So a forecast reaches at most two days ahead of the run that answered, andprovenance.release names that run, as YYYYMMDDHH in UTC.
The fields are a 0.25° grid — resolution_m 27,830 above — so a forecast describes a cell about 28 km across, not a street; the answer is bilinear between the four grid points around you, and linear in time between the two valid times in between. Here the instant asked for, 00:00 UTC on 20 November 2026, is itself a valid time, 18 hours into the run that started at 06:00 UTC the day before (provenance.release2026111906), so between names it twice and nothing is interpolated in time. The answer, 289.96 K, is 16.8 °C. Measured against the reports of 5,230 airports twelve hours ahead, the 2 m temperature was off by 1.47 K on average, and within 3 K at 89% of them; the worst are places a 28 km cell cannot describe, like an airport at 3,500 m in a valley.
Two conversions come up every time. Wind is two components: speed is √(u² + v²), and the direction it blows from, as a weather report gives it, is atan2(−u, −v) in degrees, modulo 360. Precipitation is a running total since the run began, so the rain between two instants is the difference of the two values — and metres are a thousand millimetres.
The time axis, how between behaves at and beyond its ends, and the other raster layers are inelevation and rasters.
Endpoints
/v1/conditionsplatformThe latest reading of every parameter near a point, each from the nearest station carrying it.
/v1/observationsplatformOne parameter's time series (air quality, weather) at the stations nearest a point, from a station feed.