Skip to content

Collect weather forecasts from the Dark Sky API and store them in an SQL database.

License

Notifications You must be signed in to change notification settings

SeitaBV/weatherforecaststorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeatherForecastStorage

A tool to collect weather forecasts from DarkSky for any number of cities in the world and store them in an SQL database. This is useful to run as an hourly (cron) job.

DarkSky provides forecasts for many kinds of sensors (e.g. temperature, wind speed) up to 24 hours ahead. However, they do not store these forecasts for later retrieval. For past data, you'll only get actual measurements from their API. To train and test any forecasting model, you'll need actual forecasts and this tool helps you automate their collection.

We save the forecasts based on a data model provided by the TimelyBeliefs package. This model connects sensors (which are automatically created for you) to forecasts (beliefs), and keeps track of event time and belief time.

Setup

  1. (optional) install / activate a virtual environment
  2. export PYTHONPATH=/your/path/to/weatherforecaststorage
  3. pip install -r requirements.txt
  4. cp config/configuration.ini.sample config/configuration.ini
  5. Adjust database connection string in config/configuration.ini
  6. Also adjust in this config file which cities you want to get forecasts for (an extensive list of cities worldwide is available in data/City_geolocation-en-v2.csv)
  7. Create a sensor/location lookup table: python -c "from weatherforecast.utils import helping_tables_utility; helping_tables_utility.create_sensor_location_id_mapping_table()"

Generate forecasts

Run this command to generate forecasts:

python weatherforecast/get_new_forecasts.py

About

Collect weather forecasts from the Dark Sky API and store them in an SQL database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages