Load the relevant packages

library(ncdf4);
library(ncdf4.helpers);
## Warning: package 'ncdf4.helpers' was built under R version 3.5.2
library(maps);
library(RColorBrewer)
library(lattice)
library(latticeExtra)

Clear variables and any open plots before starting

graphics.off()
rm(list=ls())

Set your working directory

setwd("D:/Documentos D/MSc Climate Change/GY667 - The Ocean and Climate Change/WS1")

Preliminary program reads 1. NetCDF gridded surface temperature data and 2. calculated global mean surface temperatures Store the script and the data in the same folder. Complete the workshop in this folder.

1. Read HadCRUT data

Available from: https://www.metoffice.gov.uk/hadobs/hadcrut4/data/current/gridded_fields/HadCRUT.4.6.0.0.median_netcdf.zip

nc   <- nc_open(file.path(getwd(),"HadCRUT.4.6.0.0.median.nc")); # open netcdf file
tobs <- ncvar_get(nc,"temperature_anomaly"); # load temperature anomaly
ts   <- ncvar_get(nc,"time"); # load the time
lat  <- ncvar_get(nc,"latitude") # load the latitude
lon  <- ncvar_get(nc,"longitude") # load the longitude

Get units, always changeable with time

tunits<-ncatt_get(nc,"time",attname="units")

tunits = “days since 1850-1-1 00:00:00”

tustr<-strsplit(tunits$value, " ")

Check the data time origin

date<-as.character(as.Date(ts,origin=unlist(tustr)[3]))

You can explore the data by checking the dimensions. Two functions are useful: dim, length e.g. dim(tobs) = 72 36 2014, compare this to length(lon), length(lat), length(ts) To see the data are in an array of dimensions longitude x latitude x time

Flag missing data, always get rid of any missing data etc. missing data flags are defined differently for most datasets

tobs[t<-90] = NA;
tobs[t>490] = NA;

2. Load global mean surface temperature data from giss temp https://data.giss.nasa.gov/gistemp/

gmst = read.csv(file.path(getwd(),'global_temps_monthly.csv'),skip = 1,header=TRUE)

Create an annual average

gmst <- data.frame(Year = gmst$Year, t = rowMeans(gmst[, 2:13], na.rm = T))

TO DO: plot the global mean temperature data stored in the variable ‘gmst’. Use ‘plot’

plot(gmst,
     type = "l",
     col = "red",
     lwd = 3,
     xlab = "Years",
     ylab = "T anomaly",
     main = "GMST")

legend("topleft", col='red', lwd = 1,
         legend="GIS TEMP")

3. Taking the gridded hadcrut data, stored as tobs, create annually averaged gridded data

If you look at dim(tobs) = 72 x 36 x 2018, these are the dimensions of longitude, latitude, and time You can check this by looking at length(ts), length(lat), length(lon)

3a. Visualising the data

Each time slice is a month of gridded surface data Pick out an index, say 1936-08-16 (the dates end in 15 or 16 so visually inspect) or “1896-07-16” or “2017-06-16”

year_index <- which(date=="1901-06-16")
mapmat= tobs[,,year_index];
int=seq(-6,6,length.out = 11); # defines the interval of colour plotted
# two lines of code to get nicer colours for the eventual plots
colors <- rev(brewer.pal(10, "RdYlBu"))
rgb.palette <- colorRampPalette(colors)
filled.contour(lon, lat, mapmat, color.palette=rgb.palette, levels=int,
               plot.title=title(main=paste0('HadCRUT Anom. in ', date[year_index]),
                                xlab="Latitude",ylab="Longitude", cex.lab=1.5),
               plot.axes={axis(1, cex.axis=1.5);
                 axis(2, cex.axis=1.5);
                 map('world', add=TRUE);
                 grid()},
               key.title=title(main="[oC]"),
               key.axes={axis(4, cex.axis=1.5)})

TO DO: repeat the same for a different date. different date for each class. Give them skeleton script, add limits etc…

