Blog Archives

Colourizing a trajectory

January 15, 2014
By
Colourizing a trajectory

Introduction In Oceanography it can be useful to use colour to display z values along an (x,y) trajectory. For example, CTD data might be displayed in this way, with x being distance along track, y being depth, and z being temperature. This post shows how one might do this. Methods The R code given below demonstrates this with fake data. ...

Read more »

Butterworth filter overshoot

January 15, 2014
By
Butterworth filter overshoot

Introduction Butterworth filters with order other than 1 have an overshoot phenomenon that can be problematic in some cases. For example, if smoothing is used on an estimate of kinetic energy, overshoots might yield negative values that are nonphysical. This post simply illustrates this with made-up data that the reader can experiment with. Methods First, create and plot...

Read more »

Smoothing CTD profiles

January 11, 2014
By
Smoothing CTD profiles

Introduction Smoothing hydrographic profiles with conventional time-series methods is problematic for two reasons: (a) the data are commonly not equi-spaced in depth and (b) the data seldom lack trends in depth. The issues and their solutions are illustrated without much discussion here. The first step in making the graph shown above is to load the oce library and...

Read more »

Inferring halocline depth

January 11, 2014
By
Inferring halocline depth

Introduction There are no agreed-upon methods for inferring halocline depth, but a reasonable method might involve locating the depth at which dS/dp is largest, where S is salinity and p is pressure (Kelley 2014 chapter 5). Calculating the derivative using e.g. diff(S)/diff(p) can be problematic because of sensitivity to noise, especially for data that have not been bin-averaged. Achieving...

Read more »

PISA scores

January 6, 2014
By
PISA scores

The Guardian Newspaper has an interesting article about the Pisa (Program for International Student Assessment) scores for 2012, and it includes data. Since I was interested to see how my own region scored, I downloaded the data into a file called PISA-summary-2012.csv and created a plot summarizing scores in all the sampled regions, with Canada highlighted. Graphical...

Read more »

Installing oce in R

December 30, 2013
By

Several of the blog items have used the oce package. The official version of this can be installed from within R by 1 install.packages("oce") and more up-to-date versions can be installed using the devtools package written by Hadley Wickham, which is itself installed with 1 install.packages("devtools") after which installing the latest development version of oce is accomplished with 1 2 3 library(devtools) install_github('ocedata', 'dankelley', 'master') install_github('oce', 'dankelley', 'develop') Note that the...

Read more »

R interface to WebTide

December 29, 2013
By
R interface to WebTide

A previous posting explained how to install WebTide on an OSX machine. This one shows how to hook up to an installed WebTide database, so that R code can get tidal predictions. The following code in the R language will produce a graph in which the top panel mimics the tidal-elevation graph produced by WebTide itself (see previous blog posting...

Read more »

Sundial calculations

December 28, 2013
By
Sundial calculations

After experimenting with calculations for what I eventually came to realize were analemma-based sundials (with shadow cast by a vertical pole), I remembered that the common sundial has a wedge as the shadow-maker. A bit of research told me that the wedge is called a gnomon. It is a right triangle with one vertex (the centre vertex, shall...

Read more »

Analemma graphs

December 27, 2013
By
Analemma graphs

Continuing on the theme of solar angles, the code given below produces an analemma diagram similar to that of Lynch (2012, figure 2). 1 2 3 4 5 6 7 8 9 10 library(oce) loc <- list(lon=-0.0015, lat=51.4778) # Greenwich Observatory t <- seq.POSIXt(as.POSIXct("2014-01-01 12:00:00", tz="UTC"), as.POSIXct("2015-01-01...

Read more »

A new Oce coastline

December 22, 2013
By
A new Oce coastline

Part 1: coastal applications The oce package has a world coastline file that is visibly crude on a scale suitable for continental-shelf work.  At the cost of about 1 Mbyte of storage, a candidate for a replacement is a 1:10million scale version downloaded from naturalearthdata.com (full link below). As illustrated below with plots near two oceanographic centres, this candidate provides...

Read more »