SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
Environmental analysis of crop trials
       using weather data
            Jacob van Etten
            Alberto Labarga
weatherData
This package helps us to:

1. Get data from weather stations

2. Interpolate weather data for any location
Get the packages
install.packages("weatherData", repos="http://R-
Forge.R-project.org")
library(weatherData)
install.packages(“cropData", repos="http://R-
Forge.R-project.org")
library(cropData)
OR:
http://dl.dropbox.com/u/18619554/cropData_1.0.zip
http://dl.dropbox.com/u/18619554/weatherData_1.0.zip
Get additional packages
install.packages(c(“maps”, “vegan”,
“reshape”))

library(maps)
library(vegan)
library(reshape)
Get the script
http://dl.dropbox.com/u/18619554/maizeCA.R

http://goo.gl/Y6h7m
Get the data
We will use the Global Summary of Day (GSOD)
data of NCDC.
ftp://ftp.ncdc.noaa.gov/pub/data/gsod/

Downloading takes a lot of time.
However, we can selectively download part of the
data, in an automatic way.
We will show how to do it with a toy example.
Then we will use data from disk to continue.
Selecting stations first
Select stations within a geographic extent
data(stations)
locsExtent <-c(0,20,40,60)
stationsSelected <- stationsExtent(locsExtent, stations)

Show on a map
plot(stationsSelected[c("LON","LAT")], pch=3, cex=.5)
library(maps)
map("world",add=TRUE, interior=F)
Download the data
Make 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 the
downloaded files.
Read the data into R
Copy the data we have provided you into
“yourFolder”.

The following lines will make a table and remove
missing observations.

weather <- makeTableGSOD()
weather <- na.omit(weather)
fix(weather)
Getting some trial data
The idea is to link weather data to crop trial data.
We get some trial data that was incorporated in
the package.

trial <-
read.csv(system.file("external/trialsCA.csv",
package="cropData"))
locs <-
read.csv(system.file("external/locationsCA.csv",
package="cropData"))
Make a quick map
stationsSelected <- 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)
Interpolation
We have already seen interpolation at work.

Now we use interpolation to estimate weather
variables for the trial locations.

The function interpolateDailyWeather()
automatically interpolates the weather
surface for each day and extracts the values
for each trial location.
Interpolate
Interpolate weather for the years 2003, 2004 and
2005.
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)
Thermal stress

                   Minimum is          Duration of
                   assumed to          T > 30 °C =
                   be at sunrise.      4.8 h
Temperature (°C)




                                            Maximum is
                                            assumed to
                                            be 2 h after
                                            solar noon.




                                    Time
Derive ecophysiological vars
?thermalStressDaily
Run 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)
Do RDA on residuals
Instead of a normal PCA, we constrain the
axes of the PCA with linear combinations of
the ecophysiological variables.

This type of constrained PCA is called
redundancy analysis (RDA)
Do ANOVA
m <- lm(Yield ~ Variety + Location + Plant.m2,
data=tr2005)
G + GxE are left over, the rest is filtered out

tr2005$Yield <- residuals(m)
tr2005 <-
tr2005[,c("Variety","Location","Yield")]
Make table ready for RDA
tr2005 <- melt(tr2005)
tr2005 <- acast(tr2005, Location ~ Variety)

env2005 <- trial[trial$Year == 2005, c("Location",
"TEMPSTRESS30", "PRECSUM", "PRECCV",
"RADIATION")]
env2005 <- unique(env2005)
rownames(env2005) <- env2005$Location
env2005 <- env2005[,-1]
RDA
rda2005 <- rda(tr2005, env2005)
summary(rda2005)
plot(rda2005)
Putting GxE on map
It is possible to use the resulting RDA model to
predict for any locations.
The steps would be:
1. Interpolate weather variables for new
     location
2. Derive ecophysiological variables
3. Predict yield value for this new location
     (not taking into account additive
     environmental effect)
Final remarks
Trial data are often noisy – extracting the
signal from the data is the objective

Many environmental variables are difficult to
measure, but can be taken to be “random” in
the analysis

Many statistical tools exist to link weather
data to crop trial data.

Mais conteúdo relacionado

Mais procurados

