Archive for the ‘R’ Category

Ocean drifters

 

drifterssouthernocean

The map shows tracks of drifting buoys deployed in the southern ocean between 2005 and 2016. The underlying dataset consists of 15-minute gps data collected from 4608 buoys, available from NOAA ftp://ftp.aoml.noaa.gov/pub/phod/buoydata/. Colour indicates speed of drift.

This is simply a visualisation of the raw drifter data with no further analysis or modelling. Nevertheless all of the well-known features of the surface circulation in the southern ocean emerge; Antarctic Circumpolar Drift, western boundary currents along the western coasts of South America (Brazil Current) and Africa (Agulhas),  powerful Agulhas Return Current in the Southern Indian Ocean, South Atlantic gyre (centred NorthEast of the Falkland Islands) etc.

R code

A dataframe buoydata was created using fread(),

transformed to a stereographic coordinates using spTransform()

and plot using geom_path()

Note the use of transparency (alpha). This can be varied to highlight different aspects of the flow.

 

Global weather in a Pierce Quincuncial projection

I recently came across Peirce’s Quincuncial map projection, invented by the philosopher C. S. Peirce in 1879. Pierce projected each hemisphere of a spherical earth on to a square in such a way that lines of longitude and latitude cross at right angles. His projection is not used very much, perhaps because it is absent from standard mapping libraries such as Proj.4. Jason Davies’ elegant tessellated version (below) reproduces Peirce’s original.

pq

 

The Peirce Quincunx (PQ) has nice features for the display of global weather and climate data. Firstly, as a conformal map, it does not distort the shapes of relatively localized objects such as the cyclones present in global weather patterns. The Mercator projection is also conformal, but is notorious for it’s large scale distortion. PQ scale distortion is generally smaller, becoming large only near the four equatorial singular points.

Secondly, PQ is pole-friendly. The poles are special points in the climate system because the jet streams circulate about them. It seems perverse to display climate information using map projections (such as geographic) which are singular at the poles. Other examples of pole-friendly projections include transverse Mercator and oblique cylindrical equal area.

The video shows 850mb PQ wind speed raster maps for October 2015 based on 6-hourly 0.25o resolution gdas data. 1 video second corresponds to two days of weather data.

There is a nice discussion of PQ implementation in R here. To create raster maps, both forward and inverse projections were required. These functions are available in tcl‘s mapproj library and can be called from R. More details later.