SlideShare a Scribd company logo
Environmental analysis of crop trialsusing weather dataJacob van Etten
weatherDataThis package helps us to:1. Get data from weather stations2. Interpolate weather data for any location
Get the packagesinstall.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.ziphttp://dl.dropbox.com/u/18619554/weatherData_1.0.zip
Get additional packagesinstall.packages(c(“maps”, “vegan”, “reshape”))library(maps)library(vegan)library(reshape)
Get the scripthttp://dl.dropbox.com/u/18619554/maizeCA.Rhttp://goo.gl/Y6h7m
Get the dataWe 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 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)
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 the downloaded files.
Read the data into RCopy 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 dataThe 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 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)
InterpolationWe 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.
InterpolateInterpolate 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)
Duration of T > 30 °C =4.8 hMinimum is assumed to be at sunrise.Maximum is assumed to be 2 h after solar noon.Thermal stressTemperature (°C)Time
Derive ecophysiologicalvars?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)
Do RDA on residualsInstead 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 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")]
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]
RDArda2005 <- rda(tr2005, env2005)summary(rda2005)plot(rda2005)
Putting GxE on mapIt is possible to use the resulting RDA model to predict for any locations.The steps would be:Interpolate weather variables for new locationDerive ecophysiological variablesPredict yield value for this new location (not taking into account additive environmental effect)
Final remarksTrial data are often noisy – extracting the signal from the data is the objectiveMany environmental variables are difficult to measure, but can be taken to be “random” in the analysisMany statistical tools exist to link weather data to crop trial data.

More Related Content

PDF
Analysis crop trials using climate data
DOCX
Logistic Regression in R-An Exmple.
PDF
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
PDF
Python event based network sniffer
PPTX
Shouldly
DOCX
Include
PDF
Photometric Reduction Manual for Gaia Science Alerts
PDF
Xvii samet dr. yoshihiro yamazake [mini-curso 6ª -feira] 4 wrf-setup_run_ap...
Analysis crop trials using climate data
Logistic Regression in R-An Exmple.
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
Python event based network sniffer
Shouldly
Include
Photometric Reduction Manual for Gaia Science Alerts
Xvii samet dr. yoshihiro yamazake [mini-curso 6ª -feira] 4 wrf-setup_run_ap...

What's hot (17)

PDF
Блохин Леонид - "Mist, как часть Hydrosphere"
PDF
Monitoring Cloud Foundry: Learning about the Firehose
DOCX
Ca counter name
KEY
[JAM 1.2] Design & Multitasking (Andrew Solovey)
PPTX
Thoughts on heptio's ark - Contributors Meet 21st Sept 2018
PDF
Climate data in r with the raster package
DOCX
Implementation of k-means clustering algorithm in C
PDF
Weather scraper for your data warehouse
PDF
JTF2018_B30_k8s_operator_nobusue
PDF
Pyspark
ODP
Use of django at jolt online v3
PDF
Completerecovery
PPTX
Using PostgreSQL for Flight Planning
PDF
Bending the IoT to your will with JavaScript
PDF
Chaos Engineering 시작하기 - 윤석찬 (AWS 테크에반젤리스트) :: 한국 카오스엔지니어링 밋업
DOCX
PPTX
Sync with async
Блохин Леонид - "Mist, как часть Hydrosphere"
Monitoring Cloud Foundry: Learning about the Firehose
Ca counter name
[JAM 1.2] Design & Multitasking (Andrew Solovey)
Thoughts on heptio's ark - Contributors Meet 21st Sept 2018
Climate data in r with the raster package
Implementation of k-means clustering algorithm in C
Weather scraper for your data warehouse
JTF2018_B30_k8s_operator_nobusue
Pyspark
Use of django at jolt online v3
Completerecovery
Using PostgreSQL for Flight Planning
Bending the IoT to your will with JavaScript
Chaos Engineering 시작하기 - 윤석찬 (AWS 테크에반젤리스트) :: 한국 카오스엔지니어링 밋업
Sync with async
Ad

Viewers also liked (8)

PDF
CCAFS Science Meeting A.2 Jerry Nelson - Global futures
PPT
REDD sticks and carrots in the Brazilian Amazon: assessing costs and liveliho...
PDF
CCAFS Science Meeting Item 05 Vladimir Smakhtin - Water storage
PPT
Pressures on agriculture from climate change mitigation
PDF
CCAFS Science Meeting Item 07 Mario Herrero - Household modeling
CCAFS Science Meeting A.2 Jerry Nelson - Global futures
REDD sticks and carrots in the Brazilian Amazon: assessing costs and liveliho...
CCAFS Science Meeting Item 05 Vladimir Smakhtin - Water storage
Pressures on agriculture from climate change mitigation
CCAFS Science Meeting Item 07 Mario Herrero - Household modeling
Ad

Similar to Environmental analysis of crop trials - Van Etten (20)

