【发布时间】:2015-09-07 11:49:16
【问题描述】:
我正在尝试根据 Hargreaves Samani 方法使用 this package 从气候数据中计算蒸散量
我正在处理的 csv 格式的数据是可用的 here,我正在使用的代码(使用 cmets)在下面
## Using Evapotranspiration package to get DAILY PE ###
require(Evapotranspiration)
require(zoo)
#load the constants required from the Evapotranspiration package
data("constants")
#converting the CSV to a zoo object
OakPark<- read.csv("OakParkR.csv", header=TRUE)
#Fill the blanks in the csv with NAs
na.fill(OakPark,NA)
#convert to a zoo
OakPark <- as.zoo(OakPark)
#create a zoo series with the required variables
PE.data <- OakPark[ ,c(3,5)]
#converting to a list as ET function works on a list
PE.data <- as.list(PE.data)
#change constants to the local values
constants$Elev = 62
constants$lat_rad = 0.9226
#defining the function
funname <- "HargreavesSamani"
class(PE.data) <- funname
#creating a new variable with the calculation
results <- ET(PE.data,constants)
然后错误显示为:
Error: length(time(x)) == length(by[[1]]) is not TRUE
我查看了其他帮助部分,例如 this,但不知道如何实现它以使其在这个内置的 HargreavesSamani 函数上工作。
【问题讨论】: