Skip to main content

The Zambretti Algorithm for weather forecasting

Project description

Zambretti Weather Forecasting in Python

This is a Python implementation of the Zambretti Weather Forecaster

The code is heavily based on the Zambretti Algorithm for Weather Forecasting ESP example

Further reading: Short-Range Local Forecasting with a Digital Barograph using an Algorithm based on the Zambretti Forecaster.

Usage

Example usage with mock values:

import datetime

from zambretti_py.zambretti import PressureData, WindDirection, Zambretti

now = datetime.datetime.now()
pressure_data = PressureData(
    [
        (now - datetime.timedelta(hours=2, minutes=59), 1050.0),
        (now - datetime.timedelta(hours=2, minutes=49), 1040.0),
        (now - datetime.timedelta(hours=2, minutes=39), 1030.0),
        (now - datetime.timedelta(hours=2, minutes=12), 1020.0),
        (now - datetime.timedelta(hours=1, minutes=19), 1010.0),
        (now - datetime.timedelta(minutes=20), 1000.0),
    ]
)
zambretti = Zambretti()

forecast = zambretti.forecast(
    pressure=1013.0,
    elevation=90,
    temperature=25,
    pressure_data=pressure_data,
    wind_direction=WindDirection.NORTH,
)
print(forecast)

To calculate for forecast, the Zambretti algorithm requires:

  • the current pressure in millibars or hPa (those are equivalent)
  • elevation above sea level
  • current temperature
  • pressure data from the last three hours, or less.
    • data points older than three hours will be removed
    • the pressure data is expected to be provided as a list of tuples, each tuple consisting of a datetime.datetime object, and the pressure as float
  • optional wind direction, denoting the direction from which the wind is flowing. This has a minor effect on the forecast and can be omitted.

The result will be a text description of the forecasted weather.

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

zambretti_py-0.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

zambretti_py-0.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file zambretti_py-0.0.1.tar.gz.

File metadata

  • Download URL: zambretti_py-0.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for zambretti_py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 00683a1fc68d68686b0f105ee36b5ef0422c0cd44101cb56a6c503ee38ff6361
MD5 ca6f9ab97872bc71708f517de5ca256c
BLAKE2b-256 f13a0522c0f651b97ffc85cc33e75070c7b55c5486ba0b2a3da4c57b42b17335

See more details on using hashes here.

File details

Details for the file zambretti_py-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for zambretti_py-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26a8c44d5aa948044ff0841a7bfb6b1363b489d774a28b931244a1c88e2b6c39
MD5 1d10c3c4284bfaa131dad0e4e5933ea1
BLAKE2b-256 dc328374b70c4edf42e336202d761ec33d4136aa709378ca95ba69a49f40b119

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