date
##    [1] "1850-01-16" "1850-02-15" "1850-03-16" "1850-04-16" "1850-05-16"
##    [6] "1850-06-16" "1850-07-16" "1850-08-16" "1850-09-16" "1850-10-16"
##   [11] "1850-11-16" "1850-12-16" "1851-01-16" "1851-02-15" "1851-03-16"
##   [16] "1851-04-16" "1851-05-16" "1851-06-16" "1851-07-16" "1851-08-16"
##   [21] "1851-09-16" "1851-10-16" "1851-11-16" "1851-12-16" "1852-01-16"
##   [26] "1852-02-15" "1852-03-16" "1852-04-16" "1852-05-16" "1852-06-16"
##   [31] "1852-07-16" "1852-08-16" "1852-09-16" "1852-10-16" "1852-11-16"
##   [36] "1852-12-16" "1853-01-16" "1853-02-15" "1853-03-16" "1853-04-16"
##   [41] "1853-05-16" "1853-06-16" "1853-07-16" "1853-08-16" "1853-09-16"
##   [46] "1853-10-16" "1853-11-16" "1853-12-16" "1854-01-16" "1854-02-15"
##   [51] "1854-03-16" "1854-04-16" "1854-05-16" "1854-06-16" "1854-07-16"
##   [56] "1854-08-16" "1854-09-16" "1854-10-16" "1854-11-16" "1854-12-16"
##   [61] "1855-01-16" "1855-02-15" "1855-03-16" "1855-04-16" "1855-05-16"
##   [66] "1855-06-16" "1855-07-16" "1855-08-16" "1855-09-16" "1855-10-16"
##   [71] "1855-11-16" "1855-12-16" "1856-01-16" "1856-02-15" "1856-03-16"
##   [76] "1856-04-16" "1856-05-16" "1856-06-16" "1856-07-16" "1856-08-16"
##   [81] "1856-09-16" "1856-10-16" "1856-11-16" "1856-12-16" "1857-01-16"
##   [86] "1857-02-15" "1857-03-16" "1857-04-16" "1857-05-16" "1857-06-16"
##   [91] "1857-07-16" "1857-08-16" "1857-09-16" "1857-10-16" "1857-11-16"
##   [96] "1857-12-16" "1858-01-16" "1858-02-15" "1858-03-16" "1858-04-16"
##  [101] "1858-05-16" "1858-06-16" "1858-07-16" "1858-08-16" "1858-09-16"
##  [106] "1858-10-16" "1858-11-16" "1858-12-16" "1859-01-16" "1859-02-15"
##  [111] "1859-03-16" "1859-04-16" "1859-05-16" "1859-06-16" "1859-07-16"
##  [116] "1859-08-16" "1859-09-16" "1859-10-16" "1859-11-16" "1859-12-16"
##  [121] "1860-01-16" "1860-02-15" "1860-03-16" "1860-04-16" "1860-05-16"
##  [126] "1860-06-16" "1860-07-16" "1860-08-16" "1860-09-16" "1860-10-16"
##  [131] "1860-11-16" "1860-12-16" "1861-01-16" "1861-02-15" "1861-03-16"
##  [136] "1861-04-16" "1861-05-16" "1861-06-16" "1861-07-16" "1861-08-16"
##  [141] "1861-09-16" "1861-10-16" "1861-11-16" "1861-12-16" "1862-01-16"
##  [146] "1862-02-15" "1862-03-16" "1862-04-16" "1862-05-16" "1862-06-16"
##  [151] "1862-07-16" "1862-08-16" "1862-09-16" "1862-10-16" "1862-11-16"
##  [156] "1862-12-16" "1863-01-16" "1863-02-15" "1863-03-16" "1863-04-16"
##  [161] "1863-05-16" "1863-06-16" "1863-07-16" "1863-08-16" "1863-09-16"
##  [166] "1863-10-16" "1863-11-16" "1863-12-16" "1864-01-16" "1864-02-15"
##  [171] "1864-03-16" "1864-04-16" "1864-05-16" "1864-06-16" "1864-07-16"
##  [176] "1864-08-16" "1864-09-16" "1864-10-16" "1864-11-16" "1864-12-16"
##  [181] "1865-01-16" "1865-02-15" "1865-03-16" "1865-04-16" "1865-05-16"
##  [186] "1865-06-16" "1865-07-16" "1865-08-16" "1865-09-16" "1865-10-16"
##  [191] "1865-11-16" "1865-12-16" "1866-01-16" "1866-02-15" "1866-03-16"
##  [196] "1866-04-16" "1866-05-16" "1866-06-16" "1866-07-16" "1866-08-16"
##  [201] "1866-09-16" "1866-10-16" "1866-11-16" "1866-12-16" "1867-01-16"
##  [206] "1867-02-15" "1867-03-16" "1867-04-16" "1867-05-16" "1867-06-16"
##  [211] "1867-07-16" "1867-08-16" "1867-09-16" "1867-10-16" "1867-11-16"
##  [216] "1867-12-16" "1868-01-16" "1868-02-15" "1868-03-16" "1868-04-16"
##  [221] "1868-05-16" "1868-06-16" "1868-07-16" "1868-08-16" "1868-09-16"
##  [226] "1868-10-16" "1868-11-16" "1868-12-16" "1869-01-16" "1869-02-15"
##  [231] "1869-03-16" "1869-04-16" "1869-05-16" "1869-06-16" "1869-07-16"
##  [236] "1869-08-16" "1869-09-16" "1869-10-16" "1869-11-16" "1869-12-16"
##  [241] "1870-01-16" "1870-02-15" "1870-03-16" "1870-04-16" "1870-05-16"
##  [246] "1870-06-16" "1870-07-16" "1870-08-16" "1870-09-16" "1870-10-16"
##  [251] "1870-11-16" "1870-12-16" "1871-01-16" "1871-02-15" "1871-03-16"
##  [256] "1871-04-16" "1871-05-16" "1871-06-16" "1871-07-16" "1871-08-16"
##  [261] "1871-09-16" "1871-10-16" "1871-11-16" "1871-12-16" "1872-01-16"
##  [266] "1872-02-15" "1872-03-16" "1872-04-16" "1872-05-16" "1872-06-16"
##  [271] "1872-07-16" "1872-08-16" "1872-09-16" "1872-10-16" "1872-11-16"
##  [276] "1872-12-16" "1873-01-16" "1873-02-15" "1873-03-16" "1873-04-16"
##  [281] "1873-05-16" "1873-06-16" "1873-07-16" "1873-08-16" "1873-09-16"
##  [286] "1873-10-16" "1873-11-16" "1873-12-16" "1874-01-16" "1874-02-15"
##  [291] "1874-03-16" "1874-04-16" "1874-05-16" "1874-06-16" "1874-07-16"
##  [296] "1874-08-16" "1874-09-16" "1874-10-16" "1874-11-16" "1874-12-16"
##  [301] "1875-01-16" "1875-02-15" "1875-03-16" "1875-04-16" "1875-05-16"
##  [306] "1875-06-16" "1875-07-16" "1875-08-16" "1875-09-16" "1875-10-16"
##  [311] "1875-11-16" "1875-12-16" "1876-01-16" "1876-02-15" "1876-03-16"
##  [316] "1876-04-16" "1876-05-16" "1876-06-16" "1876-07-16" "1876-08-16"
##  [321] "1876-09-16" "1876-10-16" "1876-11-16" "1876-12-16" "1877-01-16"
##  [326] "1877-02-15" "1877-03-16" "1877-04-16" "1877-05-16" "1877-06-16"
##  [331] "1877-07-16" "1877-08-16" "1877-09-16" "1877-10-16" "1877-11-16"
##  [336] "1877-12-16" "1878-01-16" "1878-02-15" "1878-03-16" "1878-04-16"
##  [341] "1878-05-16" "1878-06-16" "1878-07-16" "1878-08-16" "1878-09-16"
##  [346] "1878-10-16" "1878-11-16" "1878-12-16" "1879-01-16" "1879-02-15"
##  [351] "1879-03-16" "1879-04-16" "1879-05-16" "1879-06-16" "1879-07-16"
##  [356] "1879-08-16" "1879-09-16" "1879-10-16" "1879-11-16" "1879-12-16"
##  [361] "1880-01-16" "1880-02-15" "1880-03-16" "1880-04-16" "1880-05-16"
##  [366] "1880-06-16" "1880-07-16" "1880-08-16" "1880-09-16" "1880-10-16"
##  [371] "1880-11-16" "1880-12-16" "1881-01-16" "1881-02-15" "1881-03-16"
##  [376] "1881-04-16" "1881-05-16" "1881-06-16" "1881-07-16" "1881-08-16"
##  [381] "1881-09-16" "1881-10-16" "1881-11-16" "1881-12-16" "1882-01-16"
##  [386] "1882-02-15" "1882-03-16" "1882-04-16" "1882-05-16" "1882-06-16"
##  [391] "1882-07-16" "1882-08-16" "1882-09-16" "1882-10-16" "1882-11-16"
##  [396] "1882-12-16" "1883-01-16" "1883-02-15" "1883-03-16" "1883-04-16"
##  [401] "1883-05-16" "1883-06-16" "1883-07-16" "1883-08-16" "1883-09-16"
##  [406] "1883-10-16" "1883-11-16" "1883-12-16" "1884-01-16" "1884-02-15"
##  [411] "1884-03-16" "1884-04-16" "1884-05-16" "1884-06-16" "1884-07-16"
##  [416] "1884-08-16" "1884-09-16" "1884-10-16" "1884-11-16" "1884-12-16"
##  [421] "1885-01-16" "1885-02-15" "1885-03-16" "1885-04-16" "1885-05-16"
##  [426] "1885-06-16" "1885-07-16" "1885-08-16" "1885-09-16" "1885-10-16"
##  [431] "1885-11-16" "1885-12-16" "1886-01-16" "1886-02-15" "1886-03-16"
##  [436] "1886-04-16" "1886-05-16" "1886-06-16" "1886-07-16" "1886-08-16"
##  [441] "1886-09-16" "1886-10-16" "1886-11-16" "1886-12-16" "1887-01-16"
##  [446] "1887-02-15" "1887-03-16" "1887-04-16" "1887-05-16" "1887-06-16"
##  [451] "1887-07-16" "1887-08-16" "1887-09-16" "1887-10-16" "1887-11-16"
##  [456] "1887-12-16" "1888-01-16" "1888-02-15" "1888-03-16" "1888-04-16"
##  [461] "1888-05-16" "1888-06-16" "1888-07-16" "1888-08-16" "1888-09-16"
##  [466] "1888-10-16" "1888-11-16" "1888-12-16" "1889-01-16" "1889-02-15"
##  [471] "1889-03-16" "1889-04-16" "1889-05-16" "1889-06-16" "1889-07-16"
##  [476] "1889-08-16" "1889-09-16" "1889-10-16" "1889-11-16" "1889-12-16"
##  [481] "1890-01-16" "1890-02-15" "1890-03-16" "1890-04-16" "1890-05-16"
##  [486] "1890-06-16" "1890-07-16" "1890-08-16" "1890-09-16" "1890-10-16"
##  [491] "1890-11-16" "1890-12-16" "1891-01-16" "1891-02-15" "1891-03-16"
##  [496] "1891-04-16" "1891-05-16" "1891-06-16" "1891-07-16" "1891-08-16"
##  [501] "1891-09-16" "1891-10-16" "1891-11-16" "1891-12-16" "1892-01-16"
##  [506] "1892-02-15" "1892-03-16" "1892-04-16" "1892-05-16" "1892-06-16"
##  [511] "1892-07-16" "1892-08-16" "1892-09-16" "1892-10-16" "1892-11-16"
##  [516] "1892-12-16" "1893-01-16" "1893-02-15" "1893-03-16" "1893-04-16"
##  [521] "1893-05-16" "1893-06-16" "1893-07-16" "1893-08-16" "1893-09-16"
##  [526] "1893-10-16" "1893-11-16" "1893-12-16" "1894-01-16" "1894-02-15"
##  [531] "1894-03-16" "1894-04-16" "1894-05-16" "1894-06-16" "1894-07-16"
##  [536] "1894-08-16" "1894-09-16" "1894-10-16" "1894-11-16" "1894-12-16"
##  [541] "1895-01-16" "1895-02-15" "1895-03-16" "1895-04-16" "1895-05-16"
##  [546] "1895-06-16" "1895-07-16" "1895-08-16" "1895-09-16" "1895-10-16"
##  [551] "1895-11-16" "1895-12-16" "1896-01-16" "1896-02-15" "1896-03-16"
##  [556] "1896-04-16" "1896-05-16" "1896-06-16" "1896-07-16" "1896-08-16"
##  [561] "1896-09-16" "1896-10-16" "1896-11-16" "1896-12-16" "1897-01-16"
##  [566] "1897-02-15" "1897-03-16" "1897-04-16" "1897-05-16" "1897-06-16"
##  [571] "1897-07-16" "1897-08-16" "1897-09-16" "1897-10-16" "1897-11-16"
##  [576] "1897-12-16" "1898-01-16" "1898-02-15" "1898-03-16" "1898-04-16"
##  [581] "1898-05-16" "1898-06-16" "1898-07-16" "1898-08-16" "1898-09-16"
##  [586] "1898-10-16" "1898-11-16" "1898-12-16" "1899-01-16" "1899-02-15"
##  [591] "1899-03-16" "1899-04-16" "1899-05-16" "1899-06-16" "1899-07-16"
##  [596] "1899-08-16" "1899-09-16" "1899-10-16" "1899-11-16" "1899-12-16"
##  [601] "1900-01-16" "1900-02-15" "1900-03-16" "1900-04-16" "1900-05-16"
##  [606] "1900-06-16" "1900-07-16" "1900-08-16" "1900-09-16" "1900-10-16"
##  [611] "1900-11-16" "1900-12-16" "1901-01-16" "1901-02-15" "1901-03-16"
##  [616] "1901-04-16" "1901-05-16" "1901-06-16" "1901-07-16" "1901-08-16"
##  [621] "1901-09-16" "1901-10-16" "1901-11-16" "1901-12-16" "1902-01-16"
##  [626] "1902-02-15" "1902-03-16" "1902-04-16" "1902-05-16" "1902-06-16"
##  [631] "1902-07-16" "1902-08-16" "1902-09-16" "1902-10-16" "1902-11-16"
##  [636] "1902-12-16" "1903-01-16" "1903-02-15" "1903-03-16" "1903-04-16"
##  [641] "1903-05-16" "1903-06-16" "1903-07-16" "1903-08-16" "1903-09-16"
##  [646] "1903-10-16" "1903-11-16" "1903-12-16" "1904-01-16" "1904-02-15"
##  [651] "1904-03-16" "1904-04-16" "1904-05-16" "1904-06-16" "1904-07-16"
##  [656] "1904-08-16" "1904-09-16" "1904-10-16" "1904-11-16" "1904-12-16"
##  [661] "1905-01-16" "1905-02-15" "1905-03-16" "1905-04-16" "1905-05-16"
##  [666] "1905-06-16" "1905-07-16" "1905-08-16" "1905-09-16" "1905-10-16"
##  [671] "1905-11-16" "1905-12-16" "1906-01-16" "1906-02-15" "1906-03-16"
##  [676] "1906-04-16" "1906-05-16" "1906-06-16" "1906-07-16" "1906-08-16"
##  [681] "1906-09-16" "1906-10-16" "1906-11-16" "1906-12-16" "1907-01-16"
##  [686] "1907-02-15" "1907-03-16" "1907-04-16" "1907-05-16" "1907-06-16"
##  [691] "1907-07-16" "1907-08-16" "1907-09-16" "1907-10-16" "1907-11-16"
##  [696] "1907-12-16" "1908-01-16" "1908-02-15" "1908-03-16" "1908-04-16"
##  [701] "1908-05-16" "1908-06-16" "1908-07-16" "1908-08-16" "1908-09-16"
##  [706] "1908-10-16" "1908-11-16" "1908-12-16" "1909-01-16" "1909-02-15"
##  [711] "1909-03-16" "1909-04-16" "1909-05-16" "1909-06-16" "1909-07-16"
##  [716] "1909-08-16" "1909-09-16" "1909-10-16" "1909-11-16" "1909-12-16"
##  [721] "1910-01-16" "1910-02-15" "1910-03-16" "1910-04-16" "1910-05-16"
##  [726] "1910-06-16" "1910-07-16" "1910-08-16" "1910-09-16" "1910-10-16"
##  [731] "1910-11-16" "1910-12-16" "1911-01-16" "1911-02-15" "1911-03-16"
##  [736] "1911-04-16" "1911-05-16" "1911-06-16" "1911-07-16" "1911-08-16"
##  [741] "1911-09-16" "1911-10-16" "1911-11-16" "1911-12-16" "1912-01-16"
##  [746] "1912-02-15" "1912-03-16" "1912-04-16" "1912-05-16" "1912-06-16"
##  [751] "1912-07-16" "1912-08-16" "1912-09-16" "1912-10-16" "1912-11-16"
##  [756] "1912-12-16" "1913-01-16" "1913-02-15" "1913-03-16" "1913-04-16"
##  [761] "1913-05-16" "1913-06-16" "1913-07-16" "1913-08-16" "1913-09-16"
##  [766] "1913-10-16" "1913-11-16" "1913-12-16" "1914-01-16" "1914-02-15"
##  [771] "1914-03-16" "1914-04-16" "1914-05-16" "1914-06-16" "1914-07-16"
##  [776] "1914-08-16" "1914-09-16" "1914-10-16" "1914-11-16" "1914-12-16"
##  [781] "1915-01-16" "1915-02-15" "1915-03-16" "1915-04-16" "1915-05-16"
##  [786] "1915-06-16" "1915-07-16" "1915-08-16" "1915-09-16" "1915-10-16"
##  [791] "1915-11-16" "1915-12-16" "1916-01-16" "1916-02-15" "1916-03-16"
##  [796] "1916-04-16" "1916-05-16" "1916-06-16" "1916-07-16" "1916-08-16"
##  [801] "1916-09-16" "1916-10-16" "1916-11-16" "1916-12-16" "1917-01-16"
##  [806] "1917-02-15" "1917-03-16" "1917-04-16" "1917-05-16" "1917-06-16"
##  [811] "1917-07-16" "1917-08-16" "1917-09-16" "1917-10-16" "1917-11-16"
##  [816] "1917-12-16" "1918-01-16" "1918-02-15" "1918-03-16" "1918-04-16"
##  [821] "1918-05-16" "1918-06-16" "1918-07-16" "1918-08-16" "1918-09-16"
##  [826] "1918-10-16" "1918-11-16" "1918-12-16" "1919-01-16" "1919-02-15"
##  [831] "1919-03-16" "1919-04-16" "1919-05-16" "1919-06-16" "1919-07-16"
##  [836] "1919-08-16" "1919-09-16" "1919-10-16" "1919-11-16" "1919-12-16"
##  [841] "1920-01-16" "1920-02-15" "1920-03-16" "1920-04-16" "1920-05-16"
##  [846] "1920-06-16" "1920-07-16" "1920-08-16" "1920-09-16" "1920-10-16"
##  [851] "1920-11-16" "1920-12-16" "1921-01-16" "1921-02-15" "1921-03-16"
##  [856] "1921-04-16" "1921-05-16" "1921-06-16" "1921-07-16" "1921-08-16"
##  [861] "1921-09-16" "1921-10-16" "1921-11-16" "1921-12-16" "1922-01-16"
##  [866] "1922-02-15" "1922-03-16" "1922-04-16" "1922-05-16" "1922-06-16"
##  [871] "1922-07-16" "1922-08-16" "1922-09-16" "1922-10-16" "1922-11-16"
##  [876] "1922-12-16" "1923-01-16" "1923-02-15" "1923-03-16" "1923-04-16"
##  [881] "1923-05-16" "1923-06-16" "1923-07-16" "1923-08-16" "1923-09-16"
##  [886] "1923-10-16" "1923-11-16" "1923-12-16" "1924-01-16" "1924-02-15"
##  [891] "1924-03-16" "1924-04-16" "1924-05-16" "1924-06-16" "1924-07-16"
##  [896] "1924-08-16" "1924-09-16" "1924-10-16" "1924-11-16" "1924-12-16"
##  [901] "1925-01-16" "1925-02-15" "1925-03-16" "1925-04-16" "1925-05-16"
##  [906] "1925-06-16" "1925-07-16" "1925-08-16" "1925-09-16" "1925-10-16"
##  [911] "1925-11-16" "1925-12-16" "1926-01-16" "1926-02-15" "1926-03-16"
##  [916] "1926-04-16" "1926-05-16" "1926-06-16" "1926-07-16" "1926-08-16"
##  [921] "1926-09-16" "1926-10-16" "1926-11-16" "1926-12-16" "1927-01-16"
##  [926] "1927-02-15" "1927-03-16" "1927-04-16" "1927-05-16" "1927-06-16"
##  [931] "1927-07-16" "1927-08-16" "1927-09-16" "1927-10-16" "1927-11-16"
##  [936] "1927-12-16" "1928-01-16" "1928-02-15" "1928-03-16" "1928-04-16"
##  [941] "1928-05-16" "1928-06-16" "1928-07-16" "1928-08-16" "1928-09-16"
##  [946] "1928-10-16" "1928-11-16" "1928-12-16" "1929-01-16" "1929-02-15"
##  [951] "1929-03-16" "1929-04-16" "1929-05-16" "1929-06-16" "1929-07-16"
##  [956] "1929-08-16" "1929-09-16" "1929-10-16" "1929-11-16" "1929-12-16"
##  [961] "1930-01-16" "1930-02-15" "1930-03-16" "1930-04-16" "1930-05-16"
##  [966] "1930-06-16" "1930-07-16" "1930-08-16" "1930-09-16" "1930-10-16"
##  [971] "1930-11-16" "1930-12-16" "1931-01-16" "1931-02-15" "1931-03-16"
##  [976] "1931-04-16" "1931-05-16" "1931-06-16" "1931-07-16" "1931-08-16"
##  [981] "1931-09-16" "1931-10-16" "1931-11-16" "1931-12-16" "1932-01-16"
##  [986] "1932-02-15" "1932-03-16" "1932-04-16" "1932-05-16" "1932-06-16"
##  [991] "1932-07-16" "1932-08-16" "1932-09-16" "1932-10-16" "1932-11-16"
##  [996] "1932-12-16" "1933-01-16" "1933-02-15" "1933-03-16" "1933-04-16"
## [1001] "1933-05-16" "1933-06-16" "1933-07-16" "1933-08-16" "1933-09-16"
## [1006] "1933-10-16" "1933-11-16" "1933-12-16" "1934-01-16" "1934-02-15"
## [1011] "1934-03-16" "1934-04-16" "1934-05-16" "1934-06-16" "1934-07-16"
## [1016] "1934-08-16" "1934-09-16" "1934-10-16" "1934-11-16" "1934-12-16"
## [1021] "1935-01-16" "1935-02-15" "1935-03-16" "1935-04-16" "1935-05-16"
## [1026] "1935-06-16" "1935-07-16" "1935-08-16" "1935-09-16" "1935-10-16"
## [1031] "1935-11-16" "1935-12-16" "1936-01-16" "1936-02-15" "1936-03-16"
## [1036] "1936-04-16" "1936-05-16" "1936-06-16" "1936-07-16" "1936-08-16"
## [1041] "1936-09-16" "1936-10-16" "1936-11-16" "1936-12-16" "1937-01-16"
## [1046] "1937-02-15" "1937-03-16" "1937-04-16" "1937-05-16" "1937-06-16"
## [1051] "1937-07-16" "1937-08-16" "1937-09-16" "1937-10-16" "1937-11-16"
## [1056] "1937-12-16" "1938-01-16" "1938-02-15" "1938-03-16" "1938-04-16"
## [1061] "1938-05-16" "1938-06-16" "1938-07-16" "1938-08-16" "1938-09-16"
## [1066] "1938-10-16" "1938-11-16" "1938-12-16" "1939-01-16" "1939-02-15"
## [1071] "1939-03-16" "1939-04-16" "1939-05-16" "1939-06-16" "1939-07-16"
## [1076] "1939-08-16" "1939-09-16" "1939-10-16" "1939-11-16" "1939-12-16"
## [1081] "1940-01-16" "1940-02-15" "1940-03-16" "1940-04-16" "1940-05-16"
## [1086] "1940-06-16" "1940-07-16" "1940-08-16" "1940-09-16" "1940-10-16"
## [1091] "1940-11-16" "1940-12-16" "1941-01-16" "1941-02-15" "1941-03-16"
## [1096] "1941-04-16" "1941-05-16" "1941-06-16" "1941-07-16" "1941-08-16"
## [1101] "1941-09-16" "1941-10-16" "1941-11-16" "1941-12-16" "1942-01-16"
## [1106] "1942-02-15" "1942-03-16" "1942-04-16" "1942-05-16" "1942-06-16"
## [1111] "1942-07-16" "1942-08-16" "1942-09-16" "1942-10-16" "1942-11-16"
## [1116] "1942-12-16" "1943-01-16" "1943-02-15" "1943-03-16" "1943-04-16"
## [1121] "1943-05-16" "1943-06-16" "1943-07-16" "1943-08-16" "1943-09-16"
## [1126] "1943-10-16" "1943-11-16" "1943-12-16" "1944-01-16" "1944-02-15"
## [1131] "1944-03-16" "1944-04-16" "1944-05-16" "1944-06-16" "1944-07-16"
## [1136] "1944-08-16" "1944-09-16" "1944-10-16" "1944-11-16" "1944-12-16"
## [1141] "1945-01-16" "1945-02-15" "1945-03-16" "1945-04-16" "1945-05-16"
## [1146] "1945-06-16" "1945-07-16" "1945-08-16" "1945-09-16" "1945-10-16"
## [1151] "1945-11-16" "1945-12-16" "1946-01-16" "1946-02-15" "1946-03-16"
## [1156] "1946-04-16" "1946-05-16" "1946-06-16" "1946-07-16" "1946-08-16"
## [1161] "1946-09-16" "1946-10-16" "1946-11-16" "1946-12-16" "1947-01-16"
## [1166] "1947-02-15" "1947-03-16" "1947-04-16" "1947-05-16" "1947-06-16"
## [1171] "1947-07-16" "1947-08-16" "1947-09-16" "1947-10-16" "1947-11-16"
## [1176] "1947-12-16" "1948-01-16" "1948-02-15" "1948-03-16" "1948-04-16"
## [1181] "1948-05-16" "1948-06-16" "1948-07-16" "1948-08-16" "1948-09-16"
## [1186] "1948-10-16" "1948-11-16" "1948-12-16" "1949-01-16" "1949-02-15"
## [1191] "1949-03-16" "1949-04-16" "1949-05-16" "1949-06-16" "1949-07-16"
## [1196] "1949-08-16" "1949-09-16" "1949-10-16" "1949-11-16" "1949-12-16"
## [1201] "1950-01-16" "1950-02-15" "1950-03-16" "1950-04-16" "1950-05-16"
## [1206] "1950-06-16" "1950-07-16" "1950-08-16" "1950-09-16" "1950-10-16"
## [1211] "1950-11-16" "1950-12-16" "1951-01-16" "1951-02-15" "1951-03-16"
## [1216] "1951-04-16" "1951-05-16" "1951-06-16" "1951-07-16" "1951-08-16"
## [1221] "1951-09-16" "1951-10-16" "1951-11-16" "1951-12-16" "1952-01-16"
## [1226] "1952-02-15" "1952-03-16" "1952-04-16" "1952-05-16" "1952-06-16"
## [1231] "1952-07-16" "1952-08-16" "1952-09-16" "1952-10-16" "1952-11-16"
## [1236] "1952-12-16" "1953-01-16" "1953-02-15" "1953-03-16" "1953-04-16"
## [1241] "1953-05-16" "1953-06-16" "1953-07-16" "1953-08-16" "1953-09-16"
## [1246] "1953-10-16" "1953-11-16" "1953-12-16" "1954-01-16" "1954-02-15"
## [1251] "1954-03-16" "1954-04-16" "1954-05-16" "1954-06-16" "1954-07-16"
## [1256] "1954-08-16" "1954-09-16" "1954-10-16" "1954-11-16" "1954-12-16"
## [1261] "1955-01-16" "1955-02-15" "1955-03-16" "1955-04-16" "1955-05-16"
## [1266] "1955-06-16" "1955-07-16" "1955-08-16" "1955-09-16" "1955-10-16"
## [1271] "1955-11-16" "1955-12-16" "1956-01-16" "1956-02-15" "1956-03-16"
## [1276] "1956-04-16" "1956-05-16" "1956-06-16" "1956-07-16" "1956-08-16"
## [1281] "1956-09-16" "1956-10-16" "1956-11-16" "1956-12-16" "1957-01-16"
## [1286] "1957-02-15" "1957-03-16" "1957-04-16" "1957-05-16" "1957-06-16"
## [1291] "1957-07-16" "1957-08-16" "1957-09-16" "1957-10-16" "1957-11-16"
## [1296] "1957-12-16" "1958-01-16" "1958-02-15" "1958-03-16" "1958-04-16"
## [1301] "1958-05-16" "1958-06-16" "1958-07-16" "1958-08-16" "1958-09-16"
## [1306] "1958-10-16" "1958-11-16" "1958-12-16" "1959-01-16" "1959-02-15"
## [1311] "1959-03-16" "1959-04-16" "1959-05-16" "1959-06-16" "1959-07-16"
## [1316] "1959-08-16" "1959-09-16" "1959-10-16" "1959-11-16" "1959-12-16"
## [1321] "1960-01-16" "1960-02-15" "1960-03-16" "1960-04-16" "1960-05-16"
## [1326] "1960-06-16" "1960-07-16" "1960-08-16" "1960-09-16" "1960-10-16"
## [1331] "1960-11-16" "1960-12-16" "1961-01-16" "1961-02-15" "1961-03-16"
## [1336] "1961-04-16" "1961-05-16" "1961-06-16" "1961-07-16" "1961-08-16"
## [1341] "1961-09-16" "1961-10-16" "1961-11-16" "1961-12-16" "1962-01-16"
## [1346] "1962-02-15" "1962-03-16" "1962-04-16" "1962-05-16" "1962-06-16"
## [1351] "1962-07-16" "1962-08-16" "1962-09-16" "1962-10-16" "1962-11-16"
## [1356] "1962-12-16" "1963-01-16" "1963-02-15" "1963-03-16" "1963-04-16"
## [1361] "1963-05-16" "1963-06-16" "1963-07-16" "1963-08-16" "1963-09-16"
## [1366] "1963-10-16" "1963-11-16" "1963-12-16" "1964-01-16" "1964-02-15"
## [1371] "1964-03-16" "1964-04-16" "1964-05-16" "1964-06-16" "1964-07-16"
## [1376] "1964-08-16" "1964-09-16" "1964-10-16" "1964-11-16" "1964-12-16"
## [1381] "1965-01-16" "1965-02-15" "1965-03-16" "1965-04-16" "1965-05-16"
## [1386] "1965-06-16" "1965-07-16" "1965-08-16" "1965-09-16" "1965-10-16"
## [1391] "1965-11-16" "1965-12-16" "1966-01-16" "1966-02-15" "1966-03-16"
## [1396] "1966-04-16" "1966-05-16" "1966-06-16" "1966-07-16" "1966-08-16"
## [1401] "1966-09-16" "1966-10-16" "1966-11-16" "1966-12-16" "1967-01-16"
## [1406] "1967-02-15" "1967-03-16" "1967-04-16" "1967-05-16" "1967-06-16"
## [1411] "1967-07-16" "1967-08-16" "1967-09-16" "1967-10-16" "1967-11-16"
## [1416] "1967-12-16" "1968-01-16" "1968-02-15" "1968-03-16" "1968-04-16"
## [1421] "1968-05-16" "1968-06-16" "1968-07-16" "1968-08-16" "1968-09-16"
## [1426] "1968-10-16" "1968-11-16" "1968-12-16" "1969-01-16" "1969-02-15"
## [1431] "1969-03-16" "1969-04-16" "1969-05-16" "1969-06-16" "1969-07-16"
## [1436] "1969-08-16" "1969-09-16" "1969-10-16" "1969-11-16" "1969-12-16"
## [1441] "1970-01-16" "1970-02-15" "1970-03-16" "1970-04-16" "1970-05-16"
## [1446] "1970-06-16" "1970-07-16" "1970-08-16" "1970-09-16" "1970-10-16"
## [1451] "1970-11-16" "1970-12-16" "1971-01-16" "1971-02-15" "1971-03-16"
## [1456] "1971-04-16" "1971-05-16" "1971-06-16" "1971-07-16" "1971-08-16"
## [1461] "1971-09-16" "1971-10-16" "1971-11-16" "1971-12-16" "1972-01-16"
## [1466] "1972-02-15" "1972-03-16" "1972-04-16" "1972-05-16" "1972-06-16"
## [1471] "1972-07-16" "1972-08-16" "1972-09-16" "1972-10-16" "1972-11-16"
## [1476] "1972-12-16" "1973-01-16" "1973-02-15" "1973-03-16" "1973-04-16"
## [1481] "1973-05-16" "1973-06-16" "1973-07-16" "1973-08-16" "1973-09-16"
## [1486] "1973-10-16" "1973-11-16" "1973-12-16" "1974-01-16" "1974-02-15"
## [1491] "1974-03-16" "1974-04-16" "1974-05-16" "1974-06-16" "1974-07-16"
## [1496] "1974-08-16" "1974-09-16" "1974-10-16" "1974-11-16" "1974-12-16"
## [1501] "1975-01-16" "1975-02-15" "1975-03-16" "1975-04-16" "1975-05-16"
## [1506] "1975-06-16" "1975-07-16" "1975-08-16" "1975-09-16" "1975-10-16"
## [1511] "1975-11-16" "1975-12-16" "1976-01-16" "1976-02-15" "1976-03-16"
## [1516] "1976-04-16" "1976-05-16" "1976-06-16" "1976-07-16" "1976-08-16"
## [1521] "1976-09-16" "1976-10-16" "1976-11-16" "1976-12-16" "1977-01-16"
## [1526] "1977-02-15" "1977-03-16" "1977-04-16" "1977-05-16" "1977-06-16"
## [1531] "1977-07-16" "1977-08-16" "1977-09-16" "1977-10-16" "1977-11-16"
## [1536] "1977-12-16" "1978-01-16" "1978-02-15" "1978-03-16" "1978-04-16"
## [1541] "1978-05-16" "1978-06-16" "1978-07-16" "1978-08-16" "1978-09-16"
## [1546] "1978-10-16" "1978-11-16" "1978-12-16" "1979-01-16" "1979-02-15"
## [1551] "1979-03-16" "1979-04-16" "1979-05-16" "1979-06-16" "1979-07-16"
## [1556] "1979-08-16" "1979-09-16" "1979-10-16" "1979-11-16" "1979-12-16"
## [1561] "1980-01-16" "1980-02-15" "1980-03-16" "1980-04-16" "1980-05-16"
## [1566] "1980-06-16" "1980-07-16" "1980-08-16" "1980-09-16" "1980-10-16"
## [1571] "1980-11-16" "1980-12-16" "1981-01-16" "1981-02-15" "1981-03-16"
## [1576] "1981-04-16" "1981-05-16" "1981-06-16" "1981-07-16" "1981-08-16"
## [1581] "1981-09-16" "1981-10-16" "1981-11-16" "1981-12-16" "1982-01-16"
## [1586] "1982-02-15" "1982-03-16" "1982-04-16" "1982-05-16" "1982-06-16"
## [1591] "1982-07-16" "1982-08-16" "1982-09-16" "1982-10-16" "1982-11-16"
## [1596] "1982-12-16" "1983-01-16" "1983-02-15" "1983-03-16" "1983-04-16"
## [1601] "1983-05-16" "1983-06-16" "1983-07-16" "1983-08-16" "1983-09-16"
## [1606] "1983-10-16" "1983-11-16" "1983-12-16" "1984-01-16" "1984-02-15"
## [1611] "1984-03-16" "1984-04-16" "1984-05-16" "1984-06-16" "1984-07-16"
## [1616] "1984-08-16" "1984-09-16" "1984-10-16" "1984-11-16" "1984-12-16"
## [1621] "1985-01-16" "1985-02-15" "1985-03-16" "1985-04-16" "1985-05-16"
## [1626] "1985-06-16" "1985-07-16" "1985-08-16" "1985-09-16" "1985-10-16"
## [1631] "1985-11-16" "1985-12-16" "1986-01-16" "1986-02-15" "1986-03-16"
## [1636] "1986-04-16" "1986-05-16" "1986-06-16" "1986-07-16" "1986-08-16"
## [1641] "1986-09-16" "1986-10-16" "1986-11-16" "1986-12-16" "1987-01-16"
## [1646] "1987-02-15" "1987-03-16" "1987-04-16" "1987-05-16" "1987-06-16"
## [1651] "1987-07-16" "1987-08-16" "1987-09-16" "1987-10-16" "1987-11-16"
## [1656] "1987-12-16" "1988-01-16" "1988-02-15" "1988-03-16" "1988-04-16"
## [1661] "1988-05-16" "1988-06-16" "1988-07-16" "1988-08-16" "1988-09-16"
## [1666] "1988-10-16" "1988-11-16" "1988-12-16" "1989-01-16" "1989-02-15"
## [1671] "1989-03-16" "1989-04-16" "1989-05-16" "1989-06-16" "1989-07-16"
## [1676] "1989-08-16" "1989-09-16" "1989-10-16" "1989-11-16" "1989-12-16"
## [1681] "1990-01-16" "1990-02-15" "1990-03-16" "1990-04-16" "1990-05-16"
## [1686] "1990-06-16" "1990-07-16" "1990-08-16" "1990-09-16" "1990-10-16"
## [1691] "1990-11-16" "1990-12-16" "1991-01-16" "1991-02-15" "1991-03-16"
## [1696] "1991-04-16" "1991-05-16" "1991-06-16" "1991-07-16" "1991-08-16"
## [1701] "1991-09-16" "1991-10-16" "1991-11-16" "1991-12-16" "1992-01-16"
## [1706] "1992-02-15" "1992-03-16" "1992-04-16" "1992-05-16" "1992-06-16"
## [1711] "1992-07-16" "1992-08-16" "1992-09-16" "1992-10-16" "1992-11-16"
## [1716] "1992-12-16" "1993-01-16" "1993-02-15" "1993-03-16" "1993-04-16"
## [1721] "1993-05-16" "1993-06-16" "1993-07-16" "1993-08-16" "1993-09-16"
## [1726] "1993-10-16" "1993-11-16" "1993-12-16" "1994-01-16" "1994-02-15"
## [1731] "1994-03-16" "1994-04-16" "1994-05-16" "1994-06-16" "1994-07-16"
## [1736] "1994-08-16" "1994-09-16" "1994-10-16" "1994-11-16" "1994-12-16"
## [1741] "1995-01-16" "1995-02-15" "1995-03-16" "1995-04-16" "1995-05-16"
## [1746] "1995-06-16" "1995-07-16" "1995-08-16" "1995-09-16" "1995-10-16"
## [1751] "1995-11-16" "1995-12-16" "1996-01-16" "1996-02-15" "1996-03-16"
## [1756] "1996-04-16" "1996-05-16" "1996-06-16" "1996-07-16" "1996-08-16"
## [1761] "1996-09-16" "1996-10-16" "1996-11-16" "1996-12-16" "1997-01-16"
## [1766] "1997-02-15" "1997-03-16" "1997-04-16" "1997-05-16" "1997-06-16"
## [1771] "1997-07-16" "1997-08-16" "1997-09-16" "1997-10-16" "1997-11-16"
## [1776] "1997-12-16" "1998-01-16" "1998-02-15" "1998-03-16" "1998-04-16"
## [1781] "1998-05-16" "1998-06-16" "1998-07-16" "1998-08-16" "1998-09-16"
## [1786] "1998-10-16" "1998-11-16" "1998-12-16" "1999-01-16" "1999-02-15"
## [1791] "1999-03-16" "1999-04-16" "1999-05-16" "1999-06-16" "1999-07-16"
## [1796] "1999-08-16" "1999-09-16" "1999-10-16" "1999-11-16" "1999-12-16"
## [1801] "2000-01-16" "2000-02-15" "2000-03-16" "2000-04-16" "2000-05-16"
## [1806] "2000-06-16" "2000-07-16" "2000-08-16" "2000-09-16" "2000-10-16"
## [1811] "2000-11-16" "2000-12-16" "2001-01-16" "2001-02-15" "2001-03-16"
## [1816] "2001-04-16" "2001-05-16" "2001-06-16" "2001-07-16" "2001-08-16"
## [1821] "2001-09-16" "2001-10-16" "2001-11-16" "2001-12-16" "2002-01-16"
## [1826] "2002-02-15" "2002-03-16" "2002-04-16" "2002-05-16" "2002-06-16"
## [1831] "2002-07-16" "2002-08-16" "2002-09-16" "2002-10-16" "2002-11-16"
## [1836] "2002-12-16" "2003-01-16" "2003-02-15" "2003-03-16" "2003-04-16"
## [1841] "2003-05-16" "2003-06-16" "2003-07-16" "2003-08-16" "2003-09-16"
## [1846] "2003-10-16" "2003-11-16" "2003-12-16" "2004-01-16" "2004-02-15"
## [1851] "2004-03-16" "2004-04-16" "2004-05-16" "2004-06-16" "2004-07-16"
## [1856] "2004-08-16" "2004-09-16" "2004-10-16" "2004-11-16" "2004-12-16"
## [1861] "2005-01-16" "2005-02-15" "2005-03-16" "2005-04-16" "2005-05-16"
## [1866] "2005-06-16" "2005-07-16" "2005-08-16" "2005-09-16" "2005-10-16"
## [1871] "2005-11-16" "2005-12-16" "2006-01-16" "2006-02-15" "2006-03-16"
## [1876] "2006-04-16" "2006-05-16" "2006-06-16" "2006-07-16" "2006-08-16"
## [1881] "2006-09-16" "2006-10-16" "2006-11-16" "2006-12-16" "2007-01-16"
## [1886] "2007-02-15" "2007-03-16" "2007-04-16" "2007-05-16" "2007-06-16"
## [1891] "2007-07-16" "2007-08-16" "2007-09-16" "2007-10-16" "2007-11-16"
## [1896] "2007-12-16" "2008-01-16" "2008-02-15" "2008-03-16" "2008-04-16"
## [1901] "2008-05-16" "2008-06-16" "2008-07-16" "2008-08-16" "2008-09-16"
## [1906] "2008-10-16" "2008-11-16" "2008-12-16" "2009-01-16" "2009-02-15"
## [1911] "2009-03-16" "2009-04-16" "2009-05-16" "2009-06-16" "2009-07-16"
## [1916] "2009-08-16" "2009-09-16" "2009-10-16" "2009-11-16" "2009-12-16"
## [1921] "2010-01-16" "2010-02-15" "2010-03-16" "2010-04-16" "2010-05-16"
## [1926] "2010-06-16" "2010-07-16" "2010-08-16" "2010-09-16" "2010-10-16"
## [1931] "2010-11-16" "2010-12-16" "2011-01-16" "2011-02-15" "2011-03-16"
## [1936] "2011-04-16" "2011-05-16" "2011-06-16" "2011-07-16" "2011-08-16"
## [1941] "2011-09-16" "2011-10-16" "2011-11-16" "2011-12-16" "2012-01-16"
## [1946] "2012-02-15" "2012-03-16" "2012-04-16" "2012-05-16" "2012-06-16"
## [1951] "2012-07-16" "2012-08-16" "2012-09-16" "2012-10-16" "2012-11-16"
## [1956] "2012-12-16" "2013-01-16" "2013-02-15" "2013-03-16" "2013-04-16"
## [1961] "2013-05-16" "2013-06-16" "2013-07-16" "2013-08-16" "2013-09-16"
## [1966] "2013-10-16" "2013-11-16" "2013-12-16" "2014-01-16" "2014-02-15"
## [1971] "2014-03-16" "2014-04-16" "2014-05-16" "2014-06-16" "2014-07-16"
## [1976] "2014-08-16" "2014-09-16" "2014-10-16" "2014-11-16" "2014-12-16"
## [1981] "2015-01-16" "2015-02-15" "2015-03-16" "2015-04-16" "2015-05-16"
## [1986] "2015-06-16" "2015-07-16" "2015-08-16" "2015-09-16" "2015-10-16"
## [1991] "2015-11-16" "2015-12-16" "2016-01-16" "2016-02-15" "2016-03-16"
## [1996] "2016-04-16" "2016-05-16" "2016-06-16" "2016-07-16" "2016-08-16"
## [2001] "2016-09-16" "2016-10-16" "2016-11-16" "2016-12-16" "2017-01-16"
## [2006] "2017-02-15" "2017-03-16" "2017-04-16" "2017-05-16" "2017-06-16"
## [2011] "2017-07-16" "2017-08-16" "2017-09-16" "2017-10-16"
date [1850:1933]
##  [1] "2004-02-15" "2004-03-16" "2004-04-16" "2004-05-16" "2004-06-16"
##  [6] "2004-07-16" "2004-08-16" "2004-09-16" "2004-10-16" "2004-11-16"
## [11] "2004-12-16" "2005-01-16" "2005-02-15" "2005-03-16" "2005-04-16"
## [16] "2005-05-16" "2005-06-16" "2005-07-16" "2005-08-16" "2005-09-16"
## [21] "2005-10-16" "2005-11-16" "2005-12-16" "2006-01-16" "2006-02-15"
## [26] "2006-03-16" "2006-04-16" "2006-05-16" "2006-06-16" "2006-07-16"
## [31] "2006-08-16" "2006-09-16" "2006-10-16" "2006-11-16" "2006-12-16"
## [36] "2007-01-16" "2007-02-15" "2007-03-16" "2007-04-16" "2007-05-16"
## [41] "2007-06-16" "2007-07-16" "2007-08-16" "2007-09-16" "2007-10-16"
## [46] "2007-11-16" "2007-12-16" "2008-01-16" "2008-02-15" "2008-03-16"
## [51] "2008-04-16" "2008-05-16" "2008-06-16" "2008-07-16" "2008-08-16"
## [56] "2008-09-16" "2008-10-16" "2008-11-16" "2008-12-16" "2009-01-16"
## [61] "2009-02-15" "2009-03-16" "2009-04-16" "2009-05-16" "2009-06-16"
## [66] "2009-07-16" "2009-08-16" "2009-09-16" "2009-10-16" "2009-11-16"
## [71] "2009-12-16" "2010-01-16" "2010-02-15" "2010-03-16" "2010-04-16"
## [76] "2010-05-16" "2010-06-16" "2010-07-16" "2010-08-16" "2010-09-16"
## [81] "2010-10-16" "2010-11-16" "2010-12-16" "2011-01-16"
year_index <- which(date=="1897-07-16")
mapmat= tobs[,,year_index];
int=seq(-6,6,length.out = 11); 
colors <- rev(brewer.pal(10, "RdYlBu"))
rgb.palette <- colorRampPalette(colors)
filled.contour(lon, lat, mapmat, color.palette=rgb.palette, levels=int,
               plot.title=title(main=paste0('HadCRUT Anom. in ', date[year_index]),
                                xlab="Latitude",ylab="Longitude", cex.lab=1.5),
               plot.axes={axis(1, cex.axis=1.5);
                 axis(2, cex.axis=1.5);
                 map('world', add=TRUE);
                 grid()},
               key.title=title(main="[oC]"),
               key.axes={axis(4, cex.axis=1.5)})

