Skip to main content

Time series processing

Project description

Python PyPI - Version GitHub License PyPI Downloads DOI

diive is currently under active developement with frequent updates.

Time series data processing

diive is a Python library for time series processing, in particular ecosystem data. Originally developed by the ETH Grassland Sciences group for Swiss FluxNet.

Recent updates: CHANGELOG
Recent releases: Releases

Overview of example notebooks

  • For many examples see notebooks here: Notebook overview
  • More notebooks are added constantly.

Current Features

Analyses

  • Daily correlation: calculate daily correlation between two time series (notebook example)
  • Decoupling: Investigate binned aggregates (median) of a variable z in binned classes of x and y (notebook example)
  • Data gaps identification: (notebook example)
  • Grid aggregator: calculate z-aggregates in bins (classes) of x and y (notebook example)
  • Histogram calculation: calculate histogram from Series (notebook example)
  • Optimum range: find x range for optimum y
  • Percentiles: Calculate percentiles 0-100 for series (notebook example)

Corrections

  • Offset correction for measurement: correct measurement by offset in comparison to replicate (notebook example)
  • Offset correction radiation: correct nighttime offset of radiation data and set nighttime to zero
  • Offset correction relative humidity: correct RH values > 100%
  • Offset correction wind direction: correct wind directions by offset, calculated based on reference time period (notebook example)
  • Set to threshold: set values above or below a threshold value to threshold value
  • Set exact values to missing: set exact values to missing records (notebook example)

Create variable

Functions to create various variables.

  • Time since: calculate time since last occurrence, e.g. since last precipitation (notebook example)
  • Daytime/nighttime flag: calculate daytime flag, nighttime flag and potential radiation from latitude and longitude (notebook example)
  • Vapor pressure deficit: calculate VPD from air temperature and RH (notebook example)
  • Calculate ET from LE: calculate evapotranspiration from latent heat flux (notebook example)
  • Calculate air temperature from sonic anemometer temperature (notebook example)

Eddy covariance high-resolution

  • Flux detection limit: calculate flux detection limit from high-resolution data (20 Hz)
  • Maximum covariance: find maximum covariance between turbulent wind and scalar
  • Turbulence: wind rotation to calculate turbulent departures of wind components and scalar (e.g. CO2)

Files

Input/output functions.

  • Detect files: detect expected and unexpected (irregular) files in a list of files
  • Split files: split multiple files into smaller parts and export them as (compressed) CSV files
  • Read single data files: read file using parameters (notebook example)
  • Read single data files: read file using pre-defined filetypes (notebook example)
  • Read multiple data files: read files using pre-defined filetype (notebook example)

Fits

Flux

Function specifically for eddy covariance flux data.

  • Flux processing chain (notebook example)
    • The notebook example shows the application of:
      • Post-processing of eddy covariance flux data.
      • Level-2 quality flags
      • Level-3.1 storage correction
      • Level-3.2 outlier removal
      • Level-3.3: USTAR filtering using constant thresholds
      • Level-4.1: gap-filling using long-term random forest and/or MDS
      • For info about the Swiss FluxNet flux levels, see here.
  • Quick flux processing chain (notebook example)
  • Flux detection limit: calculate flux detection limit from high-resolution eddy covariance data (notebook example)
  • Self-heating correction for open-path IRGA NEE fluxes:
    • create scaling factors table and apply to correct open-path NEE fluxes during a time period of parallel measurements (notebook example)
    • apply previously created scaling factors table to long-term open-path NEE flux data, outside the time period of parallel measurements (notebook example)
  • USTAR threshold scenarios: display data availability under different USTAR threshold scenarios

Formats

Format data to specific formats.

Gap-filling

Fill gaps in time series with various methods.

Outlier Detection

Multiple tests combined

  • Step-wise outlier detection: combine multiple outlier flags to one single overall flag

Single tests

