openweathermap请求获取天气历史Pandas DataFrame
项目描述
OpenWeatherMap Requests
Python 包,用于使用 OpenWeatherMap.org 的 Requests 和 Requests-cache 获取天气历史并获取 Pandas DataFrame。
命令行界面使用方法
当前天气
获取当前天气数据
$ python openweathermap_requests.py --lon 0.34189 --lat 46.5798114
历史天气数据
使用以下方式获取从2014/01/01到2014/12/01的坐标(lon=0.34189,lat=46.5798114)的最近气象站的历史天气数据:
$ python openweathermap_requests.py --lon 0.34189 --lat 46.5798114 --range 20140101:20141201
库使用
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)
安装
从Python包索引
$ pip install openweathermap_requests
从源
使用Git获取最新版本
$ git clone https://github.com/scls19fr/openweathermap_requests.git $ cd openweathermap_requests $ python setup.py install
链接
文档可在 Read The Docs 上找到;
源代码和问题跟踪可在 GitHub 上找到。
请随意 打赏我!
项目详情
关闭
哈希值 for openweathermap_requests-0.0.5-py2.py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 721290a416a44a8d6308b9fa3a4cd4d4255c792ad5df1279943953c190fc95d0 |
|
MD5 | b0d6813c4813223fc8fa870e28cfc38d |
|
BLAKE2b-256 | 7425f2aa31e6895cf45cf33105e056e6c1174d8a1c66abeff400f11fb53b25b5 |