Greenland sunset

Welcome!

I am a physical oceanographer interested in how ocean water is mixed and transformed. I am a Research Scientist at the Bedford Institute of Oceanography in Halifax, Nova Scotia.

Recent Posts:

Recording and replaying plots with the `recordPlot()` function 2017-12-11 This post is not going to focus on anything oceanographic, but on a little trick that I just learned about using base graphics in R – the recordPlot() function. R plot systems First, for those who either don’t use R or who have been living under a rock, there are (in my opinion) two major paradigms for producing plots from data in R. The first is the original “base graphics” system – the sequence of functions bundled with R that are part of the graphics package which is installed and loaded by default. ...
Bootstrapping uncertainties with the boot package 2017-10-25 People often ask me what I like about R compared to other popular numerical analysis software commonly used in the oceanographic sciences (coughMatlabcough). Usually the first thing I say is the package system (including the strict rules for package design and documentation), and how easy it is to take advantage of work that others have contributed in a consistent and reproducible way. The second is usually about how the well-integrated the statistics and the statistical methods are in the various techniques. ...
Predicting tides in R 2017-04-14 This entry is actually a re-post of a great blog I found written by Marcus Beck. It was such a great summary of the tidal analysis capabilities built in to the oce package, that I thought it would make a great addition to the (growing) library of posts here. The original post can be found here, but I’ve reproduced the Rmarkdown in its entirety here with Marcus’ permission (with a few minor format tweaks). ...
Adding NOAA bottom profile to section plots 2017-04-01 I use the section-class plotting method in the oce package a lot. It’s one of the examples I really like showing to new oceanographic users of R and oce, to see the power in making quick plots from potentially very complicated data sets. A canonical example is to use the built-in data(section) dataset: library(oce) data(section) plot(section, which='temperature') Note the grey bottom profile that is automatically overlaid on the plot – the values for those points come from the individual stations in the section object, from the waterDepth metadata item in each of the stations in the section. ...
A Plain Markdown Post 2016-12-30 This is a post written in plain Markdown (*.md) instead of R Markdown (*.Rmd). The major differences are: You cannot run any R code in a plain Markdown document, whereas in an R Markdown document, you can embed R code chunks (```{r}); A plain Markdown post is rendered through Blackfriday, and an R Markdown document is compiled by rmarkdown and Pandoc. There are many differences in syntax between Blackfriday’s Markdown and Pandoc’s Markdown. ...
A Makefile for knitr documents 2016-07-05 One of the best things I’ve found about using R for all my scientific work is powerful and easy to use facilities for generating dynamic reports, particularly using the knitr package. The seamless integration of text, code, and the resulting figures (or tables) is a major step toward fully-reproducible research, and I’ve even found that it’s a great way of doing “exploratory” work that allows me to keep my own notes and code contained in the same document. ...
Making section plots with oce and `imagep()` 2016-04-25 section objects in the oce package are a convenient way of storing a series of CTD casts together – indeed, the object name derives from the common name for such a series of casts collected from a ship during a single campaign. In it’s heart, a section object is really just a collection of ctd objects, with some other metadata. The CTD stations themselves are stored as a list of ctd objects in the @data slot, like: ...
Using the oce colormap function in R 2016-04-09 When I talk to fellow colleagues about why I use R as my language of choice for scientific data analysis, I typically point out all the advantages, and because I’m honest, the disadvantages. Typically the biggest disadvantage, especially for those coming from the java-GUI world of Matlab, is the non-interactive graphics. Now, I’ve managed to convince myself that I actually prefer making plots this way (because it forces me to script rather than noodling around with a mouse, the final plot is predictable, etc), but there are always a few things that I wish were easier. ...
Calculating buoyancy frequency for argo/section objects using the apply() family 2016-02-29 The most recent CRAN release of oce includes some nice new functionality for reading and converting argo objects (see http://www.argo.ucsd.edu/ for more information about the fantastic Argo float program). One question that arose out of this increased functionality was how to calculate \(N^2\) (also known as the buoyancy or Brunt-Väisälä frequency) for such objects. Buoyancy frequency The definition of $N^2 $ is: \[ N^2 = \frac{-g}{\rho} \frac{\partial \rho}{\partial z} \] ...
A Valentine's day map 2016-02-14 In the spirit of Valentine’s day, I made a map that uses the beautifully weird bonne projection. The code uses the proj4 facilities in the oce package. library(oce) data(coastlineWorld) msg <- "HAPPY VALENTINES DAY!" msgtop <- "You mean the WORLD to me" msglon <- 130 msglat <- -30 par(mar=c(1,1,1,1)) mapPlot(coastlineWorld, col='pink', proj='+proj=bonne +lat_1=85', xlim=c(-13700000, 13700000), ylim=c(-18079625, 8008557)) mapGrid(longitude = c(-180, 180), lwd=4, col=2, latitude=NULL) text(0, 8005400, msgtop, cex=2, font=3) nc <- nchar(msg) lon <- seq(-msglon, msglon, length. ...