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_meteocat 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:

  • La publicación en PyPI usa Trusted Publishing (OIDC, sin tokens). El trusted publisher debe registrarse una vez en https://pypi.org/manage/account/publishing/ para el proyecto gardenpy-meteocat con figorr/gardenpy y el workflow release.yml; la primera publicación crea el proyecto en PyPI.
  • 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.1.0.tar.gz (27.8 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.1.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gardenpy_meteocat-1.1.0.tar.gz
Algorithm Hash digest
SHA256 edc8b6ea27dc39e901461d0fec42f83922dc0df5c7254d47388598cc28163792
MD5 ac161078388d2327670952e27689b5cc
BLAKE2b-256 ea544cd5fd652748e8fc9c283422919585b0d80af93d8a65025e5b08c49a861f

See more details on using hashes here.

Provenance

The following attestation bundles were made for gardenpy_meteocat-1.1.0.tar.gz:

Publisher: release.yml on figorr/gardenpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for gardenpy_meteocat-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dec0024e314b967943ce50b34dfc640b90b8ad71d6b477ed8eb7cb29af2fd875
MD5 db16d2143d4168a47508cd9e346ae509
BLAKE2b-256 e606d4c968ac021397e7bc70cb8456e54faeaa3c0c110ecec57303a0624c95e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for gardenpy_meteocat-1.1.0-py3-none-any.whl:

Publisher: release.yml on figorr/gardenpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.2

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