ustarfilter

Filter Eddy Covariance data with friction velocity

This module was original written by Tino Rau and Matthias Cuntz, and maintained by Arndt Piayda while at Department of Computational Hydrosystems, Helmholtz Centre for Environmental Research - UFZ, Leipzig, Germany, and continued by Matthias Cuntz while at Institut National de Recherche pour l’Agriculture, l’Alimentation et l’Environnement (INRAE), Nancy, France.

copyright:

Copyright 2008-2022 Matthias Cuntz, see AUTHORS.rst for details.

license:

MIT License, see LICENSE for details.

The following functions are provided

ustarfilter(dfin[, flag, isday, date, ...])

Filter Eddy Covariance data with friction velocity

History
  • Written 2008 by Tino Rau and Matthias Cuntz - mc (at) macu (dot) de

  • Maintained by Arndt Piayda since Aug 2014.

  • Input can be pandas Dataframe or numpy array(s), Apr 2020, Matthias Cuntz

  • Using numpy docstring format, May 2020, Matthias Cuntz

  • No bootstrap by default, Jul 2020, Matthias Cuntz

  • Optionally return thresholds and flags for each season, Jul 2020, Matthias Cuntz

  • Bugfix if no threshold found, and for multi-year flags, Jul 2020, Matthias Cuntz

  • Improved flake8 and numpy docstring, Oct 2021, Matthias Cuntz

  • Use all ustar data for 90% quantile if no threshold found, instead of only ustar data when NEE and Ta are valid, Jan 2023, Matthias Cuntz

  • Use 90% of ustar if no threshold found also for seasonout, Jan 2023, Matthias Cuntz

  • Removed np.float and np.bool, Jun 2024, Matthias Cuntz

  • do not register pandas platting backend, Jun 2024, Matthias Cuntz

ustarfilter(dfin, flag=None, isday=None, date=None, timeformat='%Y-%m-%d %H:%M:%S', colhead=None, ustarmin=0.01, nboot=1, undef=-9999, plot=False, seasonout=False, nmon=3, ntaclasses=7, corrcheck=0.5, nustarclasses=20, plateaucrit=0.95, swthr=10.0)[source]

Filter Eddy Covariance data with friction velocity

Flag Eddy Covariance data using a threshold of friction velocity (ustar) below which ustar correlates with a reduction in CO2 flux. The algorithm follows the method presented in Papale et al. (Biogeosciences, 2006).

Parameters:
  • dfin (pandas.Dataframe or numpy.array) –

    time series of CO2 fluxes and friction velocity as well as air temperature. dfin can be a pandas.Dataframe with the columns

    ’FC’ or ‘NEE’ (or starting with FC_ or NEE_) for observed CO2 flux [umol(CO2) m-2 s-1]

    ’USTAR’ (or starting with ‘USTAR’) for friction velocity [m s-1]

    ’TA’ (or starting with TA_) for air temperature [deg C]

    The index is taken as date variable.

    dfin can also me a numpy array with the same columns. In this case colhead, date, and possibly dateformat must be given.

  • flag (pandas.Dataframe or numpy.array, optional) – Dataframe or array has the same shape as dfin. Non-zero values in flag will be treated as missing values in dfin. flag must follow the same rules as dfin if pandas.Dataframe. If flag is numpy array, df.columns.values will be used as column heads and the index of dfin will be copied to flag.

  • isday (array_like of bool, optional) – True when it is day, False when night. Must have the same length as dfin.shape[0]. If isday is not given, dfin must have a column with head ‘SW_IN’ or starting with ‘SW_IN’. isday will then be dfin[‘SW_IN’] > swthr.

  • date (array_like of string, optional) – 1D-array_like of calendar dates in format given in timeformat. date must be given if dfin is numpy array.

  • timeformat (str, optional) – Format of dates in date, if given (default: ‘%Y-%m-%d %H:%M:%S’). See strftime documentation of Python’s datetime module: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior

  • colhead (array_like of str, optional) – column names if dfin is numpy array. See dfin for mandatory column names.

  • ustarmin (float, optional) – minimum ustar threshold (default: 0.01). Papale et al. (Biogeosciences, 2006) take 0.1 for forest and 0.01 otherwise.

  • nboot (int, optional) – number of boot straps for estimate of confidence interval of ustar threshold (default: 1)

  • undef (float, optional) – values having undef value are treated as missing values in dfin (default: -9999)

  • plot (bool, optional) – True: data and ustar thresholds are plotted into ustarfilter.pdf (default: False)

  • seasonout (bool, optional) – True: return ustar thresholds for each season (default: False)

  • nmon (int, optional) – Number of months to combine for a season (default: 3).

  • ntaclasses (int, optional) – Number of temperature classes per nmon months (default: 7).

  • corrcheck (float, optional) – Skip temperature class if absolute of correlation coefficient between air temperature and ustar is greater equal corrcheck (default: 0.5).

  • nustarclasses (int, optional) – Number of ustar classes per temperature class (default: 20).

  • plateaucrit (float, optional) – The ustar threshold is the smallest ustar class that has an average CO2 flux, which is higher than plateaucrit times the mean CO2 flux of all ustar classes above this class (default: 0.95).

  • swthr (float, optional) – Threshold to determine daytime from incoming shortwave radiation if isday not given (default: 10).

Returns:

numpy array with 5, 50 and 95 percentiles of ustar thresholds,

flags: 0 everywhere except set to 2 where ustar < ustar-threshold. Either maximum threshold of all seasons or thresholds for each season, i.e. threshold array is array(3, nseason) if seasonout and array(3) otherwise.

Return type:

tuple of numpy arrays, pandas.Dataframe or numpy array

Notes

Works ONLY for a data set of at least one full year.