Open-Meteo
Open-Meteo weather — forecasts, history, air quality, marine, flood and climate data
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/open-meteo/index.md to help me query Open-Meteo with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Try it in your browser
Run a live query with no installation or account. Your browser connects to the public Open-Meteo demo hosted by Query Farm: three-day forecast for Berlin and Tokyo.
Example output · captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
ATTACH 'open_meteo' AS open_meteo (TYPE vgi, LOCATION 'https://open-meteo.vgi.query.farm');
SELECT 'Berlin' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 3, timezone := 'UTC')
UNION ALL
SELECT 'Tokyo' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(35.68, 139.69, forecast_days := 3, timezone := 'UTC')
ORDER BY city, day;
| city | day | high_c | low_c |
|---|---|---|---|
| Berlin | 2026-12-01 | 4.6 | 0 |
| Berlin | 2026-12-02 | 3.8 | -0.3 |
| Berlin | 2026-12-03 | 7.1 | 1.2 |
| Tokyo | 2026-12-01 | 18.8 | 8.1 |
| Tokyo | 2026-12-02 | 16.9 | 9.5 |
Runs in your browser and attaches the public demo Query.Farm hosts on Cloudflare (open-meteo.vgi.query.farm). The first run downloads the engine; the SQL shell keeps the worker attached so you can write your own queries.
Quick start
Choose where to run Open-Meteo, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
ATTACH 'open_meteo' AS open_meteo (
TYPE vgi,
LOCATION 'https://open-meteo.vgi.query.farm'
);
3. Run a query
SELECT 'Berlin' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 3, timezone := 'UTC')
UNION ALL
SELECT 'Tokyo' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(35.68, 139.69, forecast_days := 3, timezone := 'UTC')
ORDER BY city, day
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'open_meteo' AS open_meteo
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT 'Berlin' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 3, timezone := 'UTC')
UNION ALL
SELECT 'Tokyo' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(35.68, 139.69, forecast_days := 3, timezone := 'UTC')
ORDER BY city, day
Query Farm operates Open-Meteo for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use open_meteo as the catalog alias for the query below.
4. Run a query
SELECT 'Berlin' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 3, timezone := 'UTC')
UNION ALL
SELECT 'Tokyo' AS city, time::DATE AS day,
temperature_2m_max AS high_c, temperature_2m_min AS low_c
FROM open_meteo.main.forecast_daily(35.68, 139.69, forecast_days := 3, timezone := 'UTC')
ORDER BY city, day
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
The public demo follows the release deployed by Query Farm. To control the version, deploy the release source on a server you manage, then connect to your endpoint.
Overview
Weather, air-quality, marine, flood, climate, geocoding & elevation (Open-Meteo)
Open-Meteo weather for DuckDB
Open-Meteo is a free, high-resolution weather API. This catalog wraps it as SQL table functions so you can query weather, climate and geospatial data directly from DuckDB.
What you can ask
Point-based forecasts (hourly, daily, current), historical reanalysis back to 1940, air quality, marine waves and swell, flood river-discharge, and downscaled climate projections. A geocoding search maps place names to coordinates, and an elevation lookup returns terrain height. Inline decoding macros turn raw coded columns into labels (weather code → text/emoji, wind direction → compass, AQI and UV → categories).
Conventions
Every function takes a latitude/longitude (geocoding takes a name). Timestamps are always returned in UTC; a timezone argument only controls how daily aggregates are bucketed. Commercial customers can pass an apikey at ATTACH time to use the paid endpoints.
ATTACH options
- apikey
- Open-Meteo commercial API key. Omit for the free tier. When set, requests use the customer-* API hosts.VARCHAR
Catalog
Everything open_meteo exposes once attached — read straight from the worker's
released build.
main 1 view · 16 functions · 6 macros
Open-Meteo weather, climate, air-quality, marine, flood, geocoding & elevation functions.
Schema examples (8)
Current conditions in Berlin, weather code decoded to text.
SELECT temperature_2m,
open_meteo.main.weather_code_text(weather_code) AS conditions
FROM open_meteo.main.forecast_current(52.52, 13.41);
Geocode a place name; its coordinates feed the forecast functions.
SELECT name, latitude, longitude
FROM open_meteo.main.geocoding('Paris', count := 1);
The usual starting point: a place name joined straight through to its current weather.
SELECT g.name, w.temperature_2m,
open_meteo.main.weather_code_text(w.weather_code) AS conditions
FROM open_meteo.main.geocoding('Paris', count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
A column of place names geocoded and forecast in one query, each city's days in its own local time ('auto' is resolved from each row's coordinates).
SELECT p.city, d.time, d.temperature_2m_max
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_daily(g.latitude, g.longitude, forecast_days := 3, timezone := 'auto') AS d
ORDER BY p.city, d.time;
4 more examples
Planning an outdoor run: the dry hours of Berlin's next two days, cleanest air first — the hourly weather forecast joined to the air-quality forecast on the same UTC hour, with the European AQI decoded to its band.
SELECT w.time, w.temperature_2m, a.european_aqi,
open_meteo.main.european_aqi_category(a.european_aqi) AS air_quality
FROM open_meteo.main.forecast_hourly(52.52, 13.41, forecast_days := 2) AS w
JOIN open_meteo.main.air_quality_hourly(52.52, 13.41, forecast_days := 2) AS a ON a.time = w.time
WHERE w.precipitation = 0
ORDER BY a.european_aqi, w.time
LIMIT 10;
Surf check for a beach named rather than located: geocode Scheveningen once, then line up its hourly wave height and period with the land forecast's wind speed and compass direction at the same point.
SELECT m.time, m.wave_height, m.wave_period, f.wind_speed_10m,
open_meteo.main.wind_compass(f.wind_direction_10m) AS wind_from
FROM open_meteo.main.geocoding('Scheveningen', count := 1) AS g,
LATERAL open_meteo.main.marine_hourly(g.latitude, g.longitude, forecast_days := 2) AS m
JOIN open_meteo.main.forecast_hourly(g.latitude, g.longitude, forecast_days := 2) AS f ON f.time = m.time
ORDER BY m.time;
How sure is the forecast? Berlin's best-match daily high for the next 5 local days next to the lowest and highest of the GFS ensemble members — days where the forecast high falls outside that range disagree with the whole ensemble.
SELECT f.date, f.temperature_2m_max AS forecast_high,
list_min(list_value(*COLUMNS('temperature_2m_max_member\d+'))) AS members_low,
list_max(list_value(*COLUMNS('temperature_2m_max_member\d+'))) AS members_high
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 5, timezone := 'auto') AS f
JOIN open_meteo.main.ensemble_daily(52.52, 13.41, forecast_days := 5, timezone := 'auto') AS e ON e.date = f.date
ORDER BY f.date;
This week against the same week last year: Berlin's daily forecast high joined to the reanalysis high for the same calendar date one year earlier (the archive window is computed from today, so the query never needs editing).
SELECT f.date, f.temperature_2m_max AS forecast_high,
h.temperature_2m_max AS last_year_high,
round(f.temperature_2m_max - h.temperature_2m_max, 1) AS warmer_by
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 7) AS f
JOIN open_meteo.main.historical_daily(52.52, 13.41, strftime(current_date - INTERVAL 1 YEAR - INTERVAL 1 DAY, '%Y-%m-%d'), strftime(current_date - INTERVAL 1 YEAR + INTERVAL 8 DAY, '%Y-%m-%d')) AS h ON h.date = CAST(f.date - INTERVAL 1 YEAR AS DATE)
ORDER BY f.date;
weather_codes
WMO 4677 weather-code reference: numeric code → text description and emoji.
Label a forecast by joining to the code table.
SELECT f.time, w.description, w.emoji
FROM open_meteo.main.forecast_hourly(52.52, 13.41, forecast_days := 1) f
JOIN open_meteo.main.weather_codes w ON w.code = f.weather_code
ORDER BY f.time;
Same, for a place named rather than located: geocode, forecast, then label.
SELECT g.name, f.time, w.description, w.emoji
FROM open_meteo.main.geocoding('Oslo', count := 1) AS g,
LATERAL open_meteo.main.forecast_hourly(g.latitude, g.longitude, forecast_days := 1) AS f
JOIN open_meteo.main.weather_codes w ON w.code = f.weather_code
ORDER BY f.time;
Browse the lookup on its own — no arguments needed.
SELECT code, description, emoji
FROM open_meteo.main.weather_codes
ORDER BY code;
air_quality_current (latitude DOUBLE, longitude DOUBLE, timezone := VARCHAR)
Current air-quality (pollutants + AQI) for a coordinate.
Current air-quality (pollutants + AQI) for a coordinate (Berlin).
SELECT time, pm10, pm2_5
FROM open_meteo.main.air_quality_current(52.52, 13.41);
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.pm10
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.air_quality_current(c.lat, c.lon) AS w;
Current air-quality (pollutants + AQI) for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.time, w.pm10
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.air_quality_current(g.latitude, g.longitude) AS w;
1 more example
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.pm10
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.air_quality_current(g.latitude, g.longitude) AS w;
air_quality_hourly (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, past_days := BIGINT, timezone := VARCHAR)
Hourly air-quality (pollutants + AQI) forecast for a coordinate.
Hourly air-quality (pollutants + AQI) forecast for a coordinate (Berlin).
SELECT time, pm10, pm2_5
FROM open_meteo.main.air_quality_hourly(52.52, 13.41)
ORDER BY time;
Planning an outdoor run: the dry hours of Berlin's next two days, cleanest air first — the hourly weather forecast joined to the air-quality forecast on the same UTC hour, with the European AQI decoded to its band.
SELECT w.time, w.temperature_2m, a.european_aqi,
open_meteo.main.european_aqi_category(a.european_aqi) AS air_quality
FROM open_meteo.main.forecast_hourly(52.52, 13.41, forecast_days := 2) AS w
JOIN open_meteo.main.air_quality_hourly(52.52, 13.41, forecast_days := 2) AS a ON a.time = w.time
WHERE w.precipitation = 0
ORDER BY a.european_aqi, w.time
LIMIT 10;
Next 3 days, daily buckets in the location's local time zone.
SELECT time, pm10, pm2_5
FROM open_meteo.main.air_quality_hourly(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY time;
5 more examples
The past 7 days instead of the forecast window.
SELECT time, pm10, pm2_5
FROM open_meteo.main.air_quality_hourly(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY time;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.pm10
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.air_quality_hourly(c.lat, c.lon) AS w;
Hourly air-quality (pollutants + AQI) forecast for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.time, w.pm10
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.air_quality_hourly(g.latitude, g.longitude) AS w
ORDER BY w.time;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.pm10
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.air_quality_hourly(g.latitude, g.longitude) AS w;
Several places, each window starting at its own local midnight: 'auto' resolves the zone per row.
SELECT p.city, w.time, w.pm10
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.air_quality_hourly(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.time;
climate_daily (latitude DOUBLE, longitude DOUBLE, start_date VARCHAR, end_date VARCHAR, models := VARCHAR, timezone := VARCHAR)
Daily downscaled climate-change projections (1950→2050) for a coordinate.
Daily downscaled climate-change projections (1950→2050) for a coordinate over an explicit date range (Berlin).
SELECT date, temperature_2m_max, temperature_2m_min
FROM open_meteo.main.climate_daily(52.52, 13.41, '2024-06-01', '2024-06-07')
ORDER BY date;
Pick specific downscaled climate models.
SELECT date, temperature_2m_max, temperature_2m_min
FROM open_meteo.main.climate_daily(52.52, 13.41, '2040-01-01', '2040-12-31', models := 'MRI_AGCM3_2_S,EC_Earth3P_HR')
ORDER BY date;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.date, w.temperature_2m_max
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.climate_daily(c.lat, c.lon, '2024-06-01', '2024-06-07') AS w;
3 more examples
Daily downscaled climate-change projections (1950→2050) for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.date, w.temperature_2m_max
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.climate_daily(g.latitude, g.longitude, '2024-06-01', '2024-06-07') AS w
ORDER BY w.date;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.date, w.temperature_2m_max
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.climate_daily(g.latitude, g.longitude, '2024-06-01', '2024-06-07') AS w;
Several places, each bucketed in its own local day: 'auto' resolves the zone from each row's coordinates.
SELECT p.city, w.date, w.temperature_2m_max
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.climate_daily(g.latitude, g.longitude, '2024-06-01', '2024-06-07', timezone := 'auto') AS w
ORDER BY p.city, w.date;
elevation (latitude DOUBLE, longitude DOUBLE)
Terrain elevation (90m DEM) for a coordinate (Open-Meteo elevation).
Terrain elevation at Berlin (metres).
SELECT elevation FROM open_meteo.main.elevation(52.52, 13.41);
Near the summit of Everest.
SELECT latitude, longitude, elevation
FROM open_meteo.main.elevation(27.99, 86.93);
Elevation for a whole table of coordinates in one correlated join.
SELECT c.name, e.elevation
FROM (VALUES ('Berlin', 52.52, 13.41), ('Everest', 27.99, 86.93)) AS c(name, lat, lon),
LATERAL open_meteo.main.elevation(c.lat, c.lon) AS e;
2 more examples
Elevation for a place looked up by name rather than by coordinate.
SELECT g.name, e.elevation
FROM open_meteo.main.geocoding('Denver', count := 1) AS g,
LATERAL open_meteo.main.elevation(g.latitude, g.longitude) AS e;
Rank a column of place names by terrain height, geocoding each one.
SELECT p.city, e.elevation
FROM (VALUES ('Denver'), ('La Paz'), ('Amsterdam')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.elevation(g.latitude, g.longitude) AS e
ORDER BY e.elevation DESC;
ensemble_daily (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, models := VARCHAR, past_days := BIGINT, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Daily ensemble maximum temperature: control run plus up to 30 perturbed members.
Daily ensemble maximum temperature: control run plus up to 30 perturbed members (Berlin).
SELECT date, temperature_2m_max, temperature_2m_max_member01
FROM open_meteo.main.ensemble_daily(52.52, 13.41)
ORDER BY date;
How sure is the forecast? Berlin's best-match daily high for the next 5 local days next to the lowest and highest of the GFS ensemble members — days where the forecast high falls outside that range disagree with the whole ensemble.
SELECT f.date, f.temperature_2m_max AS forecast_high,
list_min(list_value(*COLUMNS('temperature_2m_max_member\d+'))) AS members_low,
list_max(list_value(*COLUMNS('temperature_2m_max_member\d+'))) AS members_high
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 5, timezone := 'auto') AS f
JOIN open_meteo.main.ensemble_daily(52.52, 13.41, forecast_days := 5, timezone := 'auto') AS e ON e.date = f.date
ORDER BY f.date;
Next 3 days, daily buckets in the location's local time zone.
SELECT date, temperature_2m_max, temperature_2m_max_member01
FROM open_meteo.main.ensemble_daily(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY date;
7 more examples
The past 7 days instead of the forecast window.
SELECT date, temperature_2m_max, temperature_2m_max_member01
FROM open_meteo.main.ensemble_daily(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY date;
Imperial units (°F, mph).
SELECT date, temperature_2m_max, temperature_2m_max_member01
FROM open_meteo.main.ensemble_daily(52.52, 13.41, temperature_unit := 'fahrenheit', wind_speed_unit := 'mph')
ORDER BY date;
Pick a specific weather model rather than the default blend.
SELECT date, temperature_2m_max, temperature_2m_max_member01
FROM open_meteo.main.ensemble_daily(52.52, 13.41, models := 'gfs_seamless')
ORDER BY date;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.date, w.temperature_2m_max
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.ensemble_daily(c.lat, c.lon) AS w;
Daily ensemble maximum temperature: control run plus up to 30 perturbed members, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.date, w.temperature_2m_max
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.ensemble_daily(g.latitude, g.longitude) AS w
ORDER BY w.date;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.date, w.temperature_2m_max
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.ensemble_daily(g.latitude, g.longitude) AS w;
Several places, each bucketed in its own local day: 'auto' resolves the zone from each row's coordinates.
SELECT p.city, w.date, w.temperature_2m_max
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.ensemble_daily(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.date;
ensemble_hourly (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, models := VARCHAR, past_days := BIGINT, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Hourly ensemble forecast: control run plus up to 30 perturbed members, one column each.
Hourly ensemble forecast: control run plus up to 30 perturbed members, one column each (Berlin).
SELECT time, temperature_2m, temperature_2m_member01
FROM open_meteo.main.ensemble_hourly(52.52, 13.41)
ORDER BY time;
Next 3 days, daily buckets in the location's local time zone.
SELECT time, temperature_2m, temperature_2m_member01
FROM open_meteo.main.ensemble_hourly(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY time;
The past 7 days instead of the forecast window.
SELECT time, temperature_2m, temperature_2m_member01
FROM open_meteo.main.ensemble_hourly(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY time;
6 more examples
Imperial units (°F, mph).
SELECT time, temperature_2m, temperature_2m_member01
FROM open_meteo.main.ensemble_hourly(52.52, 13.41, temperature_unit := 'fahrenheit', wind_speed_unit := 'mph')
ORDER BY time;
Pick a specific weather model rather than the default blend.
SELECT time, temperature_2m, temperature_2m_member01
FROM open_meteo.main.ensemble_hourly(52.52, 13.41, models := 'gfs_seamless')
ORDER BY time;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.ensemble_hourly(c.lat, c.lon) AS w;
Hourly ensemble forecast: control run plus up to 30 perturbed members, one column each, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.time, w.temperature_2m
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.ensemble_hourly(g.latitude, g.longitude) AS w
ORDER BY w.time;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.ensemble_hourly(g.latitude, g.longitude) AS w;
Several places, each window starting at its own local midnight: 'auto' resolves the zone per row.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.ensemble_hourly(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.time;
flood_daily (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, past_days := BIGINT)
Daily river-discharge / flood forecast for a coordinate.
Daily river-discharge / flood forecast for a coordinate (Berlin).
SELECT date, river_discharge
FROM open_meteo.main.flood_daily(52.52, 13.41)
ORDER BY date;
Next 3 days.
SELECT date, river_discharge
FROM open_meteo.main.flood_daily(52.52, 13.41, forecast_days := 3)
ORDER BY date;
The past 7 days instead of the forecast window.
SELECT date, river_discharge
FROM open_meteo.main.flood_daily(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY date;
3 more examples
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.date, w.river_discharge
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.flood_daily(c.lat, c.lon) AS w;
Daily river-discharge / flood forecast for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.date, w.river_discharge
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.flood_daily(g.latitude, g.longitude) AS w
ORDER BY w.date;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.date, w.river_discharge
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.flood_daily(g.latitude, g.longitude) AS w;
forecast_current (latitude DOUBLE, longitude DOUBLE, model := VARCHAR, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Current weather conditions for a coordinate.
Current weather conditions for a coordinate (Berlin).
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.forecast_current(52.52, 13.41);
Imperial units (°F, mph).
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.forecast_current(52.52, 13.41, temperature_unit := 'fahrenheit', wind_speed_unit := 'mph');
Select a model explicitly and inspect the response provenance. Retrieval time does not identify the forecast run.
SELECT time, temperature_2m, relative_humidity_2m, model_selection,
grid_latitude, grid_longitude, retrieved_at
FROM open_meteo.main.forecast_current(52.52, 13.41, model := 'gfs_global');
3 more examples
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.forecast_current(c.lat, c.lon) AS w;
Current weather conditions for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.time, w.temperature_2m
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
forecast_daily (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, model := VARCHAR, past_days := BIGINT, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Daily weather forecast (up to 16 days) for a coordinate.
Daily weather forecast (up to 16 days) for a coordinate (Berlin).
SELECT date, weather_code, temperature_2m_max
FROM open_meteo.main.forecast_daily(52.52, 13.41)
ORDER BY date;
This week against the same week last year: Berlin's daily forecast high joined to the reanalysis high for the same calendar date one year earlier (the archive window is computed from today, so the query never needs editing).
SELECT f.date, f.temperature_2m_max AS forecast_high,
h.temperature_2m_max AS last_year_high,
round(f.temperature_2m_max - h.temperature_2m_max, 1) AS warmer_by
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 7) AS f
JOIN open_meteo.main.historical_daily(52.52, 13.41, strftime(current_date - INTERVAL 1 YEAR - INTERVAL 1 DAY, '%Y-%m-%d'), strftime(current_date - INTERVAL 1 YEAR + INTERVAL 8 DAY, '%Y-%m-%d')) AS h ON h.date = CAST(f.date - INTERVAL 1 YEAR AS DATE)
ORDER BY f.date;
Next 3 days, daily buckets in the location's local time zone.
SELECT date, weather_code, temperature_2m_max
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY date;
7 more examples
The past 7 days instead of the forecast window.
SELECT date, weather_code, temperature_2m_max
FROM open_meteo.main.forecast_daily(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY date;
Imperial units (°F, mph).
SELECT date, weather_code, temperature_2m_max
FROM open_meteo.main.forecast_daily(52.52, 13.41, temperature_unit := 'fahrenheit', wind_speed_unit := 'mph')
ORDER BY date;
Select a model explicitly and inspect the response provenance. Retrieval time does not identify the forecast run.
SELECT date, weather_code, temperature_2m_max, model_selection,
grid_latitude, grid_longitude, retrieved_at
FROM open_meteo.main.forecast_daily(52.52, 13.41, model := 'gfs_global')
ORDER BY date;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.date, w.weather_code
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.forecast_daily(c.lat, c.lon) AS w;
Daily weather forecast (up to 16 days) for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.date, w.weather_code
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.forecast_daily(g.latitude, g.longitude) AS w
ORDER BY w.date;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.date, w.weather_code
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_daily(g.latitude, g.longitude) AS w;
Several places, each bucketed in its own local day: 'auto' resolves the zone from each row's coordinates.
SELECT p.city, w.date, w.weather_code
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_daily(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.date;
forecast_hourly (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, model := VARCHAR, past_days := BIGINT, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Hourly weather forecast (up to 16 days) for a coordinate.
Hourly weather forecast (up to 16 days) for a coordinate (Berlin).
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.forecast_hourly(52.52, 13.41)
ORDER BY time;
Next 3 days, daily buckets in the location's local time zone.
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.forecast_hourly(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY time;
The past 7 days instead of the forecast window.
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.forecast_hourly(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY time;
6 more examples
Imperial units (°F, mph).
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.forecast_hourly(52.52, 13.41, temperature_unit := 'fahrenheit', wind_speed_unit := 'mph')
ORDER BY time;
Select a model explicitly and inspect the response provenance. Retrieval time does not identify the forecast run.
SELECT time, temperature_2m, relative_humidity_2m, model_selection,
grid_latitude, grid_longitude, retrieved_at
FROM open_meteo.main.forecast_hourly(52.52, 13.41, model := 'gfs_global')
ORDER BY time;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.forecast_hourly(c.lat, c.lon) AS w;
Hourly weather forecast (up to 16 days) for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.time, w.temperature_2m
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.forecast_hourly(g.latitude, g.longitude) AS w
ORDER BY w.time;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_hourly(g.latitude, g.longitude) AS w;
Several places, each window starting at its own local midnight: 'auto' resolves the zone per row.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_hourly(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.time;
geocoding (name VARCHAR, count := BIGINT, country_code := VARCHAR, language := VARCHAR)
Search places by name and return their coordinates (Open-Meteo geocoding).
Find places named Berlin.
SELECT name, latitude, longitude, country
FROM open_meteo.main.geocoding('Berlin');
Up to 20 matches (coordinates feed the forecast_* functions).
SELECT name, latitude, longitude, country
FROM open_meteo.main.geocoding('Springfield', count := 20);
Localized search restricted to one country.
SELECT name, latitude, longitude
FROM open_meteo.main.geocoding('München', language := 'de', country_code := 'DE');
3 more examples
Resolve a whole column of place names in one correlated join.
SELECT p.city, g.name, g.latitude, g.longitude
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g;
The bridge itself: a place name straight through to current weather.
SELECT g.name, w.temperature_2m,
open_meteo.main.weather_code_text(w.weather_code) AS conditions
FROM open_meteo.main.geocoding('Reykjavík', count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
A column of place names joined through to current weather in one query.
SELECT p.city, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
historical_daily (latitude DOUBLE, longitude DOUBLE, start_date VARCHAR, end_date VARCHAR, model := VARCHAR, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Daily historical/reanalysis weather (1940→present) for a coordinate.
Daily historical/reanalysis weather (1940→present) for a coordinate over an explicit date range (Berlin).
SELECT date, weather_code, temperature_2m_max
FROM open_meteo.main.historical_daily(52.52, 13.41, '2024-06-01', '2024-06-07')
ORDER BY date;
Imperial units (°F, mph).
SELECT date, weather_code, temperature_2m_max
FROM open_meteo.main.historical_daily(52.52, 13.41, '2024-06-01', '2024-06-07', temperature_unit := 'fahrenheit', wind_speed_unit := 'mph')
ORDER BY date;
Select a model explicitly and inspect the response provenance. Retrieval time does not identify the forecast run.
SELECT date, weather_code, temperature_2m_max, model_selection,
grid_latitude, grid_longitude, retrieved_at
FROM open_meteo.main.historical_daily(52.52, 13.41, '2024-06-01', '2024-06-07', model := 'era5')
ORDER BY date;
4 more examples
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.date, w.weather_code
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.historical_daily(c.lat, c.lon, '2024-06-01', '2024-06-07') AS w;
Daily historical/reanalysis weather (1940→present) for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.date, w.weather_code
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.historical_daily(g.latitude, g.longitude, '2024-06-01', '2024-06-07') AS w
ORDER BY w.date;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.date, w.weather_code
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.historical_daily(g.latitude, g.longitude, '2024-06-01', '2024-06-07') AS w;
Several places, each bucketed in its own local day: 'auto' resolves the zone from each row's coordinates.
SELECT p.city, w.date, w.weather_code
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.historical_daily(g.latitude, g.longitude, '2024-06-01', '2024-06-07', timezone := 'auto') AS w
ORDER BY p.city, w.date;
historical_hourly (latitude DOUBLE, longitude DOUBLE, start_date VARCHAR, end_date VARCHAR, model := VARCHAR, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Hourly historical/reanalysis weather (1940→present) for a coordinate.
Hourly historical/reanalysis weather (1940→present) for a coordinate over an explicit date range (Berlin).
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.historical_hourly(52.52, 13.41, '2024-06-01', '2024-06-07')
ORDER BY time;
Imperial units (°F, mph).
SELECT time, temperature_2m, relative_humidity_2m
FROM open_meteo.main.historical_hourly(52.52, 13.41, '2024-06-01', '2024-06-07', temperature_unit := 'fahrenheit', wind_speed_unit := 'mph')
ORDER BY time;
Select a model explicitly and inspect the response provenance. Retrieval time does not identify the forecast run.
SELECT time, temperature_2m, relative_humidity_2m, model_selection,
grid_latitude, grid_longitude, retrieved_at
FROM open_meteo.main.historical_hourly(52.52, 13.41, '2024-06-01', '2024-06-07', model := 'era5')
ORDER BY time;
4 more examples
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.historical_hourly(c.lat, c.lon, '2024-06-01', '2024-06-07') AS w;
Hourly historical/reanalysis weather (1940→present) for a coordinate, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.time, w.temperature_2m
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.historical_hourly(g.latitude, g.longitude, '2024-06-01', '2024-06-07') AS w
ORDER BY w.time;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.historical_hourly(g.latitude, g.longitude, '2024-06-01', '2024-06-07') AS w;
Several places, each window starting at its own local midnight: 'auto' resolves the zone per row.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.historical_hourly(g.latitude, g.longitude, '2024-06-01', '2024-06-07', timezone := 'auto') AS w
ORDER BY p.city, w.time;
marine_daily (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, past_days := BIGINT, timezone := VARCHAR)
Daily marine forecast (wave/swell maxima) for a coordinate.
Daily marine forecast (wave/swell maxima) for a coordinate (Berlin).
SELECT date, wave_height_max, wave_direction_dominant
FROM open_meteo.main.marine_daily(52.52, 13.41)
ORDER BY date;
Next 3 days, daily buckets in the location's local time zone.
SELECT date, wave_height_max, wave_direction_dominant
FROM open_meteo.main.marine_daily(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY date;
The past 7 days instead of the forecast window.
SELECT date, wave_height_max, wave_direction_dominant
FROM open_meteo.main.marine_daily(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY date;
4 more examples
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.date, w.wave_height_max
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.marine_daily(c.lat, c.lon) AS w;
Daily marine forecast (wave/swell maxima) for a coordinate, starting from the place name 'Scheveningen' instead of a coordinate.
SELECT g.name, w.date, w.wave_height_max
FROM open_meteo.main.geocoding('Scheveningen', count := 1) AS g,
LATERAL open_meteo.main.marine_daily(g.latitude, g.longitude) AS w
ORDER BY w.date;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.date, w.wave_height_max
FROM (VALUES ('Scheveningen'), ('Brighton')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.marine_daily(g.latitude, g.longitude) AS w;
Several places, each bucketed in its own local day: 'auto' resolves the zone from each row's coordinates.
SELECT p.city, w.date, w.wave_height_max
FROM (VALUES ('Scheveningen'), ('Brighton')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.marine_daily(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.date;
marine_hourly (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, past_days := BIGINT, timezone := VARCHAR)
Hourly marine forecast (wave/swell) for a coordinate.
Hourly marine forecast (wave/swell) for a coordinate (Berlin).
SELECT time, wave_height, wave_direction
FROM open_meteo.main.marine_hourly(52.52, 13.41)
ORDER BY time;
Surf check for a beach named rather than located: geocode Scheveningen once, then line up its hourly wave height and period with the land forecast's wind speed and compass direction at the same point.
SELECT m.time, m.wave_height, m.wave_period, f.wind_speed_10m,
open_meteo.main.wind_compass(f.wind_direction_10m) AS wind_from
FROM open_meteo.main.geocoding('Scheveningen', count := 1) AS g,
LATERAL open_meteo.main.marine_hourly(g.latitude, g.longitude, forecast_days := 2) AS m
JOIN open_meteo.main.forecast_hourly(g.latitude, g.longitude, forecast_days := 2) AS f ON f.time = m.time
ORDER BY m.time;
Next 3 days, daily buckets in the location's local time zone.
SELECT time, wave_height, wave_direction
FROM open_meteo.main.marine_hourly(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY time;
5 more examples
The past 7 days instead of the forecast window.
SELECT time, wave_height, wave_direction
FROM open_meteo.main.marine_hourly(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY time;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.wave_height
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.marine_hourly(c.lat, c.lon) AS w;
Hourly marine forecast (wave/swell) for a coordinate, starting from the place name 'Scheveningen' instead of a coordinate.
SELECT g.name, w.time, w.wave_height
FROM open_meteo.main.geocoding('Scheveningen', count := 1) AS g,
LATERAL open_meteo.main.marine_hourly(g.latitude, g.longitude) AS w
ORDER BY w.time;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.wave_height
FROM (VALUES ('Scheveningen'), ('Brighton')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.marine_hourly(g.latitude, g.longitude) AS w;
Several places, each window starting at its own local midnight: 'auto' resolves the zone per row.
SELECT p.city, w.time, w.wave_height
FROM (VALUES ('Scheveningen'), ('Brighton')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.marine_hourly(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.time;
previous_runs_hourly (latitude DOUBLE, longitude DOUBLE, forecast_days := BIGINT, models := VARCHAR, past_days := BIGINT, precipitation_unit := VARCHAR, temperature_unit := VARCHAR, timezone := VARCHAR, wind_speed_unit := VARCHAR)
Hourly forecasts from successive earlier model runs, for scoring forecast skill by lead time.
Hourly forecasts from successive earlier model runs, for scoring forecast skill by lead time (Berlin).
SELECT time, temperature_2m, temperature_2m_previous_day1
FROM open_meteo.main.previous_runs_hourly(52.52, 13.41)
ORDER BY time;
Next 3 days, daily buckets in the location's local time zone.
SELECT time, temperature_2m, temperature_2m_previous_day1
FROM open_meteo.main.previous_runs_hourly(52.52, 13.41, forecast_days := 3, timezone := 'auto')
ORDER BY time;
The past 7 days instead of the forecast window.
SELECT time, temperature_2m, temperature_2m_previous_day1
FROM open_meteo.main.previous_runs_hourly(52.52, 13.41, past_days := 7, forecast_days := 0)
ORDER BY time;
5 more examples
Imperial units (°F, mph).
SELECT time, temperature_2m, temperature_2m_previous_day1
FROM open_meteo.main.previous_runs_hourly(52.52, 13.41, temperature_unit := 'fahrenheit', wind_speed_unit := 'mph')
ORDER BY time;
Many locations in one query — coordinates supplied by a column.
SELECT c.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin', 52.52, 13.41), ('Tokyo', 35.69, 139.69)) AS c(city, lat, lon),
LATERAL open_meteo.main.previous_runs_hourly(c.lat, c.lon) AS w;
Hourly forecasts from successive earlier model runs, for scoring forecast skill by lead time, starting from the place name 'Berlin' instead of a coordinate.
SELECT g.name, w.time, w.temperature_2m
FROM open_meteo.main.geocoding('Berlin', count := 1) AS g,
LATERAL open_meteo.main.previous_runs_hourly(g.latitude, g.longitude) AS w
ORDER BY w.time;
A column of place names geocoded and queried in one pass.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.previous_runs_hourly(g.latitude, g.longitude) AS w;
Several places, each window starting at its own local midnight: 'auto' resolves the zone per row.
SELECT p.city, w.time, w.temperature_2m
FROM (VALUES ('Berlin'), ('Tokyo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.previous_runs_hourly(g.latitude, g.longitude, timezone := 'auto') AS w
ORDER BY p.city, w.time;
european_aqi_category (aqi ANY)
Bucket a European AQI value into its CAMS band (e.g. 75 → 'Poor').
European AQI band for current conditions in Berlin.
SELECT european_aqi,
open_meteo.main.european_aqi_category(european_aqi) AS band
FROM open_meteo.main.air_quality_current(52.52, 13.41);
Rank named European cities by their current AQI band.
SELECT p.city, a.european_aqi,
open_meteo.main.european_aqi_category(a.european_aqi) AS band
FROM (VALUES ('Berlin'), ('Milan'), ('Warsaw')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.air_quality_current(g.latitude, g.longitude) AS a
ORDER BY a.european_aqi DESC;
us_aqi_category (aqi ANY)
Bucket a US AQI value into its EPA category (e.g. 120 → 'Unhealthy for Sensitive Groups').
US AQI category for current conditions in Los Angeles.
SELECT us_aqi, open_meteo.main.us_aqi_category(us_aqi) AS category
FROM open_meteo.main.air_quality_current(34.05, -118.24);
Same city by name — geocode, then band the AQI.
SELECT g.name, a.us_aqi,
open_meteo.main.us_aqi_category(a.us_aqi) AS category
FROM open_meteo.main.geocoding('Los Angeles', count := 1) AS g,
LATERAL open_meteo.main.air_quality_current(g.latitude, g.longitude) AS a;
uv_index_category (uv ANY)
Bucket a UV index into its WHO exposure category (e.g. 9 → 'Very High').
UV-index risk category over the next day of hourly forecast.
SELECT time, uv_index, open_meteo.main.uv_index_category(uv_index) AS risk
FROM open_meteo.main.forecast_hourly(52.52, 13.41, forecast_days := 1)
ORDER BY time;
Peak UV risk tomorrow for a place named rather than located.
SELECT w.time, w.uv_index,
open_meteo.main.uv_index_category(w.uv_index) AS risk
FROM open_meteo.main.geocoding('Nairobi', count := 1) AS g,
LATERAL open_meteo.main.forecast_hourly(g.latitude, g.longitude, forecast_days := 1) AS w
ORDER BY w.uv_index DESC
LIMIT 5;
weather_code_emoji (code ANY)
Map a WMO weather_code to a representative weather emoji (e.g. 95 → ⛈️).
Weather emoji for the current conditions.
SELECT weather_code,
open_meteo.main.weather_code_emoji(weather_code) AS icon
FROM open_meteo.main.forecast_current(52.52, 13.41);
A dashboard row per named city, geocoded in the same query.
SELECT p.city, w.temperature_2m,
open_meteo.main.weather_code_emoji(w.weather_code) AS icon
FROM (VALUES ('Berlin'), ('Tokyo'), ('Cairo')) AS p(city),
LATERAL open_meteo.main.geocoding(p.city, count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
weather_code_text (code ANY)
Translate a WMO weather_code into an English description (e.g. 61 → 'Slight rain').
Decode the current weather code to text.
SELECT weather_code,
open_meteo.main.weather_code_text(weather_code) AS conditions
FROM open_meteo.main.forecast_current(52.52, 13.41);
Same, starting from a place name: geocode, then decode.
SELECT g.name,
open_meteo.main.weather_code_text(w.weather_code) AS conditions
FROM open_meteo.main.geocoding('Lisbon', count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
wind_compass (degrees ANY)
Convert a bearing in degrees to a 16-point compass abbreviation (e.g. 315 → 'NW').
Current wind direction as a compass point.
SELECT wind_direction_10m,
open_meteo.main.wind_compass(wind_direction_10m) AS from_dir
FROM open_meteo.main.forecast_current(52.52, 13.41);
Wind direction for a place looked up by name.
SELECT g.name, w.wind_speed_10m,
open_meteo.main.wind_compass(w.wind_direction_10m) AS from_dir
FROM open_meteo.main.geocoding('Wellington', count := 1) AS g,
LATERAL open_meteo.main.forecast_current(g.latitude, g.longitude) AS w;
Try these queries
elevation_echoes_coordinate — elevation() echoes the requested coordinate and adds terrain height.
SELECT latitude, longitude FROM open_meteo.main.elevation(52.52, 13.41);
Uses elevation
geocoding_resolves_place_name — geocoding() turns a place name into the coordinate the weather functions want — the starting point for anyone who has a city rather than a latitude.
SELECT name, country_code
FROM open_meteo.main.geocoding('Tokyo', count := 1);
Uses geocoding
Current conditions in Berlin, weather code decoded to text.
SELECT temperature_2m,
open_meteo.main.weather_code_text(weather_code) AS conditions
FROM open_meteo.main.forecast_current(52.52, 13.41)
Planning an outdoor run: the dry hours of Berlin's next two days, cleanest air first — the hourly weather forecast joined to the air-quality forecast on the same UTC hour, with the European AQI decoded to its band.
SELECT w.time, w.temperature_2m, a.european_aqi,
open_meteo.main.european_aqi_category(a.european_aqi) AS air_quality
FROM open_meteo.main.forecast_hourly(52.52, 13.41, forecast_days := 2) AS w
JOIN open_meteo.main.air_quality_hourly(52.52, 13.41, forecast_days := 2) AS a ON a.time = w.time
WHERE w.precipitation = 0
ORDER BY a.european_aqi, w.time
LIMIT 10
Surf check for a beach named rather than located: geocode Scheveningen once, then line up its hourly wave height and period with the land forecast's wind speed and compass direction at the same point.
SELECT m.time, m.wave_height, m.wave_period, f.wind_speed_10m,
open_meteo.main.wind_compass(f.wind_direction_10m) AS wind_from
FROM open_meteo.main.geocoding('Scheveningen', count := 1) AS g,
LATERAL open_meteo.main.marine_hourly(g.latitude, g.longitude, forecast_days := 2) AS m
JOIN open_meteo.main.forecast_hourly(g.latitude, g.longitude, forecast_days := 2) AS f ON f.time = m.time
ORDER BY m.time
How sure is the forecast? Berlin's best-match daily high for the next 5 local days next to the lowest and highest of the GFS ensemble members — days where the forecast high falls outside that range disagree with the whole ensemble.
SELECT f.date, f.temperature_2m_max AS forecast_high,
list_min(list_value(*COLUMNS('temperature_2m_max_member\d+'))) AS members_low,
list_max(list_value(*COLUMNS('temperature_2m_max_member\d+'))) AS members_high
FROM open_meteo.main.forecast_daily(52.52, 13.41, forecast_days := 5, timezone := 'auto') AS f
JOIN open_meteo.main.ensemble_daily(52.52, 13.41, forecast_days := 5, timezone := 'auto') AS e ON e.date = f.date
ORDER BY f.date
131 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Describe the current weather in Berlin: temperature, a text summary, an emoji, and the wind direction as a compass point.
- Find the coordinates of Tokyo and return its daily high and low temperature for the next 3 days.
- For the next day in Berlin, list the hourly UV index and its WHO risk category.
- What is the terrain elevation, in metres, at latitude 27.99 and longitude 86.93?
- Get Berlin's daily maximum temperature for the first week of June 2024, and the hourly temperature for June 1st.
- What is the current US AQI in Los Angeles and its EPA health category?
Open-Meteo is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
NWS
Weather, ocean & earth
Explore US weather alerts, observations, forecast grids, bulletins, and river conditions
Buoys
Weather, ocean & earth
NOAA NDBC buoy stations, latest observations and recent station histories for marine analysis
Tides
Weather, ocean & earth
NOAA CO-OPS tide and current stations, predictions and observations for marine analysis