Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manucabral/py-smn
Servicio Meteorológico Nacional Argentina (SMN) weather and forecast service made in Python.
https://github.com/manucabral/py-smn
api-client api-wrapper argentina forecast-argentina python smn weather weather-api
Last synced: about 2 months ago
JSON representation
Servicio Meteorológico Nacional Argentina (SMN) weather and forecast service made in Python.
- Host: GitHub
- URL: https://github.com/manucabral/py-smn
- Owner: manucabral
- License: mit
- Created: 2023-01-13T18:14:32.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-23T03:43:59.000Z (almost 2 years ago)
- Last Synced: 2024-08-31T09:05:15.786Z (5 months ago)
- Topics: api-client, api-wrapper, argentina, forecast-argentina, python, smn, weather, weather-api
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-smn
A free and open source Python library for retrieving weather data from the National Meteorological Service of Argentina (SMN).## Note
This package offers two ways to obtain the requested data, the first is through the [API](https://ws.smn.gob.ar) of SMN and the second is by the public data offered by the official SMN [website](https://www.smn.gob.ar/descarga-de-datos). I recommend you use the second option since it is more accurate and is updated every day.## Installation
From PyPI
```bash
pip install py-smn
```
From source code clone it
```bash
git clone https://github.com/manucabral/py-smn.git
cd py-smn
python -m pip install -r requirements.txt
```## Usage
Using static (recommended method)
```py
import asyncio
import smnasync def main():
async with smn.Client() as client:
forecast_now = await client.get_static()
province, lat, lon = await client.get_location()
nearest_forecast = forecast_now.nearest(lat, lon)
print(nearest_forecast.weather['temp'])if __name__ == '__main__':
asyncio.run(main())
```Using API
```py
import asyncio
import smnasync def main():
async with smn.Client() as client:
forecast_now = await client.get(forecast='now')
weather_stations = forecast_now.filter(province='Buenos Aires', name='La Plata')
for weather_station in weather_stations:
print(weather_station.name, weather_station.weather['temp'])if __name__ == '__main__':
asyncio.run(main())
```## Constributions
All constributions, bug reports or fixes and ideas are welcome.