Geology mapping with QGIS and Inkscape

Figure 1. New Caledonia geology map.

I recently used QGIS and Inkscape to make a geology map of New Caledonia for my M.Sc. thesis.  Thankfully I can read enough French to find things like the official French government sanctioned geology Shapefile online [1].
Continue reading

Replace NA in R

dataframe_A[grep(T,is.na(dataframe_A[,"Column Name"])),"Column Name"] <- "Replacement phrase"

I always forget how to batch replace all the NA values in a table.  So, here’s a short code snippet that took me all afternoon to figure out.  dataframe_A is a data.frame full of data imported from a csv file.  I want to change all the NA values in a single column named “Column Name” to the phrase “Replacement phrase”.  Ta-da.

Petrology class project in R and Excel

My 2 unit self-study assignment this semester was to create a project for the G310/510 class that would take one full class week (4 hours total) for the students to complete. My G510 grade for the project depended on my ability to grade the finished assignments. I report that my project was a success, and I am publishing it here. Continue reading

R: Spider diagrams

Creating a spider diagram in R is not a trivial task. A spider diagram is a multi-line chart, or geology’s version of a parallel axes plot. Spider diagrams are used to see if the lava is depleted or enriched in REE (rare earth elements) compared to some normative rock (chondrite meteorite; depleted mid-ocean ridge basalt, or NMORB; primitive mantle; etc.). The x-values are the elements of interest, and the y-values are plotted on a logarithmic scale. The normalizing values therefore plot as a horizontal line at 1.
Continue reading

Excel for geochemistry

MS Excel (for Mac) spreadsheet with original, unformatted data direct from SGS for the 2010 New Caledonia pumice.

For the past few weeks I have been analyzing the geochemical data from the pumice I collected from New Caledonia over the summer.  I had 16 samples analyzed by ICP-AES and ICP-MS by an outside lab, SGS (package ICM90A).  The samples were pulverized in chrome steel bowls and dissolved with sodium peroxide fusion.  Samples from 2008 were processed the same except they were pulverized in tungsten carbide bowls.  The usable geochemical data included the concentrations of 8 major oxides and 31 trace elements.  Where available I compiled matching major and trace element data from 16 published papers, for a total of 530 samples including mine (this number is not final).

Many people make the mistake of relying on Excel’s limited (and tedious) graphing functionality for all of their data visualization.  Excel is especially poorly equipped to deal with the large amounts of data (over 20,000 fields of data to-date in my comprehensive spreadsheet!) involved in geochemical bivariate analysis.  I personally encountered problems with lag and issues with linking the graphed data to the tabulated data. However, Excel has always been a master of data tabulation and with cell-linked formulas it can be quite versatile.
Continue reading

BibDesk template

BibDesk is a citation program for Macintosh. I wrote a template that formats citations for geological publications.  I’ve only got the format for journal articles so far, but will be adding books and other publication types as I get to them and need them.

Here is a screencap of BibDesk with two citation records selected. See the Bibliography in the bottom pane created by my template.  Where available, I also have files attached to each citation record, including a .pdf of the text and an excel spreadsheet with any geochemistry values I wanted to use for my thesis.

Continue reading

Introduction

Hello and welcome to my blog, Runs with Rocks, where I will be sharing the many things I do with computers in the geological sciences.

I am a geology graduate student who has a degree in electrical engineering, so I generally consider this stuff “playing”.  I’d love it if I could interest fellow geologists in utilizing the sheer plethora of computer applications available to the modern geologist.  I’m scandalized by the number of times I’ve heard someone say, “I didn’t know you could do that with a computer!”