date [2000:2014]
##  [1] "2016-08-16" "2016-09-16" "2016-10-16" "2016-11-16" "2016-12-16"
##  [6] "2017-01-16" "2017-02-15" "2017-03-16" "2017-04-16" "2017-05-16"
## [11] "2017-06-16" "2017-07-16" "2017-08-16" "2017-09-16" "2017-10-16"
year_index <- which(date=="2017-07-16")
mapmat= tobs[,,year_index];
int=seq(-6,6,length.out = 11); 
colors <- rev(brewer.pal(10, "RdYlBu"))
rgb.palette <- colorRampPalette(colors)
filled.contour(lon, lat, mapmat, color.palette=rgb.palette, levels=int,
               plot.title=title(main=paste0('HadCRUT Anom. in ', date[year_index]),
                                xlab="Latitude",ylab="Longitude", cex.lab=1.5),
               plot.axes={axis(1, cex.axis=1.5);
                 axis(2, cex.axis=1.5);
                 map('world', add=TRUE);
                 grid()},
               key.title=title(main="[oC]"),
               key.axes={axis(4, cex.axis=1.5)})

There are plenty of commands there, the main things you might want to play with are the main [title], xlab, ylab, and int [defined above]

We will use annual averages

allyears <- format(as.Date(date, format="%Y-%m-%d"),"%Y") # this produces a year for each timestamp i.e. 12 1850s, 12 1851s etc..
years <- unique(allyears) # this extracts the unique year i.e. 1850, 1851, 1852,...