ODP
rules, events and workflow
PDF
Space Systems & Space Subsystems Fundamentals Technical Training Course Sampler
PDF
2021 10-13 i ox query processing
PDF
InfluxDB IOx Tech Talks: Query Processing in InfluxDB IOx
PPT
e computer notes - Date time functions
PDF
West-Nile-Virus | Kaggle
PPT
Dynamically Evolving Systems: Cluster Analysis Using Time
PDF
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
PDF
1569909951 (2)
PDF
TIME SERIES ANALYSIS USING ARIMA MODEL FOR FORECASTING IN R (PRACTICAL)
PDF
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021
ODP
Intro To PostGIS
PDF
Observer Pattern
PDF
jkfdlsajfklafj
PDF
Practica 3-ley-de-raoult
PDF
Please fix the java code (using eclipse)package hw4p1;import jav.pdf
PDF
Automated tests - facts and myths
PDF
Pdxpugday2010 pg90
PDF
Long wave radiation parameterisations
rules, events and workflow
Space Systems & Space Subsystems Fundamentals Technical Training Course Sampler
2021 10-13 i ox query processing
InfluxDB IOx Tech Talks: Query Processing in InfluxDB IOx
e computer notes - Date time functions
West-Nile-Virus | Kaggle
Dynamically Evolving Systems: Cluster Analysis Using Time
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
1569909951 (2)
TIME SERIES ANALYSIS USING ARIMA MODEL FOR FORECASTING IN R (PRACTICAL)
Anais Dotis-Georgiou [InfluxData] | Learn Flux by Example | InfluxDays NA 2021
Intro To PostGIS
Observer Pattern
jkfdlsajfklafj
Practica 3-ley-de-raoult
Please fix the java code (using eclipse)package hw4p1;import jav.pdf
Automated tests - facts and myths
Pdxpugday2010 pg90
Long wave radiation parameterisations

More from CCAFS | CGIAR Research Program on Climate Change, Agriculture and Food Security (20)

PPTX
Achieving NDC Ambition in Agriculture: How much does agriculture contribute t...
PPTX
Achieving NDC Ambition in Agriculture: Mitigation ambition in new & updated N...
PPTX
Achieving NDC Ambition in Agriculture: Overview of NDC ambition in the agricu...
PDF
CSA Monitoring: Understanding adoption, synergies and tradeoffs at farm and h...
PPTX
Livestock and sustainability in changing climate: Impacts and global best pra...
PPTX
ADB ESLAP case study outputs and synthesis results: Sustainable livestock gui...
PDF
ADB ESLAP Case Study "Dairy value chain in Indonesia"
PPTX
Assessment of the environmental sustainability of plant-based meat and pork: ...
PPTX
PDF
The impact of mechanization in smallholder rice production in Nigeria
PPTX
PPTX
Greenhouse gas (GHG) emissions & priority action in climate mitigation in the...
PDF
Evaluation of Rwanda climate services for agriculture through a gender lens
PDF
Introduction to Climate-Smart Agriculture: Busia County, Kenya
PPTX
Delivering information for national low-emission development strategies: acti...
PPTX
Delivering information for national low-emission development strategies: acti...
Achieving NDC Ambition in Agriculture: How much does agriculture contribute t...
Achieving NDC Ambition in Agriculture: Mitigation ambition in new & updated N...
Achieving NDC Ambition in Agriculture: Overview of NDC ambition in the agricu...
CSA Monitoring: Understanding adoption, synergies and tradeoffs at farm and h...
Livestock and sustainability in changing climate: Impacts and global best pra...
ADB ESLAP case study outputs and synthesis results: Sustainable livestock gui...
ADB ESLAP Case Study "Dairy value chain in Indonesia"
Assessment of the environmental sustainability of plant-based meat and pork: ...
The impact of mechanization in smallholder rice production in Nigeria
Greenhouse gas (GHG) emissions & priority action in climate mitigation in the...
Evaluation of Rwanda climate services for agriculture through a gender lens
Introduction to Climate-Smart Agriculture: Busia County, Kenya
Delivering information for national low-emission development strategies: acti...
Delivering information for national low-emission development strategies: acti...

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Digital-Transformation-Roadmap-for-Companies.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
Building Integrated photovoltaic BIPV_UPV.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectroscopy.pptx food analysis technology
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I

Environmental analysis of crop trials - Van Etten

  • 1. Environmental analysis of crop trialsusing weather dataJacob van Etten
  • 2. weatherDataThis package helps us to:1. Get data from weather stations2. Interpolate weather data for any location
  • 3. Get the packagesinstall.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.ziphttp://dl.dropbox.com/u/18619554/weatherData_1.0.zip
  • 4. Get additional packagesinstall.packages(c(“maps”, “vegan”, “reshape”))library(maps)library(vegan)library(reshape)
  • 6. Get the dataWe 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 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. 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 the downloaded files.
  • 9. Read the data into RCopy 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 dataThe 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 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. InterpolationWe 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. InterpolateInterpolate 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. Duration of T > 30 °C =4.8 hMinimum is assumed to be at sunrise.Maximum is assumed to be 2 h after solar noon.Thermal stressTemperature (°C)Time
  • 15. Derive ecophysiologicalvars?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. Do RDA on residualsInstead 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 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. 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. RDArda2005 <- rda(tr2005, env2005)summary(rda2005)plot(rda2005)
  • 20. Putting GxE on mapIt is possible to use the resulting RDA model to predict for any locations.The steps would be:Interpolate weather variables for new locationDerive ecophysiological variablesPredict yield value for this new location (not taking into account additive environmental effect)
  • 21. Final remarksTrial data are often noisy – extracting the signal from the data is the objectiveMany environmental variables are difficult to measure, but can be taken to be “random” in the analysisMany statistical tools exist to link weather data to crop trial data.