1 Introdução

Nesta etapa descreve-se o uso de dois métodos distintos para determinação do limiar de velocidade de fricção (Ustar) abaixo do qual a fraca turbulência afeta o NEE noturno medido por sistemas de Covariância de Vórtices turbulentos.

2 Pré-configuração: pacotes e scripts necessários

Carregando os pacotes necessários.

# data manipulation packages
pcks <- c("plyr", "dplyr","lubridate","stringr",
          "openair","psych","REddyProc","ggplot2","scales",
          "lattice", "latticeExtra", "tidyr", "magrittr", 
          "dygraphs", "xts", "scales", "REddyProc", "boot")
invisible(sapply(pcks, require, character.only = TRUE, quietly = TRUE))

Carregando scripts.

source("R/to_oa.R") # convert to a open air object
source("R/ustar_filter_adpted.R")
source("R/qc_hh_quantile.R")
source("R/regularize.R")

2.1 Carregando dados

Vamos carregar os dados salvos na etapa anterior (2_QCgapsSurveyNeeHH.html) no formato binário do R.

# loading night nee flux data pre-processed
nee_qc <- tbl_df(readRDS(file = "output/nee_hh_r_qc_flags_pdg.rds"))
glimpse(nee_qc)
Observations: 87312
Variables:
$ date        (time) 2009-07-08 00:30:00, 2009-07-08 01:00:00, 2009-07...
$ NEE         (dbl) 2.1149520, 4.3855706, 2.1149520, 2.4004219, 1.7394...
$ PAR         (dbl) 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0...
$ Rg          (dbl) 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.000...
$ Tair        (dbl) 17.370, 16.943, 16.870, 16.700, 16.653, 16.537, 16...
$ VPD         (dbl) 4.226812, 3.807304, 3.812228, 3.677811, 3.718069, ...
$ Ustar       (dbl) 0.580, 0.645, 0.618, 0.533, 0.520, 0.504, 0.498, 0...
$ lai         (dbl) 1.5226, 1.5226, 1.5226, 1.5226, 1.5226, 1.5226, 1....
$ swctop      (dbl) 13.6185, 13.6185, 13.6185, 13.6185, 13.6185, 13.61...
$ swc1m       (dbl) 46.76525, 46.76525, 46.76525, 46.76525, 46.76525, ...
$ swc2m       (dbl) 123.2052, 123.2052, 123.2052, 123.2052, 123.2052, ...
$ PotRad      (dbl) 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.000...
$ daytime     (chr) "night", "night", "night", "night", "night", "nigh...
$ qc_NEE_fr   (dbl) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
$ qc_PAR_fr   (dbl) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
$ qc_Rg_fr    (dbl) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
$ qc_Ustar_fr (dbl) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
range(nee_qc$date)
[1] "2009-07-08 00:30:00 GMT" "2014-07-01 00:00:00 GMT"

3 Preparação de dados do PdG para o REddyProc

Preparação do data frame de dados de 30 min com NEE e variáveis ambientais do PdG.

Vamos substituir dados suspeitos, indicados pelas flags de controle de qualidade de cada variável por NA, o que se aplica as variáveis: NEE, PAR, Rg e Ustar. As colunas qc_*, PotRad e daytime podem ser removidas.

# data frame com coluna de data usando rótulo de tempo em POSIX 
EddyDataWithPosix.F <- as.data.frame(nee_qc)
EddyDataWithPosix.F %<>% mutate(NEE = ifelse(qc_NEE_fr == 0, NEE, NA_real_),
                                PAR = ifelse(qc_PAR_fr == 0, PAR, NA_real_),
                                Rg  = ifelse(qc_Rg_fr == 0, Rg, NA_real_),
                                Ustar = ifelse(qc_Ustar_fr == 0, Ustar, NA_real_),
                                PotRad = NULL,
                                #daytime = NULL,
                                qc_NEE_fr = NULL, 
                                qc_PAR_fr = NULL, 
                                qc_Rg_fr = NULL, 
                                qc_Ustar_fr = NULL)
