Skip to main content

Provides access to the Wasserschutzpolizei Zurich live and historic weather data.

Project description

Weatherstation API Client

This library provides access to the Wasserschutzpolizei Zurich live (using this JSON API) and historic (using these CSV files) weather data.

Install

This package builds on Python 3.

sudo pip3 install fhnw_ds_weatherstation_client

Download Historic Data

mkdir data && cd data
wget https://raw.githubusercontent.com/jelleschutter/fhnw-ds-weatherstation-client/data/history/messwerte_mythenquai_2007-2019.csv
wget https://raw.githubusercontent.com/jelleschutter/fhnw-ds-weatherstation-client/data/history/messwerte_mythenquai_2020.csv
wget https://raw.githubusercontent.com/jelleschutter/fhnw-ds-weatherstation-client/data/history/messwerte_tiefenbrunnen_2007-2019.csv
wget https://raw.githubusercontent.com/jelleschutter/fhnw-ds-weatherstation-client/data/history/messwerte_tiefenbrunnen_2020.csv
cd ..

Usage

You need to run this code with Python 3 and make sure you adapt config.historic_data_folder based on your environment if necessary (default is ./data).

# import the library
import fhnw_ds_weatherstation_client as weather
# import os

# DB and CSV config
config = weather.Config()
# define CSV path (you need to define this based on your environment)
# config.historic_data_folder='.'+os.sep+'data'
# set batch size for DB inserts (decrease for raspberry pi)
# config.historic_data_chunksize=10000
# define DB host
# config.db_host='localhost'

# connect to DB
weather.connect_db(config)
# clean DB
weather.clean_db(config)
# import historic data
weather.import_historic_data(config)
# import latest data (delta between last data point in DB and current time)
weather.import_latest_data(config)

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fhnw_ds_weatherstation_client-0.0.9.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page