FxUG@東京 第157回 ANE 20分/*くらい*/クッキング
FxUG@東京 第157回 ANE 20分/*くらい*/クッキングFxUG@東京 第157回 ANE 20分/*くらい*/クッキング
FxUG@東京 第157回 ANE 20分/*くらい*/クッキング
Hiiragi3
 
Climate data in r with the raster package
Climate data in r with the raster packageClimate data in r with the raster package
Climate data in r with the raster package
Alberto Labarga
 
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit
 
Postgres performance for humans
Postgres performance for humansPostgres performance for humans
Postgres performance for humans
Craig Kerstiens
 

Mais procurados (9)

FxUG@東京 第157回 ANE 20分/*くらい*/クッキング
FxUG@東京 第157回 ANE 20分/*くらい*/クッキングFxUG@東京 第157回 ANE 20分/*くらい*/クッキング
FxUG@東京 第157回 ANE 20分/*くらい*/クッキング
 
IoT to the Database: Soldering, Python and a little PL/SQL
IoT to the Database: Soldering, Python and a little PL/SQLIoT to the Database: Soldering, Python and a little PL/SQL
IoT to the Database: Soldering, Python and a little PL/SQL
 
Data Assimilation for the Lorenz (1963) Model using Ensemble and Extended Kal...
Data Assimilation for the Lorenz (1963) Model using Ensemble and Extended Kal...Data Assimilation for the Lorenz (1963) Model using Ensemble and Extended Kal...
Data Assimilation for the Lorenz (1963) Model using Ensemble and Extended Kal...
 
Climate data in r with the raster package
Climate data in r with the raster packageClimate data in r with the raster package
Climate data in r with the raster package
 
Pig TPC-H Benchmark and Performance Tuning
Pig TPC-H Benchmark and Performance TuningPig TPC-H Benchmark and Performance Tuning
Pig TPC-H Benchmark and Performance Tuning
 
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
 
Postgres performance for humans
Postgres performance for humansPostgres performance for humans
Postgres performance for humans
 
Test code
Test codeTest code
Test code
 
R and cpp
R and cppR and cpp
R and cpp
 

Destaque (7)

Taller de visualización de datos - Gephi
Taller de visualización de datos - GephiTaller de visualización de datos - Gephi
Taller de visualización de datos - Gephi
 
Gephi Tutorial Layouts
Gephi Tutorial LayoutsGephi Tutorial Layouts
Gephi Tutorial Layouts
 
Gephi Tutorial Visualization
Gephi Tutorial VisualizationGephi Tutorial Visualization
Gephi Tutorial Visualization
 
El Sociograma Presentacion
El Sociograma PresentacionEl Sociograma Presentacion
El Sociograma Presentacion
 
Ejemplo de sociograma
Ejemplo de sociogramaEjemplo de sociograma
Ejemplo de sociograma
 
Gephi Quick Start
Gephi Quick StartGephi Quick Start
Gephi Quick Start
 
Facebook Network Analysis using Gephi
Facebook Network Analysis using GephiFacebook Network Analysis using Gephi
Facebook Network Analysis using Gephi
 

Semelhante a Analysis crop trials using climate data

Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Decision and Policy Analysis Program
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
alexstorer
 
R Analytics in the Cloud
R Analytics in the CloudR Analytics in the Cloud
R Analytics in the Cloud
DataMine Lab
 

Semelhante a Analysis crop trials using climate data (20)

Spark_Documentation_Template1
Spark_Documentation_Template1Spark_Documentation_Template1
Spark_Documentation_Template1
 
HEPData
HEPDataHEPData
HEPData
 
Modern Java Development
Modern Java DevelopmentModern Java Development
Modern Java Development
 
Rxjs vienna
Rxjs viennaRxjs vienna
Rxjs vienna
 
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
 
Intro to Reactive Thinking and RxJava 2
Intro to Reactive Thinking and RxJava 2Intro to Reactive Thinking and RxJava 2
Intro to Reactive Thinking and RxJava 2
 
Supervisory control of discrete event systems for linear temporal logic speci...
Supervisory control of discrete event systems for linear temporal logic speci...Supervisory control of discrete event systems for linear temporal logic speci...
Supervisory control of discrete event systems for linear temporal logic speci...
 
