Skip to content

Local variables assigned to but never used in compute.ETP.PM, compute.ETP.PT and compute.VPDfromRHandT functions

Hi Nico;

I just want to highlight that there are some local variables assigned but never used in the functions.

In the compute.VPDfromRHandT function

compute.VPDfromRHandT <- function(relative_humidity, temperature, air_pressure = 101325) {
  # Constants
  Mas <- 28.966    # molar weight dry air (g/mol)
  Mh2o <- 18       # molar weight H20 H2O(g/mol)
  Rgz <- 8.314472  # pPerfect gaz constant %J/mol/K

  Tk <- temperature + 273.15 # conversion of temperature in K
  Dair <- ((air_pressure) / (Rgz * (Tk))) * Mas
  es <- 6.108 * exp(17.27 * temperature / (237.2 + temperature)) * 100
  ea <- relative_humidity * es / 100
  vpd <- (es - ea) / 1000
  vpd[vpd < 0] <- 0
  return(vpd)
}

Mh2o and Dair are assigned to but never used

In the compute.ETP.PT function:

compute.ETP.PT <- function(Tmoy, NetRadiation, PTcoeff = 1.26, G = 0) {

  SBconstant <- 4.903 * 10^9 # Stefan-Boltzman constant [MJ.K^-4.m^-2.day^-1]
  gamma <- 0.0666 # Psychometer constant
  lambda <- 2.45 # Latent heat of vaporisation

  #  s: slope of the saturation vapour pressure function (AO 1998)
  s <- 4098 * 0.6108 * exp((17.27 * Tmoy) / (Tmoy + 237.3)) / ((Tmoy + 237.3)^2)

  ETP <- PTcoeff * (s / (s + gamma)) * ((NetRadiation - G) / lambda)

  return(ETP)
}

SBconstant is assigned to but never used

And finally, in the compute.ETP.PM function

compute.ETP.PM <- function(Tmoy, NetRadiation,u,vpd,G=0)

{
  SBconstant <- 4.903 * 10^9 # Stefan-Boltzman constant [MJ.K^-4.m^-2.day^-1]
  gamma <- 0.0666 # Psychometer constant
  lambda <- 2.45 # Latent heat of vaporisation
  
  #  s: slope of the saturation vapour pressure function (AO 1998)
  delta = 4098 * 0.6108 * exp((17.27 * Tmoy) / (Tmoy + 237.3)) / ((Tmoy + 237.3)^2)
  
  ga = 0.34*max(u,0.001)
  
  u2=u*(4.87/log(67.8*10-5.42))
  u2
  N1 = 0.408*delta*NetRadiation
  N2 = gamma*(37/(Tmoy+273))*u2*vpd
  D = delta+gamma*(1+0.34*u2)
  E = (N1+ N2)/(D)
  
  
  return(E)
}

SBconstant ga and lambda are assigned to but never used

Pura Vida;

Erick

Edited by Erick Calderon-Morales