跳转到主要内容

Python库,用于从葡萄牙海洋和大气研究所获取信息。

项目描述

PyPI version

pyipma

Python库,用于从葡萄牙海洋和大气研究所获取信息

需求

  • aiohttp
  • geopy

示例

import asyncio
import aiohttp

from pyipma.api import IPMA_API
from pyipma.location import Location

async def main():
    async with aiohttp.ClientSession() as session:
        api = IPMA_API(session)

        location = await Location.get(api,  40.6517, -8.6573, sea_stations=True)
        print("Forecast for {}".format(location.name))
        print("Nearest station is {}".format(location.station))
        print("Nearest sea station is {}".format(location.sea_station_name))

        obs = await location.observation(api)
        print("Current weather is {}".format(obs))

        forecasts = await location.forecast(api)
        print("Forecast for tomorrow {}".format(forecasts[0]))
        
        sea_forecast = await location.sea_forecast(api)
        print("Sea forecast for today {}".format(sea_forecast))

asyncio.get_event_loop().run_until_complete(main())

变更日志

  • 3.0.6 - 错误修复
  • 3.0.3 - 添加RCM(火灾风险)
  • 3.0.2 - 更好地支持Home Assistant集成
  • 3.0.0 - 后端完全重写,但保持接口级别的向后兼容性
  • 2.1.5 - 更好的日志记录和代码格式化
  • 2.1.0 - 海上预报
  • 2.0.5 - 当没有温度/湿度数据时,寻找以前的观测数据
  • 2.0.4 - 忽略温度/湿度为-99的观测站
  • 2.0.3 - 离线时搜索最近的站
  • 2.0.2 - 添加站点的经纬度
  • 2.0.1 - 修复
  • 2.0.0 - 主要重构
  • 1.2.1 - 修复pip
  • 1.2.0 - 纠正风向
  • 1.1.6 - 解释-99和不可用
  • 1.1.5 - 缓存值
  • 1.1.4 - 新API
  • ...

致谢

数据来自IPMA

贡献者

@abmantis @joaocps

版权

(C) 2018,2019,2020 Diogo Gomes diogogomes@gmail.com

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

pyipma-3.0.7.tar.gz (13.9 kB 查看哈希值)

上传时间

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面