openweathermap requests fetch weather history Pandas DataFrame
Project description
OpenWeatherMap Requests
Python package to fetch data from OpenWeatherMap.org using Requests and Requests-cache and get Pandas DataFrame with weather history.
Command Line Interface Usage
Current weather
Get current weather data
$ python openweathermap_requests.py --lon 0.34189 --lat 46.5798114
Historical weather data
Fetch historical weather data from nearest weather station of coordinates (lon=0.34189, lat=46.5798114) from 2014/01/01 to 2014/12/01 using:
$ python openweathermap_requests.py --lon 0.34189 --lat 46.5798114 --range 20140101:20141201
Library Usage
import datetime import logging logger = logging.getLogger() logger.setLevel(logging.DEBUG) from openweathermap_requests import OpenWeatherMapRequests ow = OpenWeatherMapRequests(api_key='', cache_name='cache-openweathermap', expire_after=5*60) (lon, lat) = (0.34189, 46.5798114) # Poitiers data = ow.get_weather(lon=lon, lat=lat) # display current weather data print(data) stations = ow.find_stations_near(lon=lon, lat=lat, cnt=10) # get 10 nearest stations from coordinates (lon, lat) station_id = stations.iloc[0]['station.id'] # get station_id of nearest station start_date = datetime.datetime(2014, 1, 1) end_date = datetime.datetime(2014, 6, 1) data = ow.get_historic_weather(station_id, start_date, end_date) # get historic weather from start date to end date print(data)
Install
From Python package index
$ pip install openweathermap_requests
From source
Get latest version using Git
$ git clone https://github.com/scls19fr/openweathermap_requests.git $ cd openweathermap_requests $ python setup.py install
Links
Documentation can be found at Read The Docs ;
Source code and issue tracking can be found at GitHub.
Feel free to tip me!
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
Close
Hashes for openweathermap_requests-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0d023eced87e286d39fdac5a431920053f2a89792b8338b9fd735058e0ee252 |
|
MD5 | 27a2a11c201687541e4f20bbb58d29c5 |
|
BLAKE2b-256 | c61e5e15f41412556f6c9a25f610d0f4a9b7293c8c4bc54cdbf270762df02003 |
Close
Hashes for openweathermap_requests-0.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c796ed1315c4a078bce8dae5673908b6a2fe5ea685f22a27e182bfe2f14a6c12 |
|
MD5 | 3db0ac0f2174ee39e89d1b41fd1794a7 |
|
BLAKE2b-256 | 83017a0e2fcb7d0d14089264aaf6708e68a1d2aae2d16baf0eb64dd1d23eb86d |