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.1

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.1
File Size Uploaded
rainfallqc-1.1.1.tar.gz 1.3 MB Details

Built distribution (wheel)

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

Total release size: 2.7 MB

Release files / rainfallqc-1.1.1.tar.gz

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

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 Sep 16, 2026.

Transparency log

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

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

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 Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release 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