head(EddyDataWithPosix.F)
date NEE PAR Rg Tair VPD Ustar lai swctop swc1m swc2m daytime
2009-07-08 00:30:00 2.114952 0 0 17.370 4.226812 0.580 1.5226 13.6185 46.76525 123.2052 night
2009-07-08 01:00:00 4.385571 0 0 16.943 3.807304 0.645 1.5226 13.6185 46.76525 123.2052 night
2009-07-08 01:30:00 2.114952 0 0 16.870 3.812228 0.618 1.5226 13.6185 46.76525 123.2052 night
2009-07-08 02:00:00 2.400422 0 0 16.700 3.677811 0.533 1.5226 13.6185 46.76525 123.2052 night
2009-07-08 02:30:00 1.739456 0 0 16.653 3.718069 0.520 1.5226 13.6185 46.76525 123.2052 night
2009-07-08 03:00:00 3.132409 0 0 16.537 3.641602 0.504 1.5226 13.6185 46.76525 123.2052 night

Estatísticas básicas das variáveis e gráfico.

# estatísticas dos dados, sem considerar flags de qc
psych::describe(select(EddyDataWithPosix.F, -date, -daytime))
vars n mean sd median trimmed mad min max range skew kurtosis se
NEE 1 58187 -2.1075027 7.1580657 0.220000 -1.4543769 5.0065814 -31.58200 27.27300 58.85500 -0.8112517 0.6755528 0.0296745
PAR 2 81413 437.9976924 610.8571388 13.194000 327.0462140 19.5614244 0.00000 2492.00000 2492.00000 1.1981053 0.1714340 2.1408822
Rg 3 84082 208.9672052 293.6863846 11.502800 154.8392936 17.0540513 0.00000 1200.00000 1200.00000 1.2299800 0.2514598 1.0128201
Tair 4 87312 22.2916178 4.5789018 21.963333 22.2912475 4.5861760 4.65600 36.62000 31.96400 -0.0208639 -0.1598319 0.0154962
VPD 5 87310 9.8378713 8.0520464 7.636694 8.7720903 7.5360695 0.00000 47.31202 47.31202 1.1246080 0.9681884 0.0272505
Ustar 6 75386 0.3910156 0.2012705 0.379000 0.3816079 0.2238726 0.01100 1.08500 1.07400 0.3758308 -0.4649413 0.0007331
lai 7 87312 1.9201504 0.5217363 1.967500 1.9254368 0.6444862 0.85610 2.84610 1.99000 -0.1143645 -1.1578249 0.0017657
swctop 8 87312 20.2757078 8.2265971 19.666500 19.5296985 8.4686112 9.49200 50.22150 40.72950 0.6406895 0.0091742 0.0278409
swc1m 9 87312 79.6958384 32.0459486 76.601000 77.0582249 40.4594127 41.13200 205.89970 164.76770 0.4994239 -0.6980380 0.1084516
swc2m 10 87312 159.1047252 56.2353969 154.375700 154.6138716 70.6426283 88.23734 339.67380 251.43646 0.5025040 -0.5989501 0.1903149
# gráfico das séries
plot_data <- EddyDataWithPosix.F %>% select(-daytime)
timePlot(plot_data, names(plot_data)[-1])

3.1 Velocidade de fricção (Ustar)

Vamos verificar a distribuição de Ustar pelo histograma e frequência acumulada para os períodos diurnos e noturnos.

# histograma diurno e noturno do Ustar
ggplot(EddyDataWithPosix.F, 
       aes(Ustar, fill = daytime)) + 
  geom_histogram(position = "dodge") + 
  labs(x = expression(Ustar ~~ (m~s^-1)), y = "Frequência de ocorrência") +
  scale_y_continuous(expand = c(0.01, 0.01), 
                     breaks = pretty_breaks(10)) +
  scale_x_continuous(expand = c(0.01, 0.01), 
                     breaks = pretty_breaks(10)) +
  theme_bw(base_size = 16)

# frequencia acumulada do Ustar diurno e noturno
ggplot(EddyDataWithPosix.F, 
       aes(Ustar, colour = daytime)) + 
  stat_ecdf(size = 2) + 
  labs(x = expression(Ustar ~~ (m~s^-1)), y = "Frequência acumulada") +
  scale_y_continuous(expand = c(0.01, 0.01), 
                     breaks = pretty_breaks(10)) +
  scale_x_continuous(expand = c(0.01, 0.01), 
                     breaks = pretty_breaks(10)) +
  theme_bw(base_size = 16)