Create single outlier flags where 0=OK and 2=outlier.

  • Absolute limits: define absolute limits (notebook example)
  • Absolute limits daytime/nighttime: define absolute limits separately for daytime and nighttime data (notebook example)
  • Hampel filter daytime/nighttime, separately for daytime and nighttime data (notebook example)
  • Local standard deviation: Identify outliers based on the local standard deviation from a running median (notebook example)
  • Local outlier factor: Identify outliers based on local outlier factor, across all data (notebook example)
  • Local outlier factor daytime/nighttime: Identify outliers based on local outlier factor, daytime nighttime separately (notebook example)
  • Manual removal: Remove time periods (from-to) or single records from time series (notebook example)
  • Missing values: Simply creates a flag that indicated available and missing data in a time series (notebook example)
  • Trimming: Remove values below threshold and remove an equal amount of records from high end of data (notebook example)
  • z-score: Identify outliers based on the z-score across all time series data (notebook example)
  • z-score increments daytime/nighttime: Identify outliers based on the z-score of double increments (notebook example)
  • z-score daytime/nighttime: Identify outliers based on the z-score, separately for daytime and nighttime (notebook example)
  • z-score rolling: Identify outliers based on the rolling z-score (notebook example)

Plotting

  • Cumulatives across all years for multiple variables (notebook example)
  • Cumulatives per year (notebook example)
  • Diel cycle per month (notebook example)
  • Heatmap date/time: showing values (z) of time series as date (y) vs time ( x) (notebook example)
  • Heatmap year/month: plot monthly ranks across years (notebook example)
  • Histogram: includes options to show z-score limits and to highlight the peak distribution bin (notebook example)
  • Long-term anomalies: calculate and plot long-term anomaly for a variable, per year, compared to a reference period. (notebook example)
  • Ridgeline plot: looks a bit like a landscape (notebook example)
  • Time series plot: Simple (interactive) time series plot (notebook example)
  • ScatterXY plot (notebook example)
  • Various classes to generate heatmaps, bar plots, time series plots and scatter plots, among others

Quality control

Resampling

Stats

Timestamps

  • Continuous timestamp: create continuous timestamp based on number of records in the file and the file duration
  • Time resolution: detect time resolution from data (notebook example)
  • Timestamps: create and insert additional timestamps in various formats
  • Vectorize timestamps: add date attributes as columns to dataframe, including sine/cosine variants fpr cyclical variables (e.g., day of year) (notebook example)

Installation

diive is currently under active developement using Python v3.11.

Using pip

pip install diive

Using poetry

poetry add diive

From source

Directly use .tar.gz file of the desired version.

pip install https://github.com/holukas/diive/archive/refs/tags/v0.76.2.tar.gz

Create and use a conda environment for diive

One way to install and use diive with a specific Python version on a local machine:

  • Install miniconda
  • Start miniconda prompt
  • Create a environment named diive-env that contains Python 3.11: conda create --name diive-env python=3.11
  • Activate the new environment: conda activate diive-env
  • Install diive using pip: pip install diive
  • To start JupyterLab type jupyter lab in the prompt

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

diive-0.90.0.tar.gz (19.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diive-0.90.0-py3-none-any.whl (20.0 MB view details)

Uploaded Python 3

File details

Details for the file diive-0.90.0.tar.gz.

File metadata

  • Download URL: diive-0.90.0.tar.gz
  • Upload date:
  • Size: 19.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Windows/10

File hashes

Hashes for diive-0.90.0.tar.gz
Algorithm Hash digest
SHA256 aa3c54811bf8f0b58d5c75f64cb5fa12d086cd6fbb34aa5e679163b080330259
MD5 3e886fadc759a8b8365a7a7463eb8cb7
BLAKE2b-256 f04594eef8a65185892c3257d770430d96f98d7d83e5b123d4bb4a2830c47284

See more details on using hashes here.

File details

Details for the file diive-0.90.0-py3-none-any.whl.

File metadata

  • Download URL: diive-0.90.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Windows/10

File hashes

Hashes for diive-0.90.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8112cebece1f404259a346ff04d6948c6728e131603916e418b6e3a8fbf390a6
MD5 3a710764c000cc6e53429b180eb25f31
BLAKE2b-256 00658671324e5516d14b22ffb565b70372c1b324586fe8b4713d43591fa2875b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page