One of the important tasks we use crop model for is characterization of environments (EC) for the major abiotic production constraints (“envirotyping”). This approach helps us to understand the stress dynamics, its effects on the plant production and defines how to quantify the frequencies of particular stress types. Detailed description of drought stress characterization of post-rainy sorghum production systems in India is described in Kholová et al 2013. In principle, we have to gather sensible daily weather records (Tmax, Tmin, rainfall, solar radiation) and soil profile characteristics (depth, water holding capacity, nutrient content) from the area of interest. Subsequently, the point simulations of particular genotype with the common management practices (fertilizers dosage, irrigation, sowing time) are conducted using the mechanistic crop model (e.g. APSIM, specific genotypic coefficients can be derived using the “parameterization protocol” above). For each simulated cropping season, the trajectory of the crop water status index through the crop cycle is outputted (in sorghum module of APSIM this is water supply/demand ratio which can be outputted directly; S/D). The average of water S/D every 100 degree day intervals is calculated and the cluster analysis is performed for series of these averages to identify the major drought patterns experienced by the crop. The frequency of particular stress types is further expressed in relation to total number of the evaluated seasons.

1. R code allowing clustering analysis of trajectories - ### R script for Principal Components and Plots ### Each sheet in the Excel file needs to be saved as a .csv file, extra heading rows and tables need to be removed.

#ABSvalues <- read.table("ABSvaluesWWFIN2.csv",header=T,sep=",")

ABSvalues <- read.table("westraj.csv",header=T,sep=",",dec='.')

head(ABSvalues)

ABSvalues <- na.omit(ABSvalues) #PCA does not like missing values

#For the PCA you need a matrix with only the trait values

#ABSvalues.mat <- ABSvalues[,10:21] #This means ALL rows (ie [,) and colums 10 - 21 (ie ,10:21)

ABSvalues.mat <- ABSvalues[,6:37] #This means ALL rows (ie [,) and colums 7 - 18 (ie ,10:21)

#dimnames(ABSvalues.mat)[[1]] <- ABSvalues$stg.shortcut.trt #puts the names in to be used as labels

dimnames(ABSvalues.mat)[[1]] <- ABSvalues$name.shortcut.trt #puts the names in to be used as labels

head(ABSvalues.mat)

#DW3 DW6 LDW6 DW9 LDW9 Dwfin LDWfin YIELD pT non.pT sen6 senAVRG

#D-1 2.92 41.41 23.10 94.87 36.15 274.92 37.47 130.44 0 0 22.22222 5.740741

#B:1A-1 2.23 29.71 17.92 111.87 43.40 342.50 36.37 160.10 0 1 50.00000 22.222222

#B:1A-2 1.74 38.72 22.54 114.80 49.15 311.82 32.03 147.44 0 1 60.00000 33.148148

#B:1A-4 2.43 40.10 25.24 119.30 51.64 342.99 38.00 138.59 0 3 67.77778 35.740741

#B:1A-5 3.21 37.20 19.08 147.89 42.71 330.81 33.16 195.50 0 1 65.55556 33.148148

#B:1A-6 2.25 29.56 18.09 136.12 47.27 316.43 34.93 105.13 0 1 58.88889 30.555556

#This bit is the PCA stuff

ABSvalues.pca <- princomp(ABSvalues[,c(6:37)])

POV<- ABSvalues.pca$sdev^2/sum(ABSvalues.pca$sdev^2)

summary(ABSvalues.pca)

loadings(ABSvalues.pca)

biplot(ABSvalues.pca,cex=0.75)

#Plots of scores on their own

#colnum <- as.numeric(ABSvalues$stg.shortcut) #The colours

names <- as.character(ABSvalues$name.shortcut.trt) #The labels

tmp <- data.frame(stg.shortcut=ABSvalues$name.shortcut,scores=ABSvalues.pca$scores[,1:3])

par(cex.axis = 0.55)

plot(tmp$scores.Comp.1,tmp$scores.Comp.2,type="n",xlab="Scores Component 1",ylab="Scores Component 2")

#text(tmp$scores.Comp.1,tmp$scores.Comp.2,names,col=colnum,cex=0.55, )

text(tmp$scores.Comp.1,tmp$scores.Comp.2,names,cex=0.55)

#Plots of loadings on their own

loads <- loadings(ABSvalues.pca)[,1:2]

x11()

#xlimits <- c(min(loads[,1]) - abs(0.1*min(loads[,1])), max(loads[,1]) + abs(1.1 * max(loads[,1])))

#ylimits <-c(min(loads[,2]) - abs(0.1*min(loads[,2])), max(loads[,2]) + abs(0.1 * max(loads[,2])))

maxx <- max(abs(min(loads[,1])), abs(max(loads[,1])))

maxx <- 1.2 * maxx

maxy <- max(abs(min(loads[,2])), abs(max(loads[,2])))

maxy <- 1.2 * maxy

xlimits <- c(-1 * maxx, maxx)

ylimits <- c(-1 * maxy, maxy)

plot(loads[,1],loads[,2],type="n",xlab=paste("Loading 1 (POV ",round(POV[1], digits = 4) ,

")"),ylab=paste("Loading 2 (POV ",round(POV[2], digits = 4) , ")"),ylim=ylimits,xlim=xlimits) arrows(0,0,loads[,1],loads[,2],length=0.1,angle=20)

text(loads[,1],loads[,2],dimnames(loads)[[1]],pos=1,cex=0.75)

biplot(princomp(ABSvalues.mat,cor=T),pc.biplot=T,cex=0.53,expand=0.8)

#clustering

library(cluster)

scores.pam <- pam(ABSvalues.pca$scores[,1:4],k=4) # k is the number of clusters wanted

cbind(scores.pam$clustering,ABSvalues.pca$scores[,1:4]) # This puts a column with the groups next to the columns of scores

#plot(scores.pam) # not working properly, but not neccessary cbind<-cbind(scores.pam$clustering,ABSvalues.pca$scores[,1:4])