Se usarmos um Ustarcrit = 0.2 \(ms^{-1}\) acarretará uma perda de aproximadamente 30% (10%) dos dados noturnos (diurnos). Quando aumenta-se o Ustarcrit para 0.25

## contagem de dados abaixo de Ustar = 0.2
EddyDataWithPosix.F %>%  
  filter(daytime == "night") %>% 
  select(Ustar) %$%
  table(Ustar < 0.2) %>% 
  prop.table() * 100
FALSE TRUE
69.39869 30.60131
## contagem de dados abaixo de Ustar = 0.25
EddyDataWithPosix.F %>%  
  filter(daytime == "night") %>% 
  select(Ustar) %$%
  table(Ustar < 0.25) %>% 
  prop.table() * 100
FALSE TRUE
59.19472 40.80528

3.1.1 Relação entre o NEE noturno com Ustar

Gráfico de dispersão entre as médias de 30 min de NEE e Ustar à noite para todo período de dados. A curva representa um regressão polinomial localmente ponderada (lowess) para suavização da relação entre as duas variáveis.

scatterPlot(EddyDataWithPosix.F %>% filter(daytime == "night"), 
            x = "Ustar", 
            y = "NEE", 
            smooth = TRUE,
            ref.y = list(h = 0, lty = 2)
            #ylim = c(-10, 20)
            )

Gráfico de dispersão entre as médias noturnas de NEE e Ustar à noite para todo período de dados.

scatterPlot(EddyDataWithPosix.F %>% 
              filter(daytime == "night"), 
            avg.time = "day",
            data.thresh = 25,
            x = "Ustar", 
            y = "NEE", 
            smooth = TRUE,
            ref.y = list(h = 0, lty = 2)
            #ylim = c(-10, 20)
            )

Gráfico de dispersão entre as médias de 30 min de NEE e Ustar à noite para cada ano.

scatterPlot(EddyDataWithPosix.F %>% 
              filter(daytime == "night"), 
            x = "Ustar", 
            y = "NEE", 
            ref.y = list(h = 0, lty = 2),
            type = "year",
            smooth = TRUE)

Gráfico de dispersão entre as médias de 30 min de NEE e Ustar à noite para cada estação do ano.

scatterPlot(EddyDataWithPosix.F %>% 
              filter(daytime == "night"), 
            x = "Ustar", 
            y = "NEE", 
            ref.y = list(h = 0, lty = 2),
            type = "season",
            smooth = TRUE,
            hemisphere = "southern", layout = c(4,1))

Gráfico de dispersão entre as médias de 30 min de NEE e Ustar à noite para os meses do ano.

scatterPlot(EddyDataWithPosix.F %>% filter(daytime == "night"), 
            x = "Ustar", 
            y = "NEE", 
            ref.y = list(h = 0, lty = 2),
            type = "month",
            smooth = TRUE,
            hemisphere = "southern",
            layout = c(12,1))

Gráfico de dispersão entre as médias de 30 min de NEE e Ustar à noite para cada hora.

scatterPlot(EddyDataWithPosix.F %>% 
              filter(daytime == "night"), 
            x = "Ustar", 
            y = "NEE", 
            type = "hour",
            ref.y = list(h = 0, lty = 2),
            smooth = TRUE)

3.1.2 Ciclos diurnos médios de Ustar.

Ciclos diurnos médios de Ustar médio de 30 min.

tv_months <- timeVariation(EddyDataWithPosix.F,
                           "Ustar", 
                           ref.y = list(h = 0, lty = 2),
                           type = "month")
tv_years <- timeVariation(EddyDataWithPosix.F,
                         "Ustar", 
                         ref.y = list(h = 0, lty = 2),
                         type = "year")

Ciclos diurnos médios de Ustar médio de 30 min por mês e por ano.

update(tv_months$plot$hour, layout = c(12,1))

update(tv_years$plot$hour, layout = c(6,1))

3.1.3 Ciclos diurnos médios de NEE

Ciclos diurnos médios de NEE médio de 30 min.

tv_months <- timeVariation(EddyDataWithPosix.F,
                           "NEE", 
                           ref.y = list(h = 0, lty = 2),
                           type = "month")
tv_years <- timeVariation(EddyDataWithPosix.F,
                         "NEE", 
                         ref.y = list(h = 0, lty = 2),
                         type = "year")