Teaching Population Genetics with R
Teaching Population Genetics with RTeaching Population Genetics with R
Teaching Population Genetics with R
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
 
Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and myths
 
DAW: Duplicate-AWare Federated Query Processing over the Web of Data
DAW: Duplicate-AWare Federated Query Processing over the Web of DataDAW: Duplicate-AWare Federated Query Processing over the Web of Data
DAW: Duplicate-AWare Federated Query Processing over the Web of Data
 
2021 10-13 i ox query processing
2021 10-13 i ox query processing2021 10-13 i ox query processing
2021 10-13 i ox query processing
 
InfluxDB IOx Tech Talks: Query Processing in InfluxDB IOx
InfluxDB IOx Tech Talks: Query Processing in InfluxDB IOxInfluxDB IOx Tech Talks: Query Processing in InfluxDB IOx
InfluxDB IOx Tech Talks: Query Processing in InfluxDB IOx
 
How to validate your model
How to validate your modelHow to validate your model
How to validate your model
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Practica 3-ley-de-raoult
Practica 3-ley-de-raoultPractica 3-ley-de-raoult
Practica 3-ley-de-raoult
 
R Analytics in the Cloud
R Analytics in the CloudR Analytics in the Cloud
R Analytics in the Cloud
 
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
 
AI Development with H2O.ai
AI Development with H2O.aiAI Development with H2O.ai
AI Development with H2O.ai
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923
 

Mais de Alberto Labarga

Mais de Alberto Labarga (20)

El Salto Communities - EditorsLab 2017
El Salto Communities - EditorsLab 2017El Salto Communities - EditorsLab 2017
El Salto Communities - EditorsLab 2017
 
Shokesu - Premio Nobel de Literatura a Bob Dylan
Shokesu - Premio Nobel de Literatura a Bob DylanShokesu - Premio Nobel de Literatura a Bob Dylan
Shokesu - Premio Nobel de Literatura a Bob Dylan
 
Genome visualization challenges
Genome visualization challengesGenome visualization challenges
Genome visualization challenges
 
SocialLearning: descubriendo contenidos educativos de manera colaborativa
SocialLearning: descubriendo contenidos educativos de manera colaborativaSocialLearning: descubriendo contenidos educativos de manera colaborativa
SocialLearning: descubriendo contenidos educativos de manera colaborativa
 
Hacksanfermin 2015 :: Dropcoin Street
Hacksanfermin 2015 :: Dropcoin StreetHacksanfermin 2015 :: Dropcoin Street
Hacksanfermin 2015 :: Dropcoin Street
 
hacksanfermin 2015 :: Parking inteligente
hacksanfermin 2015 :: Parking inteligentehacksanfermin 2015 :: Parking inteligente
hacksanfermin 2015 :: Parking inteligente
 
jpd5 big data
jpd5 big datajpd5 big data
jpd5 big data
 
Vidas Contadas :: Visualizar 2015
Vidas Contadas :: Visualizar 2015Vidas Contadas :: Visualizar 2015
Vidas Contadas :: Visualizar 2015
 
Periodismo de datos y visualización de datos abiertos #siglibre9
Periodismo de datos y visualización de datos abiertos #siglibre9Periodismo de datos y visualización de datos abiertos #siglibre9
Periodismo de datos y visualización de datos abiertos #siglibre9
 
myHealthHackmedicine
myHealthHackmedicinemyHealthHackmedicine
myHealthHackmedicine
 
Big Data y Salud
Big Data y SaludBig Data y Salud
Big Data y Salud
 
Arduino: Control de motores
Arduino: Control de motoresArduino: Control de motores
Arduino: Control de motores
 
Entrada/salida analógica con Arduino
Entrada/salida analógica con ArduinoEntrada/salida analógica con Arduino
Entrada/salida analógica con Arduino
 
Práctica con Arduino: Simon Dice
Práctica con Arduino: Simon DicePráctica con Arduino: Simon Dice
Práctica con Arduino: Simon Dice
 
Entrada/Salida digital con Arduino
Entrada/Salida digital con ArduinoEntrada/Salida digital con Arduino
Entrada/Salida digital con Arduino
 
