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

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.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.0.tar.gz (9.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: pyipma-3.0.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for pyipma-3.0.0.tar.gz
Algorithm Hash digest
SHA256 2df9dab40f028a61c85c7ddfdd3e0f6ad0c1204861eaf950b48d3cd22bbc5048
MD5 d22adf201bf8a4899ade243cbcdc193a
BLAKE2b-256 433e9c97c57604443014ab59e1272790fa9cf32207ff29c2d8898b3dec15b250

See more details on using hashes here.

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