if (FALSE) { # requireNamespace("maps")
# Make a sea-land mask
mask <- temperature[lev == 1000, .(lon = lon, lat = lat, land = MaskLand(lon, lat))]
temperature <- temperature[mask, on = c("lon", "lat")]
library(ggplot2)
ggplot(mask, aes(lon, lat)) +
geom_raster(aes(fill = land))
# Take the temperature difference between land and ocean
diftemp <- temperature[,
.(tempdif = mean(air[land == TRUE]) - mean(air[land == FALSE])),
by = .(lat, lev)]
ggplot(diftemp, aes(lat, lev)) +
geom_contour(aes(z = tempdif, color = after_stat(level))) +
scale_y_level() +
scale_x_latitude() +
scale_color_divergent()
}
Run the code above in your browser using DataLab