# ciclo diurno de NEE e Ustar em escala y comparável
tv2 <- timeVariation(EddyDataWithPosix.F %>% mutate(NEE = NEE/40),
                         c("NEE", "Ustar"), 
                         #normalise = TRUE,
                         ref.y = list(h = 0, lty = 2),
                         type = "month")

Ciclos diurnos médios de NEE por mês.

update(tv_months$plot$hour, layout = c(12,1))

Ciclos diurnos médios de NEE por ano.

update(tv_years$plot$hour, layout = c(6,1))

Para visualizar melhor a relação entre os ciclos diurnos de NEE e Ustar a escala do NEE foi dividida por 40 para que a amplitude de variação do ciclo diurno fique comparável a do Ustar.

update(tv2$plot$hour, layout = c(12,1))

3.1.4 Sazonalidade

Média mensais de NEE, Ustar, Tair e VPD.

# série noturna que exclui a única meia-hora de julho de 2014
s <- EddyDataWithPosix.F %>% 
           filter(daytime == "night") %>%
           selectByDate(start = format(min(EddyDataWithPosix.F$date), "%d/%m/%Y"),
                        end = format(max(EddyDataWithPosix.F$date) - 3600, "%d/%m/%Y"))
# série normalizada por x-mediana/ desvio padrão mediano
s_norm <- s %>% transmute(date = date, 
                          NEE = (NEE - median(NEE, na.rm = TRUE))/mad(NEE,na.rm = TRUE),
                          Tair = (Tair - median(Tair, na.rm = TRUE))/mad(Tair, na.rm = TRUE), 
                          VPD = (VPD-median(VPD, na.rm = TRUE))/mad(VPD, na.rm = TRUE),
                          Ustar = (Ustar-median(Ustar, na.rm = TRUE))/mad(Ustar, na.rm = TRUE))
# plot das variáveis
timePlot(s,
         pollutant = c("NEE", "Ustar", "Tair", "VPD"),
         avg.time = "month",
         lwd = 3,
         lty = 1)

Médias mensais de NEE, Ustar, Tair e VPD normalizadas.

## séries mensais normalizadas de NEE e Ustar
# Função para normalizar séries pelo máximo mínimo
norm_mx_min <- function(d){
  data.frame(date = d$date, 
             apply(d[, -1], 
                   2, 
                   function(x) {
                     (x - max(x, na.rm = TRUE))/
                     (max(x, na.rm = TRUE) - min(x, na.rm = TRUE))
                   }))
}# end fun
timePlot(norm_mx_min(d = s_norm), 
         #names(nnee_p)[-1], 
         c("NEE", "Ustar"),
         ylab = "variables", 
         date.format = "%b\n%Y",
         date.breaks = 16, 
         date.pad = TRUE,
         #key.columns = 3,
         plot.type = "l",
         avg.time = "month",
         lwd = 4, 
         group = TRUE,
         normalise = "mean",
         ylim = c(0.7, 1.3),
         lty = 1)

## séries mensais normalizadas de NEE e Tair
timePlot(norm_mx_min(d = s_norm), 
         #names(nnee_p)[-1], 
         c("NEE", "Tair"),
         ylab = "variables", 
         date.format = "%b\n%Y",
         date.breaks = 16, 
         date.pad = TRUE,
         #key.columns = 3,
         plot.type = "l",
         avg.time = "month",
         lwd = 4, 
         group = TRUE, 
         normalise = "mean",
         lty = 1)

## séries mensais normalizadas de NEE e VPD
timePlot(norm_mx_min(d = s_norm), 
         #names(nnee_p)[-1], 
         c("NEE", "VPD"),
         ylab = "variables", 
         date.format = "%b\n%Y",
         date.breaks = 16, 
         date.pad = TRUE,
         #key.columns = 3,
         plot.type = "l",
         avg.time = "month",
         lwd = 4, 
         group = TRUE, 
         normalise = "mean",
         lty = 1,
         ylim = c(0.7, 1.3))

3.2 Filtro Ustar

3.2.1 Teste de ponto móvel (MPT)

