Skip to main content
RainfallQC

RainfallQC - Quality control for rainfall data

https://img.shields.io/pypi/v/rainfallqc.svg Deploy docs https://zenodo.org/badge/917722737.svg

Provides methods for running rainfall quality control.

Features

  • 33 rainfall QC methods (25 from IntenseQC, 6 from SubHourlyQC and 2 from pyPWSQC)

  • polars DataFrame support for fast data processing

  • modular structure so you can pick and choose which checks to run

  • support for single rain gauges or networks of rain gauges

  • editable parameters so you can tweak thresholds, streak or accumulation lengths, and distances to neighbouring gauges

Installation

RainfallQC can be installed from PyPi:

pip install rainfallqc

Examples

Example 1. - Running individual checks on a single rain gauge

Let’s say you have data for a single rain gauge stored in “hourly_rain_gauge_data.csv” which looks like this:

Example data 1. Single rain gauge

time

rain_mm

2020-01-01 00:00

0.0

2020-01-01 01:00

0.1

2020-01-01 02:00

0.0

2020-01-01 03:00

105.0

2020-01-01 04:00

0.6

…

…

For the majority of the checks in RainfallQC, you can load in your data using polars and run the checks directly. Below, we run 2 example QC checks:

    1. check_intermittency - to flag years where there are periods of non-zero bounded by 0 (see Figure 1.),

    1. daily_accumulations - to flag accumulations of hourly values into daily.

https://thomasjkeel.github.io/UK-Rain-Gauge-Network/example_images/intermittency.png

Figure 1. Example of an intermittency issue within the rainfall record

import polars as pl
from rainfallqc import gauge_checks, timeseries_checks

data = pl.read_csv("hourly_rain_gauge_data.csv")

intermittent_years = gauge_checks.check_intermittency(data, target_gauge_col="rain_mm")

daily_accumulation_flags = timeseries_checks.check_daily_accumulations(
    data,
    target_gauge_col="rain_mm",
    gauge_lat=52.0,
    gauge_lon=2.0,
    smallest_measurable_rainfall_amount=0.1,
)

Please note that some checks may require additional metadata, such as gauge location (latitude and longitude) or smallest measurable rainfall amount (e.g. 0.1 mm). This could look like:

Example metadata 1. Rain gauge metadata

station_id

latitude

longitude

start_datetime

end_datetime

path

rain_mm_gauge_1

53.0

2.0

2020-01-01 00:00

2024-01-01 00:00

path/to/gauge_1.csv

rain_mm_gauge_2

54.1

-0.5

2018-01-01 00:00

2023-01-01 00:00

path/to/gauge_2.csv

rain_mm_gauge_3

56.9

1.9

2015-01-01 00:00

2025-01-01 00:00

path/to/gauge_3.csv

…

…

…

…

You could then run checks that require metadata i.e. the check_hourly_exceedance_etccdi_rx1day QC check which flags rainfall values exceeding the hourly day rainfall 1-day record at a given location (see Figure 2):

https://thomasjkeel.github.io/UK-Rain-Gauge-Network/example_images/rx1day_check.png

Figure 2. Example of an Rx1day check from the IntenseQC framework

The code for that check looks like:

import polars as pl
from rainfallqc import comparison_checks

data = pl.read_csv("hourly_rain_gauge_data_gauge_1.csv")
metadata = pl.read_csv("rain_gauge_metadata.csv")

target_gauge_id = "rain_mm_gauge_1"
target_metadata = metadata.filter(pl.col("station_id") == target_gauge_id)

rx1day_check = comparison_checks.check_hourly_exceedance_etccdi_rx1day(
     data,
     target_gauge_col=target_gauge_col,
     gauge_lat=target_metadata["latitude"],
     gauge_lon=target_metadata["longitude"]
)

Output flags will then look like:

Example flag outputs for the Rx1day QC check

time

rx1day_check

2020-01-01 00:00

0

2020-01-01 01:00

0

2020-01-01 02:00

0

2020-01-01 03:00

1

2020-01-01 04:00

0

…

…

Example 2. - Running multiple QC checks on a single target gauge

To run multiple QC checks, you can use the apply_qc_framework() method to run QC methods from a given framework (e.g. IntenseQC).

For more information about how to run multiple checks in a framework see Example 4 in the docs

Other examples

Of course, your data may not be tabular, or may not be stored in a single file. Therefore, please see our other Tutorials.

QC checks in RainfallQC

QC checks and appropriate time-resolution

Long name

Sub-module

QC Framework

<15-min

15-min

hourly

daily

monthly

Percentiles

Gauge checks

IntenseQC

✓

✓

✓

✓

✓

K-largest

Gauge checks

IntenseQC

✓

✓

✓

✓

✓

