Publications by Dan Kelley Blog/R
GMT topography colours (I)
I enjoyed the blog posting by “me nugget”, which I ran across on R-bloggers, and so I decided to try that author’s GMT colourscheme. This revealed some intriguing patterns in the Oce dataset named topoWorld. The following code produces a graph to illustrate. 1. Set up colours as suggested on the “menuggest” blog 1 2 3 4 5 6 7 8 9## te...
779 sym R (851 sym/5 pcs) 2 img 2 tbl
GMT topography colours (II)
This follows an item about GMT colours. In the meantime I have found a website illustrating the colours, and also the definition files for those palettes. The palette in question is named GMT_relief, and it is defined in a file that is as follows. # $Id: GMT_relief.cpt,v 1.1 2001/09/23 23:11:20 pwessel Exp $ # # Colortable for whole earth reli...
781 sym R (1683 sym/3 pcs) 2 img 1 tbl
Spline wiggles (I)
Introduction An interesting paper (Smith and Wessel, 1990) points out a weakness in using splines in cases with data gaps. Their illustration of the problem with isobaths was particularly compelling. I cannot reproduce their Fig 1b here, owing to copyright problems, but I digitized the data so I could test two R functions for splines. Readers ...
1683 sym R (943 sym/10 pcs) 2 img 5 tbl
Spline wiggles (II)
Introduction This follows up on the previous posting, using data provided by Akima (1972). The four panels of the plot produced by the following code compare the original Akima spline formula with an improved version, and three styles of spline() fits. As noted in the code, two spline() methods are useless for general tasks and are ignored her...
2174 sym R (1410 sym/2 pcs) 2 img 1 tbl
Hodograph drawing
Introduction The polar graph known as a hodograph can be useful for vector plots, and also for showing varition within nearly-cyclical time series data. The Oce R package should have a function to create hodographs, but as usual my first step is to start by writing isolated code, testing to find the right match between the function and real-worl...
2009 sym R (2515 sym/6 pcs) 4 img 3 tbl
N2 with runlm()
Introduction The default swN2() calculation in Oce uses a smoothing spline. One disadvantage of this is that few readers will know how it works. A possible alternative is to compute d(rho)/dz using the slope inferred from a running-window linear regression. Such a slope is provided by the new Oce function runlm(), which is tested here. (Note ...
1680 sym R (835 sym/12 pcs) 4 img 5 tbl
oce map projection
Introduction Soon after map projections were added to Oce, bug reports showed that coastline plots in some projections were subject to anomalous lines that run horizontally on the plot. A ad-hoc scheme was code to try to prevent this, but it does not always work. Problems are compounded for filled coastlines. I had thought this was a basic prob...
2028 sym R (589 sym/9 pcs) 4 img 4 tbl
oce runlm function
Introduction As was expected, the runderiv() function has been both useful and deficient. Useful because it offers a good replacement for smooth.spline() calculations of derivatives for things like N^2. And deficient because it only calculated derivatives, not values! Both an extension and a renaming were called for. The result is runlm(). Tes...
1050 sym R (679 sym/7 pcs) 4 img 3 tbl
Valentines-day full moon
Introduction A wise person told me that it will be a full moon on the upcoming Valentine’s Day, but that it will be a long time until another one. I decided to check this with astronomical calculation. Procedure The Oce package has a function called moonAngle() that returns, among other things, the illuminated fraction of the moon visible at a...
1416 sym R (497 sym/8 pcs) 2 img 3 tbl
demodulating time series
This posting shows how one might perform demodulation in R. It is assumed that readers are generally familiar tith the procedure. First, create some fake data, a carrier signal with period 10, modulated over a long timescale, and with phase drifting linearly over time. 1 2 3 4 5 6 7 8 9 10period <- 10 fc <- 1/period fs <- 1 n <- 200 t <...
1445 sym R (1013 sym/8 pcs) 4 img 4 tbl