Skip to main content

Time series processing

Project description

Python PyPI - Version GitHub License

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)
  • Quantile aggregation: calculate z-aggregates in quantiles (classes) of x and y (notebook example)
  • Data gaps identification: (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

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)

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

  • Bin fitter

Flux

Specific analyses of eddy covariance flux data.

  • USTAR threshold scenarios: display data availability under different USTAR threshold scenarios

Flux processing chain

Post-processing of eddy covariance flux data. For info about the Swiss FluxNet flux levels, see here.

  • Flux processing chain (notebook example)
    • The notebook example shows the application of:
      • 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
  • Quick flux processing chain (notebook example)

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: based on Median Absolute Deviation (MAD) in a moving window (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: showing values (z) of time series as year (y) vs month (x) (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)
  • 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

Installation

diive is currently under active developement using Python 3.9.7, but newer (and many older) versions should also work.

Using pip

pip install diive

Using poetry

poetry add diive

Using conda

conda intall -c conda-forge 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.9.7: conda create --name diive-env python=3.9.7
  • Activate the new environment: conda activate diive-env
  • Install diive using pip: pip install diive
  • If you want to use diive in Jupyter notebooks, you can install Jupyterlab. In this example Jupyterlab is installed from the conda distribution channel conda-forge: conda install -c conda-forge jupyterlab
  • If used in Jupyter notebooks, diive can generate dynamic plots. This requires the installation of: conda install -c bokeh jupyter_bokeh

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.83.1.tar.gz (18.9 MB view details)

Uploaded Source

Built Distribution

diive-0.83.1-py3-none-any.whl (19.0 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: diive-0.83.1.tar.gz
  • Upload date:
  • Size: 18.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.19 Windows/10

File hashes

Hashes for diive-0.83.1.tar.gz
Algorithm Hash digest
SHA256 2f645c9b4b8e880af07fa73c92b5d960ae1fb5cb5f61621c4bf04464cec62109
MD5 6806559ad9b00cac9ab8762495b59485
BLAKE2b-256 f0997e00f07e55c67dc6bc9eea4d5466bb28febd1bc9e6d25f8e5a4f54eee4fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: diive-0.83.1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.19 Windows/10

File hashes

Hashes for diive-0.83.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb17dcec8964d9ab5bf274f7330a9b70f6a1d6f885a9e4fec4d87e44354373c7
MD5 12d38c57372ab0b461a7b1a1162e0b91
BLAKE2b-256 bc2c7b859e922b30015f56d4c10034312d76fdc32f8537171c5bedb5813367f3

See more details on using hashes here.

Supported by

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