Analysis crop trials using climate data


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Analysis crop trials using climate data

  1. 1. Environmental analysis of crop trials using weather data Jacob van Etten Alberto Labarga
  2. 2. weatherDataThis package helps us to:1. Get data from weather stations2. Interpolate weather data for any location
  3. 3. Get the packagesinstall.packages("weatherData", repos="")library(weatherData)install.packages(“cropData", repos="")library(cropData)OR:
  4. 4. Get additional packagesinstall.packages(c(“maps”, “vegan”,“reshape”))library(maps)library(vegan)library(reshape)
  5. 5. Get the script
  6. 6. Get the dataWe will use the Global Summary of Day (GSOD)data of NCDC. takes a lot of time.However, we can selectively download part of thedata, in an automatic way.We will show how to do it with a toy example.Then we will use data from disk to continue.
  7. 7. Selecting stations firstSelect stations within a geographic extentdata(stations)locsExtent <-c(0,20,40,60)stationsSelected <- stationsExtent(locsExtent, stations)Show on a mapplot(stationsSelected[c("LON","LAT")], pch=3, cex=.5)library(maps)map("world",add=TRUE, interior=F)
  8. 8. Download the dataMake a working directory first.setwd(“yourFolder”)Now download the files to this working directory.downloadGSOD(2010, 2010, stations = stationsSelected,silent = FALSE, tries = 2, overwrite = FALSE)After a few downloads, kill the process by pressing “Esc”.Inspect what you have in “yourFolder” and delete thedownloaded files.
  9. 9. Read the data into RCopy the data we have provided you into“yourFolder”.The following lines will make a table and removemissing <- makeTableGSOD()weather <- na.omit(weather)fix(weather)
  10. 10. Getting some trial dataThe idea is to link weather data to crop trial data.We get some trial data that was incorporated inthe package.trial <-read.csv(system.file("external/trialsCA.csv",package="cropData"))locs <-read.csv(system.file("external/locationsCA.csv",package="cropData"))
  11. 11. Make a quick mapstationsSelected <- stationsExtent(c(-110,-60,5,25), stations)plot(stationsSelected[c("LON","LAT")], pch=3,cex=.5)points(locs[c("LON","LAT")], pch=15)map("world",add=TRUE, interior=F)
  12. 12. InterpolationWe have already seen interpolation at work.Now we use interpolation to estimate weathervariables for the trial locations.The function interpolateDailyWeather()automatically interpolates the weathersurface for each day and extracts the valuesfor each trial location.
  13. 13. InterpolateInterpolate weather for the years 2003, 2004 and2005.ipW2003 <- interpolateDailyWeather(tableGSOD = weatherCA,locations = locs[c("ID", "LON", "LAT", "ALT")],startDate="2003-5-15",endDate="2003-9-25",stations = stationsSelected)Repeat for the other years and then combine:ipW <- rbind(ipW2003,ipW2004,ipW2005)
  14. 14. Thermal stress Minimum is Duration of assumed to T > 30 °C = be at sunrise. 4.8 hTemperature (°C) Maximum is assumed to be 2 h after solar noon. Time
  15. 15. Derive ecophysiological vars?thermalStressDailyRun the example to see how this works.Then:TEMPSTRESS30 <- thermalStressSeasonal(30,ipW, trial, locs)PREC <- precipitationSeasonal(ipW, trial)RADIATION <- radiationSeasonal(ipW, trial, locs)trial <- cbind(trial, TEMPSTRESS30, PREC,RADIATION)
  16. 16. Do RDA on residualsInstead of a normal PCA, we constrain theaxes of the PCA with linear combinations ofthe ecophysiological variables.This type of constrained PCA is calledredundancy analysis (RDA)
  17. 17. Do ANOVAm <- lm(Yield ~ Variety + Location + Plant.m2,data=tr2005)G + GxE are left over, the rest is filtered outtr2005$Yield <- residuals(m)tr2005 <-tr2005[,c("Variety","Location","Yield")]
  18. 18. Make table ready for RDAtr2005 <- melt(tr2005)tr2005 <- acast(tr2005, Location ~ Variety)env2005 <- trial[trial$Year == 2005, c("Location","TEMPSTRESS30", "PRECSUM", "PRECCV","RADIATION")]env2005 <- unique(env2005)rownames(env2005) <- env2005$Locationenv2005 <- env2005[,-1]
  19. 19. RDArda2005 <- rda(tr2005, env2005)summary(rda2005)plot(rda2005)
  20. 20. Putting GxE on mapIt is possible to use the resulting RDA model topredict for any locations.The steps would be:1. Interpolate weather variables for new location2. Derive ecophysiological variables3. Predict yield value for this new location (not taking into account additive environmental effect)
  21. 21. Final remarksTrial data are often noisy – extracting thesignal from the data is the objectiveMany environmental variables are difficult tomeasure, but can be taken to be “random” inthe analysisMany statistical tools exist to link weatherdata to crop trial data.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.