Skip to main content

ci docs pre-commit.ci status

meteo-qc

meteo_qc is a customizable framework for applying quality checks to meteorological data. The framework can be easily extended by registering custom functions/plugins.

Installation

To install meteo-qc, open an interactive shell and run

pip install meteo-qc

Getting started

Check out the Documentation for detailed information.

Apply the quality control to this csv data called test_data.csv:

date,temp,pressure_reduced
2022-01-01 10:00:00,1,600
2022-01-01 10:10:00,2,1024
2022-01-01 10:20:00,3,1024
2022-01-01 10:30:00,4,1090
2022-01-01 10:50:00,4,
2022-01-01 11:00:00,,1024
2022-01-01 11:10:00,2,1024
2022-01-01 11:20:00,3,1024
2022-01-01 11:30:00,4,1090
2022-01-01 11:40:00,4,1090
  1. Read in the data as a pd.DataFrame.
  2. Create a meteo_qc.ColumnMapping object and use the column names as keys to use the method add_group to add the column to the group (temperature or pressure). This can be an existing group or a new group.
  3. Call meteo_qc.apply_qc to apply the control to the DataFrame data using the column_mapping as a definition for the checks to be applied.
import pandas as pd
import meteo_qc

# read in the data
data = pd.read_csv('test_data.csv', index_col=0, parse_dates=True)

# map the columns to groups
column_mapping = meteo_qc.ColumnMapping()
column_mapping['temp'].add_group('temperature')
column_mapping['pressure_reduced'].add_group('pressure')

# apply the quality control
result = meteo_qc.apply_qc(df=data, column_mapping=column_mapping)
print(result)

This will result in this object which can be used to display the result in a nice way e.g. using an html template to render it.

{
    'columns': defaultdict(<function apply_qc.<locals>.<lambda> at 0x7f9b0edd5480>, {
        'temp': {
            'results': {
                'missing_timestamps': Result(
                    function='missing_timestamps',
                    passed=False,
                    msg='missing 1 timestamps (assumed frequency: 10min)',
                    data=None,
                ),
                'null_values': Result(
                    function='null_values',
                    passed=False,
                    msg='found 1 values that are null',
                    data=[[1641034800000, None, True]],
                ),
                'range_check': Result(
                    function='range_check',
                    passed=True,
                    msg=None,
                    data=None,
                ),
                'spike_dip_check': Result(
                    function='spike_dip_check',
                    passed=True,
                    msg=None,
                    data=None,
                ),
                'persistence_check': Result(
                    function='persistence_check',
                    passed=True,
                    msg=None,
                    data=None,
                )
            },
            'passed': False,
        },
        'pressure_reduced': {
            'results': {
                'missing_timestamps': Result(
                    function='missing_timestamps',
                    passed=False,
                    msg='missing 1 timestamps (assumed frequency: 10min)',
                    data=None,
                ),
                'null_values': Result(
                    function='null_values',
                    passed=False,
                    msg='found 1 values that are null',
                    data=[[1641034200000, None, True]],
                ),
                'range_check': Result(
                    function='range_check',
                    passed=False,
                    msg='out of allowed range of [860 - 1055]',
                    data=[[1641031200000, 600.0, True], [1641033000000, 1090.0, True], [1641036600000, 1090.0, True], [1641037200000, 1090.0, True]],
                ),
                'spike_dip_check': Result(
                    function='spike_dip_check',
                    passed=False,
                    msg='spikes or dips detected. Exceeded allowed delta of 0.3 / min',
                    data=[[1641031800000, 1024.0, True], [1641033000000, 1090.0, True], [1641034200000, None, True], [1641036600000, 1090.0, True]],
                ),
                'persistence_check': Result(
                    function='persistence_check',
                    passed=True,
                    msg=None,
                    data=None,
                )
            },
            'passed': False
        }
    }),
    'passed': False,
    'data_start_date': 1641031200000,
    'data_end_date': 1641037200000,
}

It is also possible to write and register your own functions if they are not already in the predefined Groups. Please check out the Docs for more information.

Metadata

Release files for meteo-qc 0.5.0

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

Source distribution (sdist)

Source distribution for meteo-qc 0.5.0
File Size Uploaded Provenance Actions
meteo_qc-0.5.0.tar.gz 11.3 kB Without provenance Details for meteo_qc-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meteo-qc 0.5.0
File Interpreter ABI Platform Actions
meteo_qc-0.5.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for meteo_qc-0.5.0-py2.py3-none-any.whl

Total release size: 23.6 kB

Release files / meteo_qc-0.5.0.tar.gz

Download URL meteo_qc-0.5.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aca58bb23dfecefd419b9b8c02f8e3da7a0cc8dfdc2cfee5f324a8db433673fc
BLAKE2b-256 checksum
How to use checksums
a1e68ec73010a31d746e97f25508178e6586c17b694d9fae8b2d34896857117d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Release files / meteo_qc-0.5.0-py2.py3-none-any.whl

Download URL meteo_qc-0.5.0-py2.py3-none-any.whl
Size 12.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3b96c23d6a6de130bad8d67fd790004f5533d23ba1a87180e69990209f77f797
BLAKE2b-256 checksum
How to use checksums
e176ffdc41c17b277d6e829c36f7151e2c7945de6c6e8d522caa13f91a7e61a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Security for meteo-qc 0.5.0

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.

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