Presentación Laboratorio de Fabricación Digital UPNA 2014
Presentación Laboratorio de Fabricación Digital UPNA 2014Presentación Laboratorio de Fabricación Digital UPNA 2014
Presentación Laboratorio de Fabricación Digital UPNA 2014
 
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
 
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
 
Introducción a la impresión 3D
Introducción a la impresión 3DIntroducción a la impresión 3D
Introducción a la impresión 3D
 
Vidas Contadas
Vidas ContadasVidas Contadas
Vidas Contadas
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Analysis crop trials using climate data

  • 1. Environmental analysis of crop trials using weather data Jacob van Etten Alberto Labarga
  • 2. weatherData This package helps us to: 1. Get data from weather stations 2. Interpolate weather data for any location
  • 3. Get the packages install.packages("weatherData", repos="http://R- Forge.R-project.org") library(weatherData) install.packages(“cropData", repos="http://R- Forge.R-project.org") library(cropData) OR: http://dl.dropbox.com/u/18619554/cropData_1.0.zip http://dl.dropbox.com/u/18619554/weatherData_1.0.zip
  • 4. Get additional packages install.packages(c(“maps”, “vegan”, “reshape”)) library(maps) library(vegan) library(reshape)
  • 6. Get the data We will use the Global Summary of Day (GSOD) data of NCDC. ftp://ftp.ncdc.noaa.gov/pub/data/gsod/ Downloading takes a lot of time. However, we can selectively download part of the data, 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. Selecting stations first Select stations within a geographic extent data(stations) locsExtent <-c(0,20,40,60) stationsSelected <- stationsExtent(locsExtent, stations) Show on a map plot(stationsSelected[c("LON","LAT")], pch=3, cex=.5) library(maps) map("world",add=TRUE, interior=F)
  • 8. Download the data Make 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 the downloaded files.
  • 9. Read the data into R Copy the data we have provided you into “yourFolder”. The following lines will make a table and remove missing observations. weather <- makeTableGSOD() weather <- na.omit(weather) fix(weather)
  • 10. Getting some trial data The idea is to link weather data to crop trial data. We get some trial data that was incorporated in the package. trial <- read.csv(system.file("external/trialsCA.csv", package="cropData")) locs <- read.csv(system.file("external/locationsCA.csv", package="cropData"))
  • 11. Make a quick map stationsSelected <- 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. Interpolation We have already seen interpolation at work. Now we use interpolation to estimate weather variables for the trial locations. The function interpolateDailyWeather() automatically interpolates the weather surface for each day and extracts the values for each trial location.
  • 13. Interpolate Interpolate weather for the years 2003, 2004 and 2005. 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. Thermal stress Minimum is Duration of assumed to T > 30 °C = be at sunrise. 4.8 h Temperature (°C) Maximum is assumed to be 2 h after solar noon. Time
  • 15. Derive ecophysiological vars ?thermalStressDaily Run 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. Do RDA on residuals Instead of a normal PCA, we constrain the axes of the PCA with linear combinations of the ecophysiological variables. This type of constrained PCA is called redundancy analysis (RDA)
  • 17. Do ANOVA m <- lm(Yield ~ Variety + Location + Plant.m2, data=tr2005) G + GxE are left over, the rest is filtered out tr2005$Yield <- residuals(m) tr2005 <- tr2005[,c("Variety","Location","Yield")]
  • 18. Make table ready for RDA tr2005 <- melt(tr2005) tr2005 <- acast(tr2005, Location ~ Variety) env2005 <- trial[trial$Year == 2005, c("Location", "TEMPSTRESS30", "PRECSUM", "PRECCV", "RADIATION")] env2005 <- unique(env2005) rownames(env2005) <- env2005$Location env2005 <- env2005[,-1]
  • 19. RDA rda2005 <- rda(tr2005, env2005) summary(rda2005) plot(rda2005)
  • 20. Putting GxE on map It is possible to use the resulting RDA model to predict for any locations. The steps would be: 1. Interpolate weather variables for new location 2. Derive ecophysiological variables 3. Predict yield value for this new location (not taking into account additive environmental effect)
  • 21. Final remarks Trial data are often noisy – extracting the signal from the data is the objective Many environmental variables are difficult to measure, but can be taken to be “random” in the analysis Many statistical tools exist to link weather data to crop trial data.