R/apcal.R

Defines functions apcal

Documented in apcal

apcal <-
  function(lat,days,rad_mea,extraT=NULL, DL=NULL, SSD) {
    i <- dayOfYear(days)
    
    if (is.null(extraT) | is.null(DL))
    {
      ex <- extrat(lat=radians(lat),i)
      DL <- ex$DayLength   #[hours]
      extraT <- ex$ExtraTerrestrialSolarRadiationDaily  # [MJ]
    }
    Y <- rad_mea/extraT      
    X <- SSD/DL
    m <- lm(Y ~ X)
    rval <- c(m$coefficients,summary(m)$r.squared)
    names(rval) <- c("APa","APb","APr2")
    rval
  }

Try the sirad package in your browser

Any scripts or data that you put into this service are public.

sirad documentation built on May 2, 2019, 4:41 p.m.