The NOAA 1/4° daily Optimum Interpolation Sea Surface Temperature (or daily OISST) is an analysis constructed by combining observations from different platforms (satellites, ships, buoys, and Argo floats) on a regular global grid. A spatially complete SST map is produced by interpolating to fill in gaps. The methodology includes bias adjustment of satellite and ship observations (referenced to buoys) to compensate for platform differences and sensor biases. This proved critical during the Mt. Pinatubo eruption in 1991, when the widespread presence of volcanic aerosols resulted in infrared satellite temperatures that were much cooler than actual ocean temperatures (Reynolds 1993).
Required libraries
library(ncdf4)
library(tidyverse)
library(lubridate)
library(raster)
library(rnaturalearth)
library(ggthemes)
library(viridis)
library(reshape2)
library(metR)
library(ggpubr)
library(animation)
library(colorRamps)
#load data from working directory
nc_b <- brick("sst.day.mean.2020.nc")
#monthly mean from daily data
dates <- getZ(nc_b)
months <- as.integer(format(dates, "%m"))
sst_r <- stackApply(nc_b, months, fun = mean)
bob <- crop(sst_r, extent(75,105,3,28)) #crop the area of interest
coast <- ne_countries(scale = "medium" ,returnclass = "sf")
####
# every month
#----------------------------------------
jan <- bob$index_1
feb <- bob$index_2
mar <- bob$index_3
apr <- bob$index_4
may <- bob$index_5
jun <- bob$index_6
july <- bob$index_7
aug <- bob$index_8
sep <- bob$index_9
oct <- bob$index_10
nov <- bob$index_11
####
#---------------------------------------------
m1 <- as.data.frame(jan, xy=TRUE) %>% drop_na()
m2 <- as.data.frame(feb, xy=TRUE) %>% drop_na()
m3 <- as.data.frame(mar, xy=TRUE) %>% drop_na()
m4 <- as.data.frame(apr, xy=TRUE) %>% drop_na()
m5 <- as.data.frame(may, xy=TRUE) %>% drop_na()
m6 <- as.data.frame(jun, xy=TRUE) %>% drop_na()
m7 <- as.data.frame(july, xy=TRUE) %>% drop_na()
m8 <- as.data.frame(aug, xy=TRUE) %>% drop_na()
m9 <- as.data.frame(sep, xy=TRUE) %>% drop_na()
m10 <- as.data.frame(oct, xy=TRUE) %>% drop_na()
m11 <- as.data.frame(nov, xy=TRUE) %>% drop_na()
#-----------------------------------------------------------------
p1 <- ggplot(data = m1) + geom_contour_fill(aes(x=x, y=y, z=index_1)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("january") +theme_bw()
p2 <- ggplot(data = m2) + geom_contour_fill(aes(x=x, y=y, z=index_2)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude")+ggtitle("february") + theme_bw()
p3<- ggplot(data = m3) + geom_contour_fill(aes(x=x, y=y, z=index_3)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("march") + theme_bw()
p4 <- ggplot(data = m4) + geom_contour_fill(aes(x=x, y=y, z=index_4)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("april")+ theme_bw()
p5 <- ggplot(data = m5) + geom_contour_fill(aes(x=x, y=y, z=index_5)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("may")+ theme_bw()
p6 <- ggplot(data = m6) + geom_contour_fill(aes(x=x, y=y, z=index_6)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") + ggtitle("june")+theme_bw()
p7<- ggplot(data = m7) + geom_contour_fill(aes(x=x, y=y, z=index_7)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("july")+ theme_bw()
p8<- ggplot(data = m8) + geom_contour_fill(aes(x=x, y=y, z=index_8)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("august")+ theme_bw()
p9<- ggplot(data = m9) + geom_contour_fill(aes(x=x, y=y, z=index_9)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("september")+ theme_bw()
p10 <- ggplot(data = m10) + geom_contour_fill(aes(x=x, y=y, z=index_10)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("october")+ theme_bw()
p11 <- ggplot(data = m11) + geom_contour_fill(aes(x=x, y=y, z=index_11)) +scale_fill_gradientn(name = "°C" ,colours = matlab.like(100),limit= c(18,32),breaks=seq(18,32,2),guide= guide_colorbar(ticks = TRUE, ticks.colour = "white",barheight = 13,frame.colour = "black",frame.linetype = "dashed",label.hjust = 0.5)) + geom_sf(data = coast, fill="dark gray",col="black") + coord_sf(xlim = c(80,100),ylim = c(5,25)) + xlab("Longitude")+ylab("Latitude") +ggtitle("november")+ theme_bw()
ggarrange(p1,p2,p3,p4, common.legend = TRUE, legend = "right", nrow=2,ncol = 2, align = "hv" )
#
ggarrange(p5,p6,p7,p8, common.legend = TRUE, legend = "right", nrow=2,ncol = 2, align = "hv" )