Skip to main content

Python library to retrieve information from Instituto Português do Mar e Atmosfera.

Project description

PyPI version

pyipma

Python library to retrieve information from Instituto Português do Mar e Atmosfera

Requirements

  • aiohttp
  • geopy

Example

Coordinates are passed as latitude, longitude.

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())

Changelog

  • 3.0.10 - Update aiohttp support and response handling
  • 3.0.9 - Adjust forecast window for 24 hours periods
  • 3.0.8 - Adds Weather Warnings
  • 3.0.7 - Adds UV Index (@tokenize74)
  • 3.0.6 - Bug Fixes
  • 3.0.3 - Adds RCM (Fire Risk)
  • 3.0.2 - Changes to fully support Home Assistant integration
  • 3.0.0 - Backend fully rewritten, but keeping backward compatibility at interface level
  • 2.1.5 - Better logging and code formated with black
  • 2.1.0 - Sea Forecast
  • 2.0.5 - Look for previous observations when no temperature/humidity available
  • 2.0.4 - Ignore Observation stations with temperature/humidity -99
  • 2.0.3 - Searches next closest station when offline
  • 2.0.2 - Adds Station Lat/Lon
  • 2.0.1 - fixes
  • 2.0.0 - Major refactor
  • 1.2.1 - Fix pip
  • 1.2.0 - Wind direction corrected
  • 1.1.6 - Interpret -99 and unavailable
  • 1.1.5 - Cache values
  • 1.1.4 - New API
  • ...

Credits

Values are obtained from IPMA

Contributors

@abmantis @joaocps

Copyright

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

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

pyipma-3.0.10.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyipma-3.0.10-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file pyipma-3.0.10.tar.gz.

File metadata

  • Download URL: pyipma-3.0.10.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyipma-3.0.10.tar.gz
Algorithm Hash digest
SHA256 b44b61e38cd070cc8e68846ea7414c2a56912d594cceac7975d3c4539421d65e
MD5 5abab394257fcc830f141b081d49ae7c
BLAKE2b-256 5454827f597ea8ebc3555eabd48183c232027f138ccf0f4fa168488a35c22aee

See more details on using hashes here.

File details

Details for the file pyipma-3.0.10-py3-none-any.whl.

File metadata

  • Download URL: pyipma-3.0.10-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyipma-3.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 1ea4e3f08b86ab3aae3259fe4b25208bf2170ee129978a23ac22dae7668c97cf
MD5 3e28cdeaca2482e18a20ebf95b00fa62
BLAKE2b-256 2504d6918c4eba0f352e7531bd06b8756c3ee011bf3d601c784929d944a11266

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page