O MPT é um método iterativo para determinação do valor do filtro Ustar (Gu, Falge, Boden, Baldocchi, et al. (2005)). O método considera uma relação conceitual entre NEE noturno e Ustar. Nesse modelo NEE é independente de Ustar em um intervalo de variação intermediário Ustar, mas aumenta com Ustar em ambos extremos inferior e superior de Ustar. O objetivo é determinar os valores de Ustar onde a faixa intermediária inicia e termina. No trecho abaixo da faixa intermediária há subestimativa dos fluxos e no trecho superior (alto Ustar), as medida estão sujeitas a efeitos de ‘bombeamento de pressão’ (potential pressure pumping).

3.2.1.1 Por períodos sazonais

Nos gráficos da relação entre NEE e Ustar mostrado anteriormente, no verão, fica evidente o aumento da respiração do ecossistema com aumento do Ustar até ~0,3 m/s. Vamos aplicar o MPT para cada período sazonal, começando pelo verão.

3.2.1.1.1 Verão
#timePlot(EddyDataWithPosix.F, "Ustar")
trimestre <- c(1,2,12)
ustar_filter_gu_summer <- ustar.filter(dat = EddyDataWithPosix.F %>%
                                      selectByDate(month = trimestre), 
                                frac.mw    = 0.05,  # Relative window size for t-test
                                min.nmw    = 25,    # Min window size
                                max.nmw    = Inf,   # Max window size
                                #,pval.ustar = 0.05  # p-value to reject null hypothesis
                                pval.ustar = 0.10,  # p-value to reject null hypothesis
                                quant.unst = 0.20,  # Minimum fraction of valid nighttime nee
                                toler      = 0.005, # Tolerance for convergence test
                                up.limit   = FALSE, # Filter the upper limit
                                verbose    = TRUE) # Print additional information)
[1] "   + Flagging night time data..."
[1] "   + Counting number of nights..."
[1] "   + Flagging valid data..."
[1] "   + Outer loop..."
[1] "     - Iteration: 1:"
[1] "       * Selecting data..."
[1] "       * Fitting a temperature line..."
[1] "       * Linear fit non-significant! Normalising data..."
[1] "       * Discarding outliers..."
[1] "       * Inner loop, iteration 1:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 5554 Window size = 277..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 2.00..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.15..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 2:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 3987 Window size = 199..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.21..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.19..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 3:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 3423 Window size = 171..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.19..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.23..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 4:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 2884 Window size = 144..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.00..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.23..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = TRUE..."
[1] "       * Check convergence of the outer loop..."
[1] "         > Error (low)  = 2.00..."
[1] "         > Error (high) = 0.00..."
[1] "         > New low  u*  = 0.23..."
[1] "         > New high u*  = Inf..."
[1] "         > Converged    = FALSE..."
[1] "     - Iteration: 2:"
[1] "       * Selecting data..."
[1] "       * Fitting a temperature line..."
[1] "       * Linear fit non-significant! Normalising data..."
[1] "       * Discarding outliers..."
[1] "       * Inner loop, iteration 1:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 5586 Window size = 279..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 2.00..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.16..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 2:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 3966 Window size = 198..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.19..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.19..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 3:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 3438 Window size = 171..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.01..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.19..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 4:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 3407 Window size = 170..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.01..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.20..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 5:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 3393 Window size = 169..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.16..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.23..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = FALSE..."
[1] "       * Inner loop, iteration 6:"
[1] "         > Discarding too stable nights..."
[1] "         > Sample size = 2912 Window size = 145..."
[1] "         > Ranking data by u*..."
[1] "         > Finding the filter for low end..."
[1] "         > Checking convergence..."
[1] "           . Error (low)  = 0.00..."
[1] "           . Error (high) = 0.00..."
[1] "           . New low  u*  = 0.23..."
[1] "           . New high u*  = Inf..."
[1] "           . Converged    = TRUE..."
[1] "       * Check convergence of the outer loop..."
[1] "         > Error (low)  = 0.00..."
[1] "         > Error (high) = 0.00..."
[1] "         > New low  u*  = 0.23..."
[1] "         > New high u*  = Inf..."
[1] "         > Converged    = TRUE..."
[1] " + U* filter will retain 72.4 of data..."
ustar_filter_gu_summer
[1] 0.23  Inf
# gráfico com Ustar filtrado e NEE
scatterPlot(EddyDataWithPosix.F %>%
              selectByDate(month =trimestre) %>%
              filter(daytime == "night"),
            x = "Ustar", 
            y = "NEE", 
            ref.y = list(h = 0, lty = 2),
            ref.x = list(v = ustar_filter_gu_summer[1], 
                         lty = 2, 
                         lwd = 2 , 
                         col = 4),
            smooth = TRUE, 
            pch = 20)

