- ustarfilter : Filter Eddy Covariance data with friction velocity
- following Papale et al. (Biogeosciences, 2006).
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 (c) 2008-2020 Matthias Cuntz - mc (at) macu (dot) de Released under the MIT License; see LICENSE file for details.
- 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
The following functions are provided
||Flag Eddy Covariance data using a threshold of friction velocity (u*) below which u* correlates with a reduction in CO2 flux.|
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)¶
Flag Eddy Covariance data using a threshold of friction velocity (u*) below which u* correlates with a reduction in CO2 flux. The algorithm follows the method presented in Papale et al. (Biogeosciences, 2006).
- 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) –
flag 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.
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 ant 0.01 otherwise.
- nboot (int, optional) – number of boot straps for estimate of confidence interval of u* 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 u* thresholds are plotted into ustarfilter.pdf (default: False)
- seasonout (bool, optional) – True: return u* thresholds for each season (default: False)
- nmon (int, optional) – Number of month 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 u* classes per temperature class (default: 20).
- plateaucrit (float, optional) – The u* threshold is the smallest u* class that has an average CO2 flux, which is higher than plateaucrit times the mean CO2 flux of all u* classes above this class (default: 0.95).
- swthr (float, optional) – Threshold to determine daytime from incoming shortwave radiation if isday not given (default: 10).
numpy array with 5, 50 and 95 percentile of u* thresholds, flags: 0 everywhere except set to 2 where u* < u*-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.
tuple of numpy arrays, pandas.Dataframe or numpy array
Works ONLY for a data set of at least one full year.
- dfin (pandas.Dataframe or numpy.array) –