Metadata


Environmental predictors

  • Absolute minimum temperature (\(T_{min}\)):
    • Pearson et al.: Theoretical absolute minimum temperature over a period of 20 years (\(T_{min}\)). It is computed using the mean temperature of the coldest month (\(T_c\)) in any year such as \(T_{min} = 0.006T_c^2 + 1.316 T_c - 21.9\).
    • Our computation: We used the temperature of the coldest day (mean temperature) of the year \(T_c\). Later we applied the equation provided by Pearson et al.
    • Speed:
      • min_tas: (mean) annual minimum of daily mean temperature. It seems that this:
        1. computes the daily mean temperature
        2. computes the minimum daily mean temperature for each year
        3. computes the average of the annual minimum daily mean temperature.
      • min_tasmin: (mean) annual minimum of daily minimum temperature.
        1. computes the daily minimum temperature depending on the temporal resolution (hourly, each two hours, etc.).
        2. computes the minimum daily minimum temperature for each year. This would be the minimum temperature observed on each year, depending on the temporal resolution (hourly, each two hours, etc.).
        3. computes the average of the annual minimum daily mean temperature.
    • Notes: The advantage of using mean temperature of the coldest month is that this is more robust to presence of outliers, while using the absolute minimum observed temperature in 20 years might be very sensible to outliers, or random error.
  • Maximum annual temperature (\(T_{max}\)):
    • Pearson et al.: Maximum temperature of the warmest month.
    • Our computation: We used the temperature of the hotest day (mean temperature) of the year as maximum annual temperature \((T_{max})\).
    • Speed:
      • min_tas: (mean) annual temperature of the warmest month. It seems that this:
        1. computes the monthly mean temperature
        2. computes the maximum monthly mean temperature for each year
        3. computes the average of the annual maximum monthly mean temperature.
    • Notes: Should it be in the same scale on minimum annual temperature (daily or monthly) and maybe the opposite of maximum annual temperature.
  • Growing degree days:
    • Pearson et al.: Index for energy available for completion of annual life cycle computed as \(GDD = \sum \text{max}\{0, (T_m - T_t)\}\). Where \(T_m\) is a quasi-daily temperature approximation from monthly temperature data and \(T_t\) is the threshold minimum temperature for growth (5 C for Europe). This is simply the sum of the quasi-daily temperatures that exceed \(T_t\).
    • Our computation: Annual sum of daily temperatures that exceed \(T_t\) (5 C).
    • Speed:
      • gdd: I imagine is the same as our computation.
  • Monthly potential evapotranspiration:
    • Pearson et al.: Uses total monthly potential evapotranspiration for the computation of soil moisture deficit and surplus.
    • Our computation: We compute total monthly potential evapotranspiration as the sum of the daily potential evapotranspiration per month.
    • Speed:
      • pet: (20 year mean) of the monthly mean potential evapotranspiration for a well-watered grass surface?
      • peti: (20 year mean) of the monthly mean potential evapotranspiration with correction for intercepted water on rain days?
    • Note: If it is the monthly mean, it is not complicated to convert to total by multiplying by the number of days of the month.
  • Monthly precipitation:
    • Pearson et al.: Uses total precipitation for the computation of soil moisture deficit and surplus.
    • Our computation: We compute total monthly precipitation as the sum of the daily (mean?) precipitation per month and multiplied by \(3600 * 24\) to convert (minutes to days?).
    • Speed:
      • pr: (20 year mean) of the monthly mean precipitation?
    • Note: If we know the temporal resolution (minute, hour, day) it would be easy to compute the total monthly precipitation.
  • Soil moisture surplus (SMS) and deficit (SMD):
    • Pearson et al.: Balance between precipitation (\(ppt\)), potential evapotranspiration (\(pet\)) and soil’s AWC.
      1. Monthly available water (\(aw\)) = \(ppt\) - \(pet\)
      2. Monthly soil water reserve (\(rs\))
      3. In firt month:
        • If \(aw > 0\)
          • \(rs = \text{min}(aw, AWC)\).
          • \(\text{surplus} = max(0, aw - AWC)\)
        • If \(aw < 0\)
          • \(rs = max(rs + aw, 0)\)
          • \(\text{deficit} = aw\)
      4. Same rules for succesive months.
      5. Acummulated surplus and deficit is calculated.
    • Our computation: Seems a bit different from this concept. See below, both functions provided the same results.
      1. Monthly available water (\(aw\)) = \(ppt\) - \(pet\)
      2. Monthly soil water reserve (\(rs\))
      3. In firt month:
        • \(rs = rs + ppt - pet\)
        • If \(rs > AWC\)
          • \(\text{surplus} = rs - AWC\)
          • \(rs = AWC\)
        • If \(rs < 0\)
          • \(\text{deficit} = rs\)
          • \(rs = 0\)
      4. Same rules for succesive months.
      5. Acummulated surplus and deficit is calculated.
