* You are viewing Posts Tagged ‘R-project’

rtide: a R package for predicting tide heights (US locations only currently)

Joe Thorley at Poisson Consulting has released a new R package, rtide, (on which I am listed as a co-author) that provides the ability to predict future (and past) tide heights for 637 different tide stations in the United States and associated territories. The underlying data, consisting of tide harmonic constituents, are collected and released by the National Oceanic and Atmospheric Administration. The author of the definitive open source tide prediction software, XTide, collates those harmonic data into a usable format, and we have harvested the data to create the … Continue Reading

A plot of co-authorships in my little corner of science

author year count image

 
Here’s a mostly useless visualization of the collection of journal articles that sits in my reference database in Endnote. I deal mostly in marine biology, physiology, biomechanics, and climate change papers, with a few molecular/genetics papers thrown in here and there. The database has 3325 entries, 2 of which have ambiguous publication years and aren’t represented above. This is by no means an exhaustive survey of the literature in my field, it’s just an exhaustive survey of the literature on my computer.

To make this figure, I first had Endnote export the database to … Continue Reading

Extracting NOAA sea surface temperatures with ncdf4

I’ve written previously about some example R scripts I created to extract sea surface temperature data from NOAA’s Optimum Interpolated Sea Surface Temperature products. If you want daily global sea surface temperatures on a 0.25×0.25° grid, they gather those into 1-year files available at http://www.esrl.noaa.gov/psd/data/gridded/data.noaa.oisst.v2.highres.html. If you want weekly average SST values on a 1×1° grid, you can get those back to 1981 at http://www.esrl.noaa.gov/psd/data/gridded/data.noaa.oisst.v2.html. If you just want a smaller file for a single day on the 0.25×0.25° grid, you can find those at http://www.ncdc.noaa.gov/sst/griddata.php.

Continue Reading

Make your R figures legible in Powerpoint/Keynote presentations

Having just returned from the SICB 2014 meetings, the appearance of many people’s Powerpoint figures is fresh on my mind. The sheer number of tiny figure labels (tick marks, axis titles, legend text etc) is disappointing. If we want to point fingers, MATLAB users are clearly the worst offenders because of the microscopic default label sizes in that program, but there are plenty of illegible R and matplotlib figures out there as well. Excel is obviously its own special class of terrible, but we will speak of it no more. The default settings in most of these programs … Continue Reading

More tide prediction with R

Edit: There is now a full-fledged R package, rtide, to accomplish the same basic task of generating time series of tide predictions that is outlined here. See this more recent post for information.

In the previous post I outlined how to query the XTide software with R and parse the results into a handy-dandy data frame. The biggest hurdle with that method is getting XTide up and running on your computer. The code outlined here works entirely within R, so you don’t need XTide installed on your computer. The trade-off is that it provides substantially … Continue Reading

Interfacing XTide and R

Edit: There is now a full-fledged R package, rtide, to accomplish the same basic task of generating time series of tide predictions that is outlined here. See this more recent post for information.

XTide is an open-source program that predicts tide heights and current speeds for hundreds of tide and current stations around the United States. It can be used to produce tide predictions in the past and future for a site at your chosen interval (down to the minute), as well as producing sunrise and sunset times, moon phases, and times when the tide level … Continue Reading

Book Review: The R Book, Second Edition (2013)

The first edition of The R Book by Michael J. Crawley was an ambitious work, but managed to be slightly rubbish due to the atrocious typographical layout of the original book. The good news is that the new 2nd edition, released in 2013, has a substantially improved layout that makes the book far more useful as a general reference. This is important, since the book is meant as an accessible reference for non-statisticians to many of the powerful data manipulation and statistical techniques available in R, particularly for biologists and researchers in similar fields. With this new edition you’re no … Continue Reading

Generating polygon boundaries for plotting simple time series data with missing data

Every so often I want to plot some data with pretty upper and lower error bounds, such as temperature data through time, perhaps with the maximum and minimum temperature range or standard error bounds for averaged data. The polygon( ) function can make those sorts of pretty plots. However, I’ll often have chunks of missing data for periods of time, so I have to break up the polygons that go with the plotted data. I could swear I wrote a function to do this several months ago, but it’s lost in a pile of other scripts, so I re-wrote a … Continue Reading

Digitizing data from old plots using ‘digitize’

The June 2011 issue of The R Journal contains an article on the R package digitize (link to pdf) by Timothée Poisot. This might prove to be a handy tool if you occasionally find yourself needing to retrieve data points from figures in old articles for which you don’t have the raw data. There are a number of other stand-alone software tools to accomplish this same task, such as PlotDigitizer, DataThief, or TechDig (good luck finding that last one). These other programs all work, but I use them so rarely … Continue Reading

Extracting sea surface temperatures from NOAA’s OISSTv2

Update, 2015-11-30 It appears that NOAA has gone through and upgraded all of the OISST files to the newer version of the NetCDF file format. As a result, the functions outlined in this post don’t work any longer. Instead, see the updated functions in my newer post, http://lukemiller.org/index.php/2014/11/extracting-noaa-sea-surface-temperatures-with-ncdf4/. The concepts are the same as described here, but the newer functions use the ncdf4 package to access the newer NetCDF file format.

Sea surface temperatures

NOAA’s Physical Sciences Division produces a global map of weekly averaged sea … Continue Reading

Page 1 of 3123