ambient-rainfall
A small wrapper around the Ambient Weather API for pulling historical station data and calculating total rainfall over a date range.
Requirements
- Python >= 3.11
- An Ambient Weather account with an API key and application key (generate these at ambientweather.net/account)
Installation
Install with uv:
uv sync
or with pip, into a virtual environment:
pip install .
For development (editable install with test/lint tools):
uv sync --group dev
# or: pip install -e ".[dev]"
Create a .env file in the project root with your Ambient Weather credentials:
AMBIENT_API_KEY=your-api-key
AMBIENT_APPLICATION_KEY=your-application-key
Optionally set AMBIENT_RAINFALL_CACHE_DIR to control where the default-device
cache is stored (defaults to .cache in the project root).
Optionally set AMBIENT_HOUR to control the hour (0-23) used for the
start/end datetime defaults described below (defaults to 0).
Usage
Installing the package exposes a console script:
ambient-rainfall --start 2026-07-22T08:00:00 --end 2026-07-23T08:00:00
--start and --end accept ISO-formatted datetimes (e.g. 2026-07-22 or
2026-07-22T08:00:00). If omitted, --end defaults to today and --start
defaults to yesterday, both at the hour set by --hour (or the AMBIENT_HOUR
environment variable, or 0 if neither is set). If --start/--end are
given but omit a time component (e.g. 2026-07-22), that same hour is filled
in; an explicit time in the string (e.g. 2026-07-22T08:00:00) is always
kept as-is.
Each run prints the total rainfall for the requested range and writes a CSV
(rainfall_<start>_<end>.csv) with the hourly rainfall values used in the
calculation.
By default, the script uses the first weather station found on your account
(cached for 7 days). Pass a specific station with --device <mac-address>,
or the device argument when calling the library functions directly.
Library usage
from datetime import datetime
from ambient_rainfall.core import get_total_rainfall_for_date_range
rainfall = get_total_rainfall_for_date_range(
start_datetime=datetime(2026, 7, 22, 8),
end_datetime=datetime(2026, 7, 23, 8),
)
Metadata
Release files for ambient-rainfall 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ambient_rainfall-0.1.2.tar.gz | 8.3 kB | Without provenance | Details for ambient_rainfall-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ambient_rainfall-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for ambient_rainfall-0.1.2-py3-none-any.whl |
Total release size: 14.7 kB
Release files / ambient_rainfall-0.1.2.tar.gz
| Download URL | ambient_rainfall-0.1.2.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30379c2441669302f6a1b3a670799898fd55090883acef5ed4390b359e8f96b0
|
|
BLAKE2b-256 checksum How to use checksums |
4b71b6491904a64c2475e691bf61eaeb91e830a60db105cbdb078d385ef019d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ambient_rainfall-0.1.2-py3-none-any.whl
| Download URL | ambient_rainfall-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45f523a28c27c8469eb6452e1fc1baba842cc33ec99094144d284ccbea8cd727
|
|
BLAKE2b-256 checksum How to use checksums |
e05d230a2f835b84e482b86e1e2ac34ce247185cc625ddde0a60d22b0a270c72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for ambient-rainfall 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.