# receive raster objects
soil_moisture_raster <- function(awc, pre, pet) {

    # initialise water content
    W <- pre
    W[] <- 0
    for (i in 2:12) {
        aux <- W[[i - 1]] + pre[[i]] - pet[[i]]
        W[[i]][] <- aux[]
        W[[i]][W[[i]] < 0] <- 0
        pos <- which(W[[i]][] > awc[])
        W[[i]][pos] <- awc[pos]
    }
    W[[1]] <- W[[12]]

    # compute sms and smd using Rob's code
    deficit <- W[[1]]
    deficit[!is.na(deficit)] <- 0
    smd <- sms <- surplus <- deficit
    for(i in 2:12){
        aux <- W[[i - 1]] + pre[[i]] - pet[[i]]
        W[[i]][] <- aux[]
        posdeficit <- which(W[[i]][] < 0)
        deficit[posdeficit] <- W[[i]][posdeficit]
        W[[i]][posdeficit] <- 0
        possurplus <- which(W[[i]][] > awc[])
        surplus[possurplus] <- W[[i]][possurplus] - awc[possurplus]
        W[[i]][possurplus] <- awc[possurplus]
        smd <- smd + deficit
        sms <- sms + surplus
    }
    return(list(smd = smd, sms = sms))
}

# receive array objects
soil_moisture <- function(awc, pre, pet) {

    # initialise water content
    W <- array(0, dim(pre))
    for (i in 2:12) {
        aux <- W[, , i - 1] + pre[, , i] - pet[, , i]
        W[, , i] <- pmax(aux, 0)
        W[, , i] <- pmin(W[, , i], awc)
    }
    W[, , 1] <- W[, , 12]

    # compute sms and smd using Rob's code
    deficit <-  W[, , 1] * 0
    smd <- sms <- surplus <- deficit
    for(i in 2:12){
        W[, , i] <- W[, , i - 1] + pre[, , i] - pet[, , i]
        posdeficit <- which(W[, , i] < 0)
        deficit[posdeficit] <- W[, , i][posdeficit]
        W[, , i][posdeficit] <- 0
        possurplus <- which(W[, , i] > awc)
        surplus[possurplus] <- W[, , i][possurplus] - awc[possurplus]
        W[, , i][possurplus] <- awc[possurplus]
        smd <- smd + deficit
        sms <- sms + surplus
    }
    return(list(smd = smd, sms = sms))
}

# receive array objects
soil_moisture_fix <- function(awc, pre, pet) {

    W <- array(0, dim(pre))
    smd <- sms <- W[, , 1] * 0
    for(i in 1:12){
        surplus <- deficit <- W[, , 1] * 0
        if (i == 1) {
            W[, , i] <- pre[, , i] - pet[, , i]
        } else {
            W[, , i] <- W[, , i - 1] + pre[, , i] - pet[, , i]
        }
        posdeficit <- which(W[, , i] < 0)
        deficit[posdeficit] <- W[, , i][posdeficit]
        W[, , i][posdeficit] <- 0
        possurplus <- which(W[, , i] > awc)
        surplus[possurplus] <- W[, , i][possurplus] - awc[possurplus]
        W[, , i][possurplus] <- awc[possurplus]
        smd <- smd + deficit
        sms <- sms + surplus
    }
    return(list(smd = smd, sms = sms))
}


# receive array objects
soil_moisture_pearson <- function(awc, pre, pet) {

    aw <- pre - pet
    smd <- sms <- rs <- aw[, , 1] * 0

    for (i in 1:12) {
        surplus <- deficit <- rs * 0

        pos_surplus <- which(aw[, , i] > 0)
        rs[pos_surplus] <- pmin(aw[, , i], awc)[pos_surplus]
        surplus[pos_surplus] <- pmax(aw[, , i] - awc, 0)[pos_surplus]
        sms <- sms + surplus

        pos_deficit <- which(aw[, , i] < 0)
        rs[pos_deficit] <- pmax(rs + aw[, , i], 0)[pos_deficit]
        deficit[pos_deficit] <- aw[, , i][pos_deficit]
        smd <- smd + deficit
    }

    return(list(smd = smd, sms = sms))
}