Contributing
Meteostat maintains an open directory of weather stations on GitHub. The Meteostat CLI ships a set of contributor commands which help you add, edit and check station records in a local copy of this repository before you submit a pull request.
All contributor commands live directly under meteo station:
meteo station
├── add
├── edit <id>
├── delete <id>
├── validate [<id>...]
├── duplicates
└── build
These commands only modify files in your local clone of the stations repository. Nothing is published until your changes are merged into the main branch of meteostat/weather-stations.
📂 Setup
First, fork the weather stations repository on GitHub and clone your fork:
git clone https://github.com/<your-username>/weather-stations.git
The repository contains one JSON file per weather station in the stations directory. Each file is named after the station's Meteostat ID (e.g. stations/10637.json).
Repository Path
The contributor commands need to know where your local clone is located. Set the path once using the stations_repo configuration key:
meteo config stations_repo ~/code/weather-stations
The path must point to the root of the repository, i.e. the directory which contains the stations folder. You can check the current value at any time:
meteo config stations_repo
To use a different clone for a single command, pass the --repo option. It takes precedence over the configured path:
meteo station validate --repo ./weather-stations
If neither --repo nor stations_repo is set, the CLI uses the current working directory if it looks like a stations repository and exits with an error otherwise.
🔄 Workflow
A typical contribution looks like this:
# 1. Create a branch in your local clone
git -C ~/code/weather-stations checkout -b add-my-station
# 2. Add or edit station records
meteo station add
meteo station edit 10637
# 3. Check your changes
meteo station validate
meteo station duplicates
# 4. Commit, push and open a pull request
git -C ~/code/weather-stations commit -am "Add my station"
git -C ~/code/weather-stations push -u origin add-my-station
Please make sure meteo station validate passes before opening a pull request. The same checks are run automatically on every pull request.
✍️ Guidelines
- Names of weather stations are capitalized.
- Use short and descriptive names for a weather station.
- Refer to aerodromes which handle air cargo or passengers as airports and use the term airfield if they don't.
- Only include identifiers which are actually set. Don't add empty values.
- Prefer
editoverdelete+addso the Meteostat ID of a station stays stable.
👀 Learn More
📄️ Add Station
Add a new weather station to the directory. The command creates a new JSON file in the stations directory of your local repository and assigns a unique Meteostat ID automatically.
📄️ Edit Station
Edit an existing weather station in your local repository.
📄️ Delete Station
Remove a weather station from your local repository.
📄️ Validate Stations
Check station records in your local repository for errors. Validate selected stations by passing their IDs, or all stations when no IDs are given.
📄️ Find Duplicates
Find potential duplicate stations in your local repository. Two stations are reported as potential duplicates if they share an identifier (e.g. WMO or ICAO ID) or are located close to each other and have similar names.
📄️ Build Database
Build a SQLite database from the station files in your local repository. The resulting file has the same structure as the official stations database, which makes it easy to test your changes locally before submitting them.