We ae going to loop through each year and average the monthly values together Functions used: mean, creates an average, e.g. mean(c(1,2,3)) = 2 Apply, useful when working on arrays to tell R what dimension to average over For, for loops are fundamental in programming, e.g. for (i in 1:10) {cat(i,‘’)} will print the value of i to the screen Pre allocate a blank array, filling with NA, this is for speed and is good practice

tann <- array(NA,c(dim(tobs)[1:2],length(years))) 
for (i in 1:length(years)){
  tann[,,i]<-apply(tobs[,,allyears==years[i]],c(1,2),mean,na.rm=TRUE)
}

dim(tann) # [1] 72 36 168 - the lengths correspond to lat (36), long (72) and years (168)
## [1]  72  36 168

4. Creating a global mean surface temperature timeseries

4a. Ignorant averaging

Dimensions of tann are long x lat x year To get a zonal average want to average so that the output is lat x year To get a meridional avarage, want output to be lon x year

merid_means<-apply(tann,c(1,3),mean,na.rm=TRUE)
mean_merid_means <- apply(merid_means,2,mean,na.rm=TRUE)

TO DO: calculate the mean of the zonal means

zonal_means<-apply(tann,c(2,3),mean,na.rm=TRUE)
mean_zonal_means <- apply(zonal_means,2,mean,na.rm=TRUE)

