Blog Archives

Valentines-day full moon

February 13, 2014
By
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 any given...

Read more »

oce runlm function

February 11, 2014
By
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(). Tests Below are the examples from its manpage, with...

Read more »

oce map projection

February 10, 2014
By
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 problem...

Read more »

N2 with runlm()

February 9, 2014
By
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...

Read more »

Hodograph drawing

February 8, 2014
By
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-world...

Read more »

Spline wiggles (II)

February 4, 2014
By
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 here....

Read more »

Spline wiggles (I)

February 3, 2014
By
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 can...

Read more »

GMT topography colours (II)

January 30, 2014
By
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...

Read more »

GMT topography colours (I)

January 30, 2014
By
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 ## test GMT colours as...

Read more »

Vote splitting in Canada

January 25, 2014
By
Vote splitting in Canada

Analysis District-by-district data reveal that if the Bloc Quebecois, Green, Liberal, and NDP parties were to have been united, the Conservative party would have lost the 41st Canadian election by a dramatic measure, instead of winning a majority. The graph given below shows the results by naming the ridings. Clicking on the graph will let you see results riding by...

Read more »