# % de dados retidos
#ndat <- select(EddyDataWithPosix.F, NEE, Ustar, Tair, daytime) %>% 
#  complete.cases() %>% 
#  sum()
nretain_summer <- EddyDataWithPosix.F %>%
                    selectByDate(month = trimestre) %>% 
                    select(NEE, Ustar, Tair, daytime) %>% 
                    filter(., complete.cases(.)) %$% 
                    table(Ustar >= ustar_filter_gu_summer[1] & 
                            Ustar <= ustar_filter_gu_summer[2]) %>% 
                    prop.table() %>% `*`(100)
nretain_summer <- c(t(nretain_summer[names(nretain_summer) == "TRUE"]))
nretain_summer
[1] 72.37057
3.2.1.1.2 Bootstrapping Verão

Dados de todos verões.

#timePlot(EddyDataWithPosix.F, "Ustar")
trimestre <- c(1,2,12)
dat_seas <- EddyDataWithPosix.F %>%
            selectByDate(month = trimestre)
str(dat_seas)
'data.frame':   21648 obs. of  12 variables:
 $ date   : POSIXct, format: "2009-12-01 00:00:00" "2009-12-01 00:30:00" ...
 $ NEE    : num  NA NA NA NA NA NA NA NA NA NA ...
 $ PAR    : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Rg     : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Tair   : num  20.2 20.2 20.2 20.3 20.3 ...
 $ VPD    : num  1.44 1.46 1.49 1.56 1.5 ...
 $ Ustar  : num  0.379 0.267 0.251 0.344 0.309 0.33 0.401 0.363 0.405 0.285 ...
 $ lai    : num  2.07 2.07 2.07 2.07 2.07 ...
 $ swctop : num  40.7 28.4 28.4 28.4 28.4 ...
 $ swc1m  : num  166 148 148 148 148 ...
 $ swc2m  : num  340 320 320 320 320 ...
 $ daytime: chr  "night" "night" "night" "night" ...
3.2.1.1.3 Primavera
trimestre <- 9:11
ustar_filter_gu_spring <- ustar.filter(dat = EddyDataWithPosix.F %>%
                                      selectByDate(month = trimestre), 
                                frac.mw    = 0.05,  # Relative window size for t-test
                                min.nmw    = 25,    # Min window size
                                max.nmw    = Inf,   # Max window size
                                #,pval.ustar = 0.05  # p-value to reject null hypothesis
                                pval.ustar = 0.10,  # p-value to reject null hypothesis
                                quant.unst = 0.20,  # Minimum fraction of valid nighttime nee
                                toler      = 0.005, # Tolerance for convergence test
                                up.limit   = FALSE, # Filter the upper limit
                                verbose    = FALSE) # Print additional information)
#" + U* filter will retain 67.8 of data..."
ustar_filter_gu_spring
[1] 0.319   Inf
# gráfico com Ustar filtrado e NEE
scatterPlot(EddyDataWithPosix.F %>%
              selectByDate(month = trimestre) %>%
              filter(daytime == "night"),
            x = "Ustar", 
            y = "NEE", 
            ref.y = list(h = 0, lty = 2),
            ref.x = list(v = ustar_filter_gu_spring[1], 
                         lty = 2, 
                         lwd = 2 , 
                         col = 4),
            smooth = TRUE, 
            pch = 20)

# % de dados retidos
#ndat <- select(EddyDataWithPosix.F, NEE, Ustar, Tair, daytime) %>% 
#  complete.cases() %>% 
#  sum()
nretain_spring <- EddyDataWithPosix.F %>%
                    selectByDate(month = trimestre) %>% 
                    select(NEE, Ustar, Tair, daytime) %>% 
                    filter(., complete.cases(.)) %$% 
                    table(Ustar >= ustar_filter_gu_spring[1] & 
                            Ustar <= ustar_filter_gu_spring[2]) %>% 
                    prop.table() %>% `*`(100)
