Skip to content
Snippets Groups Projects
Commit 57bebe0e authored by Nicolas Martin's avatar Nicolas Martin
Browse files

comments some climate.utils functions

parent 3346d5fb
No related branches found
No related tags found
No related merge requests found
......@@ -149,22 +149,39 @@ calculate.temperatureDiurnalPattern <- function(timeoftheday, tmin, tmax, tminPr
return(temp)
}
# Calculate diurnal pattern of relative humidity from temperature
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
# Calculate diurnal pattern of relative humidity following temperature diurnal pattern
#' @param temperature a numeric value providing the target temperature at which we should compute target rh
#' @param rhmin a numeric value indicating the minimum relative humidity of the day in (%)
#' @param rhmax a numeric value indicating the maximum relative humidity of the day in (%)
#' @param tmin a numeric value indicating the minimum daily temperature (°C)
#' @param tmax a numeric value indicating the maximum daily temperature (°C)
#' @return
#' @export
#' @examples
calculate.rhDiurnalPattern <- function(temperature, rhmin, rhmax, tmin, tmax) {
rh <- rhmax + ((temperature - tmin) / (tmax - tmin)) * (rhmin - rhmax)
return(rh)
}
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
# Calculate global radiation (MJ) from photosynthetic photon flux density (umol/m2/s)
#' @param PPFD a numeric value providing the target temperature at which we should compute target rh
#' @param J_to_mol a numeric value indicating the minimum relative humidity of the day in (%)
#' @param frac_PAR a numeric value indicating the maximum relative humidity of the day in (%)
#' @return
#' @export
#' @examples
PPFD_umol.to.Rg_Watt <- function (PPFD, J_to_mol = 4.6, frac_PAR = 0.5) {
Rg <- PPFD/frac_PAR/J_to_mol
return(Rg)
}
#' converts radiation from W.m-2 to umol/m-2/s-1 .
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
#' converts global radiation from W.m-2 into PPFD (umol/m-2/s-1)
#'
#' @param Rg Global radiation (W/m2)
#' @param J_to_mol Conversion factor
......@@ -182,6 +199,16 @@ Rg_Watt.to.PPFD_umol <- function (Rg, J_to_mol = 4.6, frac_PAR = 0.5) {
# Convert instantaneous radiation in watt to dialy cumulative radiation in MJ (MJ.day-1)
#'
#' @param Rg Global radiation (W/m2)
#' @param J_to_mol Conversion factor
#' @param frac_PAR Fanction of solar rdiation that is photosynthetically active radiation (PAR)
#'
#' @return
#'Photosynthetic photon flux density (umol.m-2.s-1)
#' @export
#'
#' @examples
Rg_Watt.to.Rg_MJday <- function(Rg)
{
return(RgMJ = Rg*0.0864)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment