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
- @markif - Initial Development
- @jelleschutter - Further Development
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fhnw_ds_weatherstation_client-0.0.19.tar.gz
.
File metadata
- Download URL: fhnw_ds_weatherstation_client-0.0.19.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b4e250117e1076ee26175f9f790f08b9a4bc414614702bae36609055d18d0b0 |
|
MD5 | c167c4ddae181727aa4e02b20938a7e8 |
|
BLAKE2b-256 | 3e28e15ea2101b1f37ff535b766f1609a400634f9534a6f7cc4d170b0cacf765 |
File details
Details for the file fhnw_ds_weatherstation_client-0.0.19-py3-none-any.whl
.
File metadata
- Download URL: fhnw_ds_weatherstation_client-0.0.19-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83c8b771fee3c3759b5e897d32eff5f90b044fea495fbcebe091d46e6f52c900 |
|
MD5 | ee9dd37deba2880925c930ac452d0ecb |
|
BLAKE2b-256 | 083892449da8410e68f6afe7f6c956e34e9eecb5dffa373e83527f4825f81eeb |