nretain_spring <- c(t(nretain_spring[names(nretain_spring) == "TRUE"]))
nretain_spring
[1] 67.7695
3.2.1.1.4 Outono
trimestre <- 3:5
ustar_filter_gu_aut <- ustar.filter(dat = EddyDataWithPosix.F %>%
                                      selectByDate(month = trimestre), 
                                frac.mw    = 0.05,  # Relative window size for t-test
                                min.nmw    = 25,    # Min window size
                                max.nmw    = Inf,   # Max window size
                                #,pval.ustar = 0.05  # p-value to reject null hypothesis
                                pval.ustar = 0.10,  # p-value to reject null hypothesis
                                quant.unst = 0.20,  # Minimum fraction of valid nighttime nee
                                toler      = 0.005, # Tolerance for convergence test
                                up.limit   = FALSE, # Filter the upper limit
                                verbose    = FALSE) # Print additional information)
ustar_filter_gu_aut
[1] 0.271   Inf
# gráfico com Ustar filtrado e NEE
scatterPlot(EddyDataWithPosix.F %>%
              selectByDate(month = trimestre) %>%
              filter(daytime == "night"),
            x = "Ustar", 
            y = "NEE", 
            ref.y = list(h = 0, lty = 2),
            ref.x = list(v = ustar_filter_gu_aut[1], 
                         lty = 2, 
                         lwd = 2 , 
                         col = 4),
            smooth = TRUE, 
            pch = 20)

# % de dados retidos
nretain_aut <- EddyDataWithPosix.F %>%
                 selectByDate(month = trimestre) %>% 
                 select(NEE, Ustar, Tair, daytime) %>% 
                 filter(., complete.cases(.)) %$% 
                 table(Ustar >= ustar_filter_gu_aut[1] & 
                         Ustar <= ustar_filter_gu_aut[2]) %>% 
                 prop.table() %>% `*`(100)
nretain_aut <- c(t(nretain_aut[names(nretain_aut) == "TRUE"]))
nretain_aut
[1] 63.35102
3.2.1.1.5 Inverno
trimestre <- 6:8
ustar_filter_gu_inv <- ustar.filter(dat = EddyDataWithPosix.F %>%
                                      selectByDate(month = trimestre), 
                                frac.mw    = 0.05,  # Relative window size for t-test
                                min.nmw    = 25,    # Min window size
                                max.nmw    = Inf,   # Max window size
                                #,pval.ustar = 0.05  # p-value to reject null hypothesis
                                pval.ustar = 0.10,  # p-value to reject null hypothesis
                                quant.unst = 0.20,  # Minimum fraction of valid nighttime nee
                                toler      = 0.005, # Tolerance for convergence test
                                up.limit   = FALSE, # Filter the upper limit
                                verbose    = FALSE) # Print additional information)
ustar_filter_gu_inv
[1] 0.523   Inf
# gráfico com Ustar filtrado e NEE
scatterPlot(EddyDataWithPosix.F %>%
              selectByDate(month = trimestre) %>%
              filter(daytime == "night"),
            x = "Ustar", 
            y = "NEE", 
            ref.y = list(h = 0, lty = 2),
            ref.x = list(v = ustar_filter_gu_inv[1], 
                         lty = 2, 
                         lwd = 2 , 
                         col = 4),
            smooth = TRUE, 
            pch = 20)

# % de dados retidos
nretain_inv <- EddyDataWithPosix.F %>%
                selectByDate(month = trimestre) %>% 
                select(NEE, Ustar, Tair, daytime) %>% 
                filter(., complete.cases(.)) %$% 
                table(Ustar >= ustar_filter_gu_inv[1] & 
                        Ustar <= ustar_filter_gu_inv[2]) %>% 
                prop.table() %>% `*`(100) 
nretain_inv <- c(t(nretain_inv[names(nretain_inv) == "TRUE"]))
nretain_inv
[1] 31.63863
3.2.1.1.6 Tabela de limiares sazonais de Ustar
Período Ustar (m/s) % dados retidos
Verão 0.23 72
Primavera 0.32 68
inverno 0.52 32
outono 0.27 63

3.2.2 Método de Papale, Reichstein, Aubinet, Canfora, et al. (2006)

Inicialização da classe sEddyProc e aplicação do filtro Ustar.

EddyProc.C <- sEddyProc$new(ID.s = "PdG", 
                            Data.F = EddyDataWithPosix.F, 
                            ColNames.V.s = c('NEE','PAR','Tair','VPD', 'Ustar', 'Rg'), 
                            ColPOSIXTime.s = "date")