Days of week

Gauge checks

IntenseQC

✓

✓

✓

✓

☓

Hours of day

Gauge checks

IntenseQC

✓

✓

✓

☓

☓

Intermittency

Gauge checks

IntenseQC

✓

✓

✓

✓

✓

Breakpoints

Gauge checks

IntenseQC

✓

✓

✓

✓

☓

Minimum value change

Gauge checks

IntenseQC

✓

✓

✓

✓

✓

R99p

Comparison checks

IntenseQC

✓

✓

✓

✓

☓

PRCPTOT

Comparison checks

IntenseQC

✓

✓

✓

✓

☓

World Record

Comparison checks

IntenseQC

✓

✓

✓

✓

☓

Rx1day

Comparison checks

IntenseQC

✓

✓

✓

☓

☓

CDD (Dry spells)

Timeseries checks

IntenseQC

✓

✓

✓

✓

☓

Daily accumulations

Timeseries checks

IntenseQC

agg

agg

✓

✓

☓

Monthly accumulations

Timeseries checks

IntenseQC

✓

✓

✓

✓

☓

Streaks

Timeseries checks

IntenseQC

agg

agg

✓

✓

☓

Daily neighbours (wet)

Neighbourhood checks

IntenseQC

✓

✓

✓

✓

☓

Hourly neighbours (wet)

Neighbourhood checks

IntenseQC

✓

✓

✓

☓

☓

Daily neighbours (dry)

Neighbourhood checks

IntenseQC

✓

✓

✓

✓

☓

Hourly neighbours (dry)

Neighbourhood checks

IntenseQC

✓

✓

✓

☓

☓

Monthly neighbours

Neighbourhood checks

IntenseQC

agg

agg

agg

agg

✓

Timing offset

Neighbourhood checks

IntenseQC

✓

✓

✓

✓

☓

Pre-QC affinity index

Neighbourhood checks

IntenseQC

✓

✓

✓

✓

✓

Pre-QC pearson correlation

Neighbourhood checks

IntenseQC

✓

✓

✓

✓

✓

Daily factor

Neighbourhood checks

IntenseQC

agg

agg

agg

✓

☓

Monthly factor

Neighbourhood checks

IntenseQC

agg

agg

agg

agg

✓

Check exceedance of UK 1h record

Sub-hourly thresholds

SubHourlyQC

✓

✓

☓

☓

☓

Check exceedance of UK 24h record

Sub-hourly thresholds

SubHourlyQC

✓

✓

☓

☓

☓

Check 24h-sum exceedance of UK 24h record

Sub-hourly thresholds

SubHourlyQC

✓

✓

☓

☓

☓

Check streaks (20 mm min)

Sub-hourly thresholds

SubHourlyQC

✓

✓

☓

☓

☓

Check data has sub-hourly frequency

Sub-hourly thresholds

SubHourlyQC

✓

✓

☓

☓

☓

Check sub-hourly rainfall thresholds

Sub-hourly thresholds

SubHourlyQC

✓

✓

☓

☓

☓

Faulty Zeros

pyPWSQC filters

pyPWSQC

✓

✓

✓

✓

☓

Station Outliers

pyPWSQC filters

pyPWSQC

✓

✓

✓

☓

☓

Documentation and License

Note on time aggregation

Hourly data is aggregated with ‘label=right’, so 07:00:01 to 08:00 is labelled 08:00. For daily and monthly aggregation, label is left, so n-hour on D to n-hour on D+1 is D.

How to cite this package

To cite a specific version of RainfallQC, please see Zenodo DOI. For v1.1.0: https://doi.org/10.5281/zenodo.22083293

Credits

Metadata

Release files for rainfallqc 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rainfallqc 1.1.2
File Size Uploaded Provenance
rainfallqc-1.1.2.tar.gz 1.3 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rainfallqc 1.1.2
File Interpreter ABI Platform
rainfallqc-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 2.7 MB

Release files / rainfallqc-1.1.2.tar.gz

Download URL rainfallqc-1.1.2.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
f10ba84e61f0ec4bc516b14ecce6e6f3730933ee3cf3b411d1e679d1a9c312f1
BLAKE2b-256 checksum
How to use checksums
3028939648371487159ea88d58a6990f3932bed97f9ac2afeec031a49b8318e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / rainfallqc-1.1.2-py3-none-any.whl

Download URL rainfallqc-1.1.2-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7836f23a05a1e84ee4dde4b1eb83fe5612d69e4a81bdbf32415b6c1d95bf7cdc
BLAKE2b-256 checksum
How to use checksums
4d735855219a552a4ca2f59d961962c5670db4bfe0cee67813a7dda00928c372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for rainfallqc 1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rainfallqc-1.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files Full provenance

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