Chapter 6 Combining trait, weather, and image datasets

The objective of this vignette is to walk through how to combine our several types of data, and demonstrate several realistic analyses that can be done on these merged data.

For the first analysis, we want to figure out how the number of sufficiently warm days affects the amount of canopy cover at our site. We do this by combining the canopy cover data with the meteorological data on growing degree days, then modeling and plotting their relationship. We are specifically interested in figuring out when the increase in canopy cover starts to slow down in response to warm temperature days.

The second analysis compares greenness from image data with canopy cover.

6.1 Get and join data

Here we combine two dataframes. The first contains all the canopy cover values for 2018, which was created in the traits vignette. The second is the cumulative growing degree days for all of 2018, which were calculated from the daily minimum and maximum temperatures in the weather vignette. They are combined by their common column, the date.

6.2 Plot and model relationship between GDD and canopy cover for each cultivar

We are interested in how growing degree days affects canopy cover. To investigate this, we are going to model and plot their relationship. We are using a logistic growth model here because it is appropriate for the shape of the GDD-cover relationship.

The logistic growth model is specified as

\[y = \frac{c}{1+e^{a + b * \textrm{x}}}\]

where \(y\) is the response variable canopy cover, \(x\) is the predictor growing degree days, \(c\) is the asymptote or maximum canopy cover, \(a\) is the initial value for canopy cover, and \(b\) is the steepness of the curve. (reference)

We want to know the relationship for each cultivar, so we’ll start of by determining the parameters of the model for one of the cultivars in our dataset. We provide estimated values for the asymptote \(c\) and initial canopy cover value \(a\), and provide canopy cover \(y\) with corresponding growing degree days \(x\) for one measurement of the chosen cultivar.

The below provides better estimates for the \(c\), \(a\), and \(b\) parameters, which are used to plot the model as an orange line on top of the black points which are actual values.

We then calculate the inflection point for this cultivar’s model.

The maximum growth rate is the change in canopy cover per day at the rate of maximum growth. The growing degree day at which maximum growth is obtained is called the inflection point. This occurs near the midpoint of the y-axis, or \(\frac{c - a}{2}\).

We then use the parameters from a single cultivar to run a model for each of the rest of the cultivars. These results are used to plot the model predictions, which are shown as an orange line. We also calculated the inflection point from each cultivar’s model, which will be used in the following section.

6.3 Create histogram of growth rate for all cultivars

The last thing that we are going to do is assess the difference in this relationship among the cultivars. We are going to use the inflection point from the logistic growth model, which indicates when canopy cover stops increasing as quickly with increasingly more warm days. The resulting inflection points for each cultivar are plotted as a histogram.

6.4 Get image data

In this examnple we will extract our plot data from a series of images taken in May of Season 6, measure its “greeness” annd plot that against the plant heights from above in this vignette.

The chosen statistic here is the normalised green-red difference index, \(\textrm{NGRDI}=\frac{R-G}/{R+G}\) (Rasmussen et al., 2016), which uses the red and green bands from the image raster.

Below we retrieve all the available plots for a particular date, then find and convert the plot boundary JSON into tuples. We will use these tuples to extract the data for our plot.

These are the names of the full field RGB data for the month of May. We will be extracting our plot data from these files. A compressed file containing these images can be found on Clowder. The code below downloads the image files into a .zip file, which takes a few minutes, and then unzips that file so the image files are accessible.

We will loop through these images, extract our plot data, and calculate the “greeness” of each extract. We are using the name of the file to extract the date for later.

We then pull in the canopy data for our charting purposes.

We now need to add the height data to the data set to plot.

We then determine the average canopy cover across the site for the day that the sensor data were collected. The relationship between our greenness metric and average canopy cover are plotted.