result <- EddyProc.C$sEstUstarThresholdDistribution(nSample = 100)

Os resultados do valor do filtro Ustar para cada ano são indicados abaixo, onde 1 é a estimativa agregada e os valores dos quantis de 5, 50 e 95% de Ustar também são mostrados.

result
$res
             1        5%       50%       95%
2009        NA        NA        NA        NA
2010 0.4918889 0.3769444 0.4974444 0.5781200
2011 0.6636364 0.5419500 0.6391667 0.7294833
2012 0.5684000 0.3351300 0.4584500 0.6275591
2013 0.4127778 0.3019968 0.4024889 0.5142867
2014 0.3770000 0.2637314 0.3218000 0.4663971

$Ustar_l

ORDINARY NONPARAMETRIC BOOTSTRAP


Call:
boot(data = ds, statistic = .self$sEstUstarThresholdYears, R = nSample, 
    seasonFactor.v = seasonFactor.v, yearFactor.v = yearFactor.v, 
    ctrlUstarEst.l = ctrlUstarEst.l, ctrlUstarSub.l = ctrlUstarSub.l)


Bootstrap Statistics :
     original       bias    std. error
t2* 0.4918889  0.008869137  0.05738463
t3* 0.6636364 -0.027151727  0.05823691
t4* 0.5684000 -0.093951111  0.09052054
t5* 0.4127778 -0.001325723  0.07484227
t6* 0.3770000 -0.039266667  0.06611078
WARNING: All values of t1* are NA

Os resultados de Ustar por período sazonal por periodo sazonal, i.e. 1 (DJF), 2 (MAM) ,3 (JJA) e 4 (SON), e as 7 classes de temperatura.

Result.L <- EddyProc.C$sEstUstarThreshold()
Result.L
$UstarAggr
[1] 0.65

$UstarSeasonTemp
      
season         1         2         3         4         5         6
     1 0.3022778 0.3130185 0.5809630 0.1409630 0.3412037 0.1903333
     2 0.7213390 0.7527119 0.6850678 0.6500000 0.6233898 0.5858136
     3 0.2550278 0.2369444 0.2541389 0.3677222 0.6497778 0.5795278
     4 0.2239211 0.2829737 0.2335789 0.6041316 0.3808947 0.3288158
      
season         7
     1 0.3415000
     2 0.5008814
     3 0.4809722
     4 0.3868421
# como se determina UstarAggr 
# (máximo das medianas das classes de temperaturas entre as estações do ano 
max(apply(Result.L$UstarSeasonTemp, 1, median))
[1] 0.65

3.3 Partição do NEE

3.3.1 Estimativa baseada nos dados noturnos

3.3.2 Estimativa baseada nos dados diurnos

4 Referências

[1] E. Falge, D. Baldocchi, R. Olson, P. Anthoni, et al. “Gap filling strategies for defensible annual sums of net ecosystem exchange”. In: Agricultural and Forest Meteorology 107.1 (Mar. 2001), pp. 43–69. DOI: 10.1016/s0168-1923(00)00225-2. URL: http://dx.doi.org/10.1016/S0168-1923(00)00225-2.

[2] L. Gu, E. M. Falge, T. Boden, D. D. Baldocchi, et al. “Objective threshold determination for nighttime eddy flux filtering”. In: Agricultural and Forest Meteorology 128.3-4 (2005), pp. 179–197. DOI: 10.1016/j.agrformet.2004.11.006. URL: http://dx.doi.org/10.1016/j.agrformet.2004.11.006.

[3] M. Reichstein, E. Falge, D. Baldocchi, D. Papale, et al. “On the separation of net ecosystem exchange into assimilation and ecosystem respiration: review and improved algorithm”. In: Global Change Biology 11.9 (2005), pp. 1424–1439. DOI: 10.1111/j.1365-2486.2005.001002.x. URL: http://dx.doi.org/10.1111/j.1365-2486.2005.001002.x.

[4] M. Reichstein and A. M. Moffat. REddyProc: Data processing and plotting utilities of (half-)hourly eddy-covariance measurements. R package version 0.6-0/r9. 2014. URL: http://R-Forge.R-project.org/projects/reddyproc/.