-
Notifications
You must be signed in to change notification settings - Fork 2
/
ssts-icoads-naaoi.R
28 lines (22 loc) · 941 Bytes
/
ssts-icoads-naaoi.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Code to study the PDI dependence with the SST
# Author: Alfredo Hernández <[email protected]>
# Libraries ------------------------------------------------
library(data.table)
library(tidyverse)
library(scales)
# ICOADS 1 jan 1966 data -----------------------------------
icoads <- fread("data-tests/icoads-dataset.csv")
icoads <- fread("data/icoads-dataset.csv")
icoads <- icoads %>%
filter(is.na(V4) != TRUE) %>%
mutate(sst2 = ifelse(V4 == "NaN", NA, as.numeric(V4))) %>%
mutate(esst = log(30 + sst2)) %>%
rename(date = V1, lon = V2, lat = V3, sst = V4)
# TODO: the colours aren't being rendered properly
ggplot(icoads, aes(x = lon, y = lat)) +
geom_tile(aes(fill = sst))
# geom_point(aes(fill = esst)) +
ggplot(icoads, aes(x = lon, y = lat, colour = sst)) +
geom_point(size=0.05 ) +
scale_colour_continuous(low = "#3276fb", high = "#ec3b00",
space = "Lab", na.value = "#DC066A", guide = "colourbar")