Build Database

On this page

Build a SQLite database or a Parquet file from the station files in your local repository. The SQLite database has the same structure as the official stations database, which makes it easy to test your changes locally before submitting them.

Usage#

Bash
meteo station build [OPTIONS]

By default, the database is written to stations.db in the root of the stations repository. With --format parquet, the default file is stations.parquet. Existing files are overwritten.

Examples#

Bash
meteo station build                         # Build stations.db in the repository root
meteo station build --output ~/stations.db  # Custom output path
meteo station build --format parquet        # Build stations.parquet in the repository root

Parquet Format#

The Parquet file contains one row per station, sorted by ID:

Column Type Description
id string Meteostat ID
name string English name
names map<string, string> Names in other languages by language code (null if none)
country string ISO 3166-1 alpha-2 country code
region string ISO 3166-2 region code
latitude double Latitude
longitude double Longitude
elevation int16 Elevation in meters
timezone string IANA time zone
identifiers map<string, string> Identifiers by key, e.g. wmo or icao (null if none)

Identifiers and translated names are stored as maps, so new identifier types or languages don't change the columns. Parquet readers can load only the columns they need, e.g. with DuckDB:

SQL
SELECT id, latitude, longitude, identifiers['icao'] AS icao
FROM 'stations.parquet';

Parquet output requires the contrib extra:

Bash
uv tool install "meteostat-cli[contrib]"

Options#

Option Short Description
--output -o Output file path (default: stations.db or stations.parquet in the repository root)
--format -f Output format: sqlite (default) or parquet
--skip-validation Don't validate stations before building
--repo Path to the stations repository (overrides stations_repo)