H Exercise 06
Last updated: 2020-08-12 00:41:56
H.1 Question 1
- Read the
modis_south.tif
raster to a multi-band raster object. This raster is a series of NDVI images from southern Israel. The date each layer refers to is recorded in the correspondingmodis_south_dates.csv
file. - Calculate a 12-band raster that will contain the maximal NDVI per pixel (excluding
NA
) for each month. The first band will contain the maximal values per pixel in all images taken in January, the second band will contain the maximal values per pixel in all images taken in February, and so on. Use corresponding themodis_south_dates.csv
table to determine the layers corresponding to each month. - Plot the resulting raster as shown in Figure H.1 (including month names).
- Remember: you cannot use the
raster
package in your solution! (see Section B.5.5.)
(50 points)
H.2 Question 2
- The following code creates a
data.frame
namedelk_data
:
library(moveHMM)
data(elk_data)
elk_data$ID = as.character(elk_data$ID)
head(elk_data)
## ID Easting Northing dist_water
## 1 elk-115 769928 4992847 200.00
## 2 elk-115 766875 4997444 600.52
## 3 elk-115 765949 4998516 561.81
## 4 elk-115 765938 4998276 550.00
## 5 elk-115 766275 4998005 302.08
## 6 elk-115 766368 4998051 213.60
- The
elk_data
table contains the locations (x=Easting
, y=Northing
, crs=32617
) of four different animals (ID
) (elks in Canada), as shown in the following map.
- Add the code section to load
elk_data
in your exercise. - Create an
sf
line layer with the trajectory of each animal (four features) and one attribute (theID
). - Calculate the convex hull polygon of each animal trajectory.
- Plot the trajectories and the convex hull polygons, using a different color for each animal (Figure H.2). You can use
col=hcl.colors(4, "Dark 2")
to plot the geometries with four different colors andlty=2
to draw the convex hull polygons using dashed lines.
(50 points)