if(interactive()){
# Calculate monthly sea surface temperature from weekly data.
# sst contains 240 weekly images for five years.
# This will produce the 12 average months for the five years
sst.m <- satinMean(sst, by="%m")
# and here we have 60 monthly periods, 12 for each one of the five years
sst.ym <- satinMean(sst, by="%Y-%m")
# monthly sea surface temperature anomalies
anom <- anomaly(X = sst.ym, Y = sst.m)
# the dimensions of the data slots in sst.ym and anom are the same.
dim(sst.ym@data); dim(anom@data)
# plots of the first 24 months
lab <- paste(month.name, rep(2014:2018, each=12))
for (m in 1:24){
plot(anom, period = m, zlim=c(-10, 10), col.sep = 0.2, main = lab[m],
scheme = c("blue", "cyan", "white", "yellow", "red"))
}
}
Run the code above in your browser using DataLab