Skip to main content

openweathermap requests fetch weather history Pandas DataFrame

Project description

Latest Version Supported Python versions Download format License Development Status Documentation Status https://sourcegraph.com/api/repos/github.com/scls19fr/openweathermap_requests/.badges/status.png https://badges.gitter.im/Join%20Chat.svg https://travis-ci.org/scls19fr/openweathermap_requests.svg?branch=master

OpenWeatherMap Requests

Python package to fetch data from OpenWeatherMap.org 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)

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

openweathermap_requests-0.0.3.tar.gz (6.4 kB view details)

Uploaded Source

File details

Details for the file openweathermap_requests-0.0.3.tar.gz.

File metadata

File hashes

Hashes for openweathermap_requests-0.0.3.tar.gz
Algorithm Hash digest
SHA256 cf52501dcd91fa2bc37dce66b9c291d7a5b5d15f450edbb2ba8be12efc2d1928
MD5 fafa9469b7eeb6dc039d30a6f6fb0e32
BLAKE2b-256 eb0bcef23ed916bed94d806ae3ea1d2cb43003f5d962757538c74047aa8c2473

See more details on using hashes here.

Provenance

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