# Articles by Marc in the box

### Lomb-Scargle periodogram for unevenly sampled time series

January 10, 2013 |

In the natural sciences, it is common to have incomplete or unevenly sampled time series for a given variable. Determining cycles in such series is not directly possible with methods such as Fast Fourier Transform (FFT) and may require some degree o... [Read more...]

### Producing animated GIFs and Videos

January 2, 2013 |

It took me a while to figure out how to use the animation package on my Windows OS. In making an animated GIF, the problem seems to have been quite simple in the end (and I should have been more patient in reading the instructions!) - Following installation of the ... [Read more...]

### Spirograph with R

December 30, 2012 |

Just had to figure out how to replicate this old toy of mine with R! I had no idea how long it's been around:Read more » [Read more...]

### Finding a pin in a haystack – PCA image filtering

December 4, 2012 |

I found the following post regarding the anomalous metal object observed in a Curiosity Rover photo to be fascinating - specifically, the clever ways that some programmers used for filtering the image for the object. The following answer on mathematica.stackexchange.com was especially illuminating for its use of a ... [Read more...]

### DINEOF (Data Interpolating Empirical Orthogonal Functions)

October 30, 2012 |

I finally got around to reproducing the DINEOF method (Beckers and Rixon, 2003) for optimizing EOF analysis on gappy data fields - it is especially useful for remote sensing data where cloud cover can result in large gaps in data. Their paper gives a nice overview of some of the various ... [Read more...]

### Create polygons from a matrix

April 27, 2012 |

The following function matrix.poly allows for the addition of polygons to a plot based on a matrix and defined matrix positions. I have used this function on occasion to highlight specific matrix locations (e.g. in the above figure). You can do the same by overlaying another image (left ... [Read more...]

### Adding a transparent image layer to a plot

April 19, 2012 |

The following example shows how to add a transparent image-type layer to a plot. The add.alpha function (below) simply adds transparency to a vector of colors which is then introduced in the "col" argument of an image plot. Read more » [Read more...]

### Working with Globcolour data

April 2, 2012 |

The Globcolour project (http://www.globcolour.info/) provides relatively easy access to ocean color remote sensing data. Data is provided at http://hermes.acri.fr/and the following parameters are available:· Chlorophyll-a (CHL1 and CHL2)· Fully normalised water leaving radiances at 412, 443, 490, 510, 531, 550-565, 620, 665-670, 681 and 709 nm (Lxxx)· Coloured dissolved and detrital ... [Read more...]

### Add a frame to a map

April 2, 2012 |

Here is a function that adds a frame of alternating colors to a map (un-projected). One defines the extension of each bar (in degrees) and an optional width of the bars (in inches). It uses the "joinPolys" function of the package to trim the bars near the map corners where ... [Read more...]

### Canonical Correlation Analysis for finding patterns in coupled fields

March 25, 2012 |

First CCA pattern of Sea Level Pressure (SLP) and Sea Surface Temperature (SST) monthly anomalies for the region between -180 °W to -70 °W and +30 °N to -30 °S. The following post demonstrates the use of Canonical Correlation Analysis (CCA) for diagnosing coupled patterns in climate fields. The method produces ... [Read more...]

### Exponentiation of a matrix (including pseudoinverse)

March 22, 2012 |

The following function "exp.mat" allows for the exponentiation of a matrix (i.e. calculation of a matrix to a given power). The function follows three steps:1) Singular Value Decomposition (SVD) of the matrix2) Exponentiation of the singular values3) Re-calculation of the matrix with the new singular valuesThe most common ... [Read more...]

### A ridiculous proof of concept: xyz interpolation

March 14, 2012 |

Ridiculous OrbThis is really the last one on this theme for a while... I had alluded to a combination of methods regarding xyz interpolation at the end of my last post and wanted to demonstrate this in a final example.The ridiculousness that you see above involved two interpolation steps. ... [Read more...]

### XYZ geographic data interpolation, part 3

March 12, 2012 |

This will be probably be a final posting on interpolation of xyz data as I believe I have come to some conclusions to my original issues. I show three methods of xyz interpolation:1. The quick and dirty method of interpolating projected xyz points (bi-linear)2. Interpolation using Cartesian coordinates (bi-linear)3. Interpolation ... [Read more...]

### XYZ geographic data interpolation, part 2

February 29, 2012 |

Having recently received a comment on a post regarding geographic xyz data interpolation, I decided to return to my original "xyz.map" function and open it up for easier interpretation. This should make the method easier to adapt and follow.The above graph shows the distance to Mecca as interpolated ... [Read more...]

### Maximal Information Coefficient (MIC)

December 19, 2011 |

Pearson r correlation coefficients for various distributions of paired data (Credit: Denis Boigelot, Wikimedia Commons)A paper published this week in Science outlines a new statistic called the maximal information coefficient (MIC), which is able to equally describe the correlation between paired variables regardless of linear or nonlinear relationship. In ... [Read more...]

### Maximum Covariance Analysis (MCA)

December 13, 2011 |

Maximum Covariance Analysis (MCA) (Mode 1; scaled) of Sea Level Pressure (SLP) and Sea Surface Temperature (SST) monthly anomalies for the region between -180 °W to -70 °W and +30 °N to -30 °S.  MCA coefficients (scaled) are below. The mode represents 94% of the squared covariance fraction (SCF).Maximum Correlation Analysis (MCA) ... [Read more...]

### Another aspect of speeding up loops in R

November 28, 2011 |

Any frequent reader of R-bloggers will have come across several posts concerning the optimization of code - in particular, the avoidance of loops.Here's another aspect of the same issue. If you have experience programming in other languages besides R, this is probably a no-brainer, but for laymen, like myself, ... [Read more...]

### Define intermediate color steps for colorRampPalette

November 24, 2011 |

The following function, color.palette(), is a wrapper for colorRampPalette() and allows some increased flexibility in defining the spacing between main color levels. One defines both the main color levels (as with colorRampPalette) and an optional vector containing the number of color levels that should be put in between at ... [Read more...]

### Empirical Orthogonal Function (EOF) Analysis for gappy data

November 24, 2011 |

The following is a function for the calculation of Empirical Orthogonal Functions (EOF). For those coming from a more biologically-oriented background and are familiar with Principal Component Analysis (PCA), the methods are similar. In the climate sciences the method is usually used for the decomposition of a data field into ... [Read more...]

### Propagation of error

November 11, 2011 |

At the onset, this was strictly an excercise of my own curiosity and I didn't imagine writing this down in any form at all. As someone who has done some modelling work in the past, I'm embarrassed to say that I had never fully grasped how one can gauge the ... [Read more...]
1 2 3