Skip to main content

gardenpy-meteocat

License PyPI version

Reference evapotranspiration (ETo) calculations from Meteocat station data for the Meteocat Home Assistant integration.

gardenpy-meteocat is a Python library that computes the reference evapotranspiration (ETo) locally from the weather data already fetched by the Meteocat Home Assistant integration, following the FAO-56 methodology. This avoids calling the Meteocat XEMA API for the ETo variable (6006), saving quota.

Features

  • FAO-56 Penman-Monteith (daily and hourly), the reference standard.
  • Nighttime ETo included: the hourly equation computes evapotranspiration during the night when wind is present and humidity is low, matching the behaviour of Meteocat's official ETo since July 2026.
  • Hargreaves-Samani fallback when humidity, wind or radiation data are missing.
  • Solar radiation estimated from temperature range when no radiometer is available.
  • Consumes the same station JSON returned by MeteocatStationData.get_station_data (no extra API calls).
  • Returns hourly values in the same format as the Meteocat variable 6006 (baseHoraria HO), so it can be used as a drop-in replacement.

Installation

pip install gardenpy-meteocat

Quick start

from gardenpy import Evapotranspiration

eto = Evapotranspiration(latitude=41.38197, longitude=1.93564, elevation=252)

# station_data is the JSON returned by MeteocatStationData.get_station_data
daily = eto.daily(station_data)      # -> {"date", "method", "eto_mm", "inputs"}
hourly = eto.hourly(station_data)    # -> {"date", "method", "eto_daily_mm", "codi": 6006, "lectures": [...]}

The hourly() result matches the structure of the Meteocat API variable 6006, allowing it to replace the API call without consuming XEMA quota.

Methods

  • penman_monteith_daily(tmax, tmin, rh_max, rh_min, u2, rs, latitude, jday, elevation)
  • penman_monteith_hourly(t, rh, u2, rs, latitude, jday, hour, longitude, elevation)
  • hargreaves_samani(tmax, tmin, latitude, jday)
  • estimated_solar_radiation(tmax, tmin, latitude, jday)

All equations follow the FAO-56 documentation (Chapters 3 and 4).

Tests

pip install -e .[test]
pytest

Release

El repositorio incluye un workflow de GitHub Actions (.github/workflows/release.yml) basado en python-semantic-release. Cada push a la rama master ejecuta los tests y, si los commits siguen el formato conventional commits, calcula la versión siguiente, actualiza pyproject.toml y gardenpy/version.py, genera el changelog, crea la tag vX.Y.Z, crea el release de GitHub y publica el paquete en PyPI — todo automáticamente.

Para publicar una versión nueva no hay que tocar nada a mano; basta con usar mensajes de commit convencionales:

  • feat: ... → incremento de versión menor (1.1.0)
  • fix: ... → incremento de parche (1.0.1)
  • feat!: ... o BREAKING CHANGE: → incremento de versión mayor (2.0.0)
  • otros tipos (docs:, chore:, refactor:, ...) → no generan release

La primera vez, si el repositorio no tiene ninguna tag, es recomendable empujar una tag base v1.0.0 para que PSR tome como referencia el estado actual antes del flujo automático (aunque no dispara el workflow, que solo reacciona a push a master).

Requisitos previos:

  • Añade en GitHub el secret PYPI_API_TOKEN con un token de PyPI (scope al proyecto gardenpy-meteocat o a toda la cuenta) que se crea en https://pypi.org/manage/account/token/.
  • pytest se ejecuta en CI; los ficheros de validación en tests/files/ deben estar incluidos en el repositorio para que el test contra los datos oficiales se ejecute (si no están, ese test se omite).

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gardenpy_meteocat-1.0.2.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

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

gardenpy_meteocat-1.0.2-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file gardenpy_meteocat-1.0.2.tar.gz.

File metadata

  • Download URL: gardenpy_meteocat-1.0.2.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for gardenpy_meteocat-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a28bc6e1ee99bf2658acac7a6e5b3d7ee453d18714cac33ffbb742fde45faa38
MD5 f1186af5f874a0940e43be58213b7869
BLAKE2b-256 d2b43e8d859e188504707bb7079ef3b960f4857fe18437063d1cef44916ccf88

See more details on using hashes here.

File details

Details for the file gardenpy_meteocat-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for gardenpy_meteocat-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1abc38f555c09777d63355c0a2de625004de2146389074e4efa3e98856be1acb
MD5 02a5c51158d7b46394a3d4c19739df2a
BLAKE2b-256 68f0505b9a766b37d90e1f082bf78b2ccd0e86c852caf8389e194f0da51bd46d

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

This release

1.0.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page