SWEETPO is a crop growth model that simulates dry mass assimilation in different sweet potato (Ipomea batatas) varieties. The model simulates daily dry matter increments in storage roots and total biomass under potential crop growth conditions.
The goal of this survey is to analyse ……….
The Pre-processing section show the procedure used to prepare the data for analysis. The steps of the procedure include:
The outputs of the survey are made up of three plots:
The weather data used in this survey can be downloaded from here: http://inrm.cip.cgiar.org/home/sweetpo/climate.prn
Download weather file
fileurl<-"http://inrm.cip.cgiar.org/home/sweetpo/climate.prn";
targetfile<-paste(getwd(),"/climate.prn",sep="")
download.file(fileurl,targetfile) # use this function for windows users
#download.file(fileurl,targetfile, method="curl") # use this function for Mac Os X users
Load weather dataset
climate <- read.table("climate.prn", header = TRUE)
show structure of weather dataset
str(climate)
## 'data.frame': 365 obs. of 5 variables:
## $ Fecha: int 1 2 3 4 5 6 7 8 9 10 ...
## $ Tmax : num 23.9 25.4 23 22.7 24 ...
## $ Tmin : num 22.9 24.4 22.1 21.9 23.1 ...
## $ Prec : num 0 0.17 0.52 0.02 0 0 0 0 0.03 0 ...
## $ Rad : num 25.2 25.3 16.4 16.9 25.6 ...
show the first six records of weather dataset
head(climate)
## Fecha Tmax Tmin Prec Rad
## 1 1 23.88 22.94 0.00 25.23
## 2 2 25.44 24.38 0.17 25.28
## 3 3 22.98 22.07 0.52 16.43
## 4 4 22.70 21.92 0.02 16.95
## 5 5 23.98 23.06 0.00 25.61
## 6 6 24.37 23.34 0.00 25.45
Set crop parameters
- N : Plant density (1/m2)
- fcl : Maximum ground cover
- F0 : Initial light interception capacity per plant (MJ/m2)
- R0 : Initial relative growth rate (1/(°C*d))
- M : Maximum tuberization index (0-1)% (%)
- A : Thermal time at max root growth rate (inflection pt) (oCd)
- b : Slope harvest index
- DMCont : Dry matter content (%)
- LUE : Average light use efficiency (g/MJ)
- EDay : Emergence day (day)
- v : Dry matter variability
- t0 : Base temperature for sweetpotato growth (°C)
N <- 3.33;
fcl <- 0.6275;
F0 <- 0.0082;
R0 <- 0.00898;
M <- 0.48;
A <- 624;
b <- -9.45;
DMCont <- 0.4405;
LUE <- 2.531;
EDay <- 5;
v <- 0.075;
t0 <- 12;
Select a subset of fields from weather dataset
- MinTemp : Minimum temperature (oC)
- MaxTemp : Maximum temperature (oC)
- Precipit : Precipitation (mm)
- Radiation : Radiation (MJ/m2)
MinTemp<-as.numeric(climate$Tmin)
MaxTemp<-as.numeric(climate$Tmax)
Precipit<-as.numeric(climate$Prec)
Radiation<-as.numeric(climate$Rad)
Set time conditions
- totaldays : Total days of simulation
- mm : Month simulation starts
- dd : Day simulation starts
- numrep : Number of runs
totaldays<-130;
mm<-5;
dd<-7;
numrep<-20;
SDate<-switch(mm, dd+0, dd+31,dd+59,dd+90,dd+120)
dWtot_mat<-matrix(0.0,totaldays,numrep)
dWtb_mat<-matrix(0.0,totaldays,numrep)
dWtbf_mat<-matrix(0.0,totaldays,numrep)
dFlinti_mat<-matrix(0.0,totaldays,numrep)
for(irep in 1:numrep)
{
t_ac<-0.001
dWtot<-0.0
day<-switch(mm, dd+0, dd+31,dd+59,dd+90,dd+120,dd+151,dd+181,dd+212,dd+243,dd+273,dd+304,dd+334)
rnd=runif(1)
rdm = (log((1+rnd)/(1-rnd)))/1.82 ## log: natural logarithm
for(i in 1:totaldays)
{
SDay<-i
Flinti <- (fcl*N*F0*exp(R0*t_ac))/(N*F0*exp(R0*t_ac)+1-N*F0)
HI <- M/(1.0+((t_ac/A)^b))
dWtb <- dWtot*HI;
dWtbf <- dWtb/DMCont;
if(SDay>=EDay){DAE<-SDay-EDay}else{DAE<-0}
Flint1 <- rdm*v*Flinti+Flinti
Tmax <- MaxTemp[day]
Tmin <- MinTemp[day]
PAR <- Radiation[day]*0.5
Tx<-(Tmax+Tmin)/2.0
Tm <- 40.0 # Maximum Temperature (oC)
To <- 23.0 # Optimum temperature (oC)
dW<-(LUE*Flint1*PAR)/100.0
W <- if(Tx>=t0 & Tx<To) 1-(((Tx-To)/(To-t0))^2) else (if(Tx>=To & Tx<=Tm) -1*((Tx-Tm)/(Tm-To)) else 0.0 )
Te <- if(DAE<=0.0) 0.0 else (if(DAE>0.0 & Tx<t0) 0.0 else (if(Tx>=t0 & Tx<=Tm) (Tx-t0)*W else 0.0))
t_ac=t_ac+Te
dWtot=dWtot+dW
dWtot_mat[i,irep]=dWtot
dWtb_mat[i,irep]=dWtb
dWtbf_mat[i,irep]=dWtbf
dFlinti_mat[i,irep]=Flint1
}
}
average
XdWtot<-rowMeans(dWtot_mat)
XdWtb<-rowMeans(dWtb_mat)
XdWtbf<-rowMeans(dWtbf_mat)
XdFlinti<-rowMeans(dFlinti_mat)
sample standard deviation
SDdWtot<-apply(dWtot_mat,1,sd)
SDdWtb<-apply(dWtb_mat,1,sd)
SDdWtbf<-apply(dWtbf_mat,1,sd)
SDdFlinti<-apply(dFlinti_mat,1,sd)
confidence interval (95% confidence level)
LCI_dWtot<-XdWtot - qnorm(0.975)*(SDdWtot/numrep)
LCS_dWtot<-XdWtot + qnorm(0.975)*(SDdWtot/numrep)
LCI_dWtb<-XdWtb - qnorm(0.975)*(SDdWtb/numrep)
LCS_dWtb<-XdWtb + qnorm(0.975)*(SDdWtb/numrep)
LCI_dWtbf<-XdWtbf - qnorm(0.975)*(SDdWtbf/numrep)
LCS_dWtbf<-XdWtbf + qnorm(0.975)*(SDdWtbf/numrep)
LCI_dFlinti<-XdFlinti - qnorm(0.975)*(SDdFlinti/numrep)
LCS_dFlinti<-XdFlinti + qnorm(0.975)*(SDdFlinti/numrep)
The first figure depict the total dry matter production (tn/ha). we use a 95% confidence level for finding the confidence interval.
plot(XdWtot,type="l",main="Dry matter production",col="black",xlab="Days",ylab="tn/ha")
lines(LCI_dWtot,col="blue")
lines(LCS_dWtot,col="red")
plot(XdWtb,type="l",main="Root dry matter",col="black",xlab="Days",ylab="tn/ha")
lines(LCI_dWtb,col="blue")
lines(LCS_dWtb,col="red")
plot(XdWtbf,type="l",main="Root fresh matter",col="black",xlab="Days",ylab="tn/ha")
lines(LCI_dWtbf,col="blue")
lines(LCS_dWtbf,col="red")
plot(XdFlinti,type="l",main="Canopy cover",col="black",xlab="Days",ylab="tn/ha")
lines(LCI_dFlinti,col="blue")
lines(LCS_dFlinti,col="red")
…………. …………. ………….