Articles by Dan Kelley Blog/R

updating the GISS dataset

November 6, 2015 | Dan Kelley Blog/R

Introduction I was watching a video of David Suzuki being interviewed on Australian TV, and there were some questions about the “pause” in temperature in the GISS dataset. I thought I’d like to check for myself, and reasoned that I may as well update the giss dataset in the ... [Read more...]

trimming CTD files with shiny

October 17, 2015 | Dan Kelley Blog/R

Introduction The shiny library [1] provides a graphical user interface (GUI) for the R language that may open up new possibilities for human judgement in data filtering, as well as for the use of R by those who choose not to learn its syntax. The first category is the intended audience ... [Read more...]

email graphs

August 24, 2015 | Dan Kelley Blog/R

Communication between individuals working on a group project is commonly carried over email, and in-person meetings tend to be preceded by an emailed agenda, and followed by emailed minutes. Projects organized around GitHub or similar systems tend also to have email updates for issue reports, etc. All of this means ... [Read more...]

Comparing World Ocean Atlases 2013 and 2013v2

August 21, 2015 | Dan Kelley Blog/R

Introduction The ocedata package [1] provides data that may be of use to oceanographers, either working with their own R code or working with the oce package [2]. One such dataset, called levitus, holds sea surface temperature and salinity (SST and SSS), based on the 2013 version of the World Ocean Atlas. An ... [Read more...]

ITS-90 temperature scale

May 9, 2015 | Dan Kelley Blog/R

Introduction Recently, oce has been gaining flexibility in terms of conductivities stored in data files. This is necessitated by the fact that RBR files store conductivity in mS/cm, whereas calculations for seawater properties use the unitless conductivity ratio. With the CTD code under examination for this work, it might ... [Read more...]

map projections in oce

April 2, 2015 | Dan Kelley Blog/R

Introduction The latest version (4.9.0) of the PROJ.4 library is being incorporated into the development version of the oce R package. The work is not finalized yet, but I thought it might be useful to share an early version of the test suite, so people could get an idea of the ... [Read more...]

scientific notation for R/latex

March 21, 2015 | Dan Kelley Blog/R

Motivation Using R within a latex document can be a component of reproducible research, offering (a) some assurance against typographical errors in transcribing results to the latex file and (b) the ability for others to reproduce the results. For example, one might like to explain how close the computed integral ... [Read more...]

Solar eclipse

March 19, 2015 | Dan Kelley Blog/R

Introduction Today there was a solar eclipse that was not visible on my side of the Atlantic, but was seen on the European side, either as a partial eclipse, towards the south, or a total one, towards the north [1]. Eclipses being rare and solar power being a new thing, this ... [Read more...]

Assessing mapdata world coastline

January 27, 2015 | Dan Kelley Blog/R

Introduction The mapdata R package contains a coastline called worldHires which is contained within a text file with a bit over 2 million lines. Since the coastlineWorldFine dataset in the ocedata package contains about 0.5 million points, I thought I would explore how much better the mapdata coastline might be. Methods First, ... [Read more...]

World Ocean Atlas changes

January 25, 2015 | Dan Kelley Blog/R

Introduction The ocedata R package has a dataset named levitus, which stores sea-surface temperature and salinity. Today, the development version of ocedata (available at github) was updated from the 2009 version of this atlas to the 2013 version. Differences between the two datasets are illustrated here. Methods The code provided below requires ... [Read more...]

solar navigation

November 9, 2014 | Dan Kelley Blog/R

Introduction Solar altitude is a function of time, longitude and latitude, and so it can be possible to infer location based on measuring altitude as a function of time. This form of solar navigation can be based on sunrise and sunset times, at least on non-equinox days. I have explored ... [Read more...]

landsat thermal imaging

July 1, 2014 | Dan Kelley Blog/R

Introduction The tirs1 band of landsat-8 imagery (see [1]) is a near-thermal band, from which a quantity called ``brightness temperature’’ may be inferred. As explained in [2], the brightness temperature in Kelvin is computed with where and are stored in the image metadata, and , where again and are stored in the metadata. ... [Read more...]

Gulf Stream centre detection

June 22, 2014 | Dan Kelley Blog/R

Introduction Definitions of Gulf Stream location sometimes centre on thermal signature, but it might make sense to work with dynamic height instead. This is illustrated here, using a model for , with the distance along the transect. The idea is to select , the halfway point in the function, where the slope ... [Read more...]

DE solution in R (nonlinear oscillator)

June 15, 2014 | Dan Kelley Blog/R

Introduction The function lsoda() from the deSolve package is a handy function for solving differential equations in R. This is illustrated here with a classic example: the nonlinear oscillator. Theory As explained in any introductory Physics textbook, the nondimensionalized oscillator equation can be simplified to provided that , i.e. in ... [Read more...]

using C++ within R

June 8, 2014 | Dan Kelley Blog/R

Introduction Quite often I write which(...)[1] to find the first element of a vector matching some condition. One has to wonder whether that’s wasteful, though, since there is no need to do any tests once one works. I decided to try using C++, using Rcpp, to see if speed ... [Read more...]

slumping model

June 8, 2014 | Dan Kelley Blog/R

Introduction I got interested in layered sedimentation from viewing a video and decided it would be interesting to code this into R. More on that in due course, but my first step was to code a syatem with one sediment “type”. Procedure The following code drops sediment particles at x=1, ... [Read more...]

colormap

April 30, 2014 | Dan Kelley Blog/R

Introduction Over the past month or so I have been trying different ways of handling GMT-style colormaps in Oce. I think my present solution is on the right track, but I am posting here to get more eyes on the problem. Note that the function called Colormap() here will be ... [Read more...]

Using memoise to cache R values

April 12, 2014 | Dan Kelley Blog/R

Introduction The memoise package can be very handy for caching the results of slow calculations. In interactive work, the slowest calculations can be reading data, so that is demonstrated here. The microbenchmark package shows timing results. Methods and results Setup First, load the package being tested, and also a benchmarking ... [Read more...]

Sun and moon paths in daily sky

March 22, 2014 | Dan Kelley Blog/R

Introduction This blog started because I was interested in the sunrise position on the winter solstice of 2013. With the Spring equinox, I’m trying something different: plotting the paths of the sun and moon through the day. The code shown here produces a daily graph, and I have a cron ... [Read more...]

Box models in R

March 16, 2014 | Dan Kelley Blog/R

Introduction Box models are popular in some branches of oceanography and other geophysical disciplines, partly because they are simple to construct and to solve. This posting shows how to solve a box model in R, using the lsoda() function in the deSolve package. The basic ideas can be explained in ... [Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)