plot(mean_zonal_means,
     type = "l",
     col = "red",
     lwd = 3,
     xlab = "Years",
     ylab = "T anomaly",
     main = "Mean of the zonal means")

legend("topleft", col='dark green', lwd = 1,
       legend="Mean of Zonal Means")

Note that apply(a_martrix,2,mean) is equivalent to colMeans(a_matrix)

TO DO. plot the GIS GMST, the mean of the meridional means, and mean of zonal means on one plot

plot(gmst, type = "l", col = "red", xlab = "Years", ylab = "T anomaly")
lines(years, mean_zonal_means, type="l", col = "dark green")
lines(years, mean_merid_means, type="l", col = "blue")

legend("topleft",legend = c("GIS TEMP","Mean of Zonal Means","Mean of the Meridional Means"),col =c("red","dark green","blue"),lty=1,lwd = 1,bty="n")

# TO DO: plot the zonal and meridional means as differences relative to the GIS temp # get on same timestamp, gis runs from 1880 to 2017; hadcrut from 1850 to 2017

merid_diff <- gmst$t - mean_merid_means [31:168]
zonal_diff <- gmst$t - mean_zonal_means [31:168]


plot(years [31:168], merid_diff, type = "l", col = "dark green", main = "GMST", xlab = "Years", ylab = "Temp Anomaly", ylim = c(-0.2, 0.4))
lines(years [31:168], zonal_diff, type = "l", col = "blue") #The meridional average is closer to the GIS GMST estimate

legend("topleft",legend = c("Mean of Zonal Means Anom","Mean of the Meridional Means Anom"),col =c("Blue","Dark Green"),lty=1,lwd = 1,bty="n")

4b. Area weighted averaging

We will calculate a cosine weighted average

w<-replicate(length(years),t(replicate(length(lon),cos(lat*pi/180))))

Test with an array of ones i.e. the answer should be 1 gmst_weighted_merid <- apply(array(1,dim(tann))w,c(1,3),sum,na.rm=TRUE)/sum(cos(latpi/180))

gmst_weighted_merid <- apply(tann*w,c(1,3),sum,na.rm=TRUE)/sum(cos(lat*pi/180))
gmst_weighted <- apply(gmst_weighted_merid,2,mean,na.rm=TRUE)