Weather on the Event Day
wed
's idea is to automate something I do pretty often: once I register for a run or triathlon event, I frequently check the city's weather forecast for the race's date and time in the previous days.
Requirements
You will need an OpenWeather API key as en environment variable called OPEN_WEATHER_API_KEY
.
Use cases
Try wed --help
.
Query a date and time followed by a location
Run wed
with two arguments:
$ wed --when "2022-07-09 09:00" --location "Ottawa, ON"
π€ 26Β°C (feels like 27Β°C) β 40% chance of rain & 10% humidity π¨ 4.2 km/h W
Or with a JSON output:
$ wed --when "2022-07-09 09:00" --location "Ottawa, ON" --json
{
"temperature": 26,
"feels_like": 27,
"chance_of_rain": 0.4,
"humidity": 0.1,
"wind_speed": 4.2,
"wind_direction": "W",
"description": "scattered clouds",
}
Save an event
Run wed
with three arguments:
$ wed --name "National Capital Triathlon" --when "2022-07-09 09:00" --location "Ottawa, ON, Canada"
Query saved events
Run wed
with no arguments:
$ wed
π National Capital Triathlon (Jul 7, 09:00) π Ottawa, ON, Canada
π€ 26Β°C (feels like 27Β°C) β 40% chance of rain & 10% humidity π¨ 4.2 km/h W
Or with a JSON output:
$ wed --json
[
{
"name": "National Capital Triathlon",
"when": "2022-07-09 09:00:00",
"location": "Ottawa, ON, Canada",
"weather": {
"temperature": 26,
"feels_like": 27,
"chance_of_rain": 0.4,
"humidity": 0.1,
"wind_speed": 4.2,
"wind_direction": "W",
"description": "scattered clouds",
}
}
]
Data sources
- Convertion of location (city/country) to a latitude and longitude: Nominatin
- Weather forecast:
- If t - 5 days: 3h forecast
- There are other endpoints (hourly closer to the event, daily up to 30 days from the event), but since they are paid,
wed
doesn't use them
Data management and persistence
- The app automaticaly deletes past events when the app is run
- The app igonres events that are more than 5 days ahead
- Data is persisted in simple file
~/.wed