## Fitting probability distributions from binned / quantile data in Python

I’ve made an iPython Notebook that explains how to fit probability distributions to data when only binned values, or quantiles, or perhaps a cumulative distribution are available.  It uses a least squares fit approach.  View it by clicking the picture below:

The page includes a button to download the notebook so that you can play around with it yourself.

Python is a free and open source programming language that is becoming increasingly popular with scientists as a replacement for Matlab or IDL.  I hope that the notebook will be helpful to anyone who works with grainsize data e.g. volcanologists, sedimentologists, atmospheric scientists.

iPython notebooks are amazing; if you use Python for science and haven’t tried them yet, then I urge you to have a look.  They let you run Python code in little chunks, displaying the results immediately and interspersed with comments and LaTeX-rendered equations.  You can also render publicly-available notebooks using the iPython Notebook Viewer website, as I have done here.  I think that they are The Future.

iPython notebooks come nicely packaged for Windows and Mac in the Anaconda Python distribution (and probably others such as Enthought, too).  You can install the ipython-notebook package on Ubuntu-like Linux distributions with a single command (sudo apt-get install ipython-notebook), but to get the most up-to-date versions it is better to use pip:

# Depending on what is already installed,
# you may also need to add some dependencies.
sudo apt-get install pandoc python-zmq python-tornado

# Install pip, then use pip to install ipython
sudo apt-get install python-pip
sudo pip install ipython
Categories: Uncategorized

## The most important journals in volcanology

The Journal Impact Factor (JIF; average number of citations to a paper in a journal in the first two years since it was published) is such a poor predictor of an individual paper’s citation count that quoting it is a sign of statistical illiteracy, yet cursory judgements about the quality of scientific papers are routinely based upon of the JIF of the journal in which they are published.  At one end of the spectrum, this means that a paper in Nature or Science is automatically assumed to be so important that a single one on a CV can be a passport to job interviews, speaking invitations, jobs and promotions.  At the other, papers in discipline-specific journals can be passed over, assumed to be unimportant, despite being more useful to the group of people that actually read them.

Volcanology journals are an example of the latter; it’s a small field and, with just a few volcanologists to cite each other’s work, the JIFs of the specialist journals are quite low.  Nevertheless, they are clearly very important to the world of volcanology.  I wanted to find out what the most important journals in volcanology are, and if there was any correlation with the JIF.

To do this, I looked at the reference list of a recent review article, How volcanoes work: A 25 year perspective, written by Kathy Cashman and Steve Sparks.  Both authors have distinguished careers and extremely wide-ranging interests so can be trusted to give a reliable overview of the subject.  In the paper, they “focus particularly on the physical processes that modulate magma  accumulation in the upper crust, transport magma to the surface, and control eruptive activity“, which is actually a huge scope.  Volcanologists working with data from the depths of the mantle and lower crust or from orbit on satellites may feel a bit neglected, but most of physical volcanology is represented.

The paper cites a whopping 364 references.  I extracted the journal or book title from each, and with a few lines of Python code, got counts of which were cited most.  The number of counts is a proxy for the importance of the journal in the field of volcanology.

### The most important journals in volcanology

The most cited journals by Cashman and Sparks are the Journal of Volcanology and Geothermal Research and Bulletin of Volcanology.  Both are respected journals, well-read by volcanologists, so it is no surprise that they are the most important journals in the field.  JGR and EPSL are next.  Between them, these top four journals represent just under half (175/364) of all papers cited in the review.

Nature and Geology feature in 5th and 6th, showing that some important volcanology papers are published there, but they certainly do not dominate in the way that their JIFs would suggest.

### Comparison between JIF and citations in Cashman and Sparks (2013)

Comparing the number of citations in Cashman and Sparks (CCS) with the JIF (2 year citation data from SCImago; top 20 journals only) shows an overall lack of correlation.  The data can be divided into three groups:

• Journals with JIF > 5:  These ‘big hitters’ show a positive correlation between JIF and CCS, but, with the possible exception of Nature, they are not the most important journals to volcanologists.
• Journals with CCS > 10:  The four journals shown to be the most influential in volcanology all have a modest JIF that does not reflect their significance within the subject.  With Nature as an exception once more, the most important journals in volcanology actually show a slightly inverse correlation with JIF.
• Journals with JIF < 5 and CCS < 10:  These show no correlation between JIF and CCS.

### Conclusion

The data show that the most important journals in the field of volcanology, based on citations in a comprehensive review of the advances of the past 25 years, are Journal of Volcanology and Geothermal Research and Bulletin of Volcanology.  These are discipline-specific journals with low JIFs.  Consequently, the JIF of these journals is of especially little value in assessing the quality of the work in their articles or the importance of their contribution to the field.

EDIT 2014-03-12 21:30.  Of course the CCS is just another journal-based metric, so it still can’t tell you anything about an individual article or scientist.

If you don’t believe that journal-based metrics, such as Journal Impact Factors, should be used as a surrogate measure of the quality of individual research articles, or to assess an individual scientist’s contributions, or in hiring, promotion or funding decisions, then you can join over 10,000 others in signing the San Francisco Declaration on Research Assessment.

### Reference:

Cashman KV, Sparks RSJ (2013) How volcanoes work: A 25 year perspective. Geological Society of America Bulletin. doi: 10.1130/B30720.1

### Results in Full:

Journal of Volcanology and Geothermal Research,57
Bulletin of Volcanology,47
Journal of Geophysical Research,40
Earth and Planetary Science Letters,31
Nature,18
Geology,17
Journal of Petrology,12
Geochemistry Geophysics Geosystems,11
Geological Society of America Bulletin,10
U.S. Geological Survey Professional Paper,10
Geophysical Research Letters,9
Science,8
Geological Society of London Memoir,7
Contributions to Mineralogy and Petrology,6
Reviews in Mineralogy and Geochemistry,6
Nature Geoscience,5
Philosophical Transactions of the Royal Society of London,4
Geophysical Monograph,4
Journal of Human Evolution,3
Earth-Science Reviews,2
Geological Society of London Special Publication,2
The Journal of Geology,2
Journal of the Geological Society of London,2
Mathematical,2
International Journal of Remote Sensing,2
Physics and Chemistry of Minerals,2
Annual Review of Fluid Mechanics,2
Geological Society of America Special Paper,2
Journal of the Geological Society,1
Fire and Mud—Eruptions and Lahars of Mount Pinatubo,1
Oceanography,1
Geological Magazine,1
Geophysical Journal of the Royal Astronomical Society,1
Tectonophysics,1
Geological Society of London,1
Religion,1
The Geochemical Society,1
Journal of Colloid and Interface Science,1
Marine Geology,1
Krakatau 1883: The Volcanic Eruption and its Effects,1
Geophysical Journal International,1
GeoJournal,1
Pure and Applied Geophysics,1
Lava Flows and Domes,1
Disaster Resilience: An Integrated Approach,1
Volcano Hazard and Exposure in Track II Countries and Risk Mitigation Measures—GFDRR Volcano Risk Study,1
Assessment of Risk and Uncertainty for Natural Hazards,1
Encyclopedia of Complexity and Systems Science,1
Precambrian Research,1
Eos (Transactions, American Geophysical Union),1
Chemie der Erde–Geochemistry,1
IEEE Transactions,1
Journal of Fluid Mechanics,1
American Journal of Physics,1
Chemical Geology,1
Computers & Geosciences,1
Living Under the Shadow: Cultural Impacts of Volcanic Eruptions,1
Paricutín: The Volcano Born in a Mexican Cornfield,1
Journal of Geology,1
Physics of the Earth and Planetary Interiors,1
Encyclopedia of Volcanoes,1
Volcanic Plumes,1
Progress in Physical Geography,1
Washington,1
Archives of Environmental Health: An International Journal,1
Timescales of Magmatic Processes,1
Scientific Drilling,1
Reviews of Geophysics,1
Applications of Percolation Theory,1

Categories: Uncategorized

## Three years of volcan01010: Highlights of 2013

It’s 3 years since I started blogging at volcan01010. This post has some highlights from the last year. If you are into Iceland, volcanoes, Python, or open source software (especially GIS) then there should be something here for you.

Those annoying Buzzfeed headlines seem to be everywhere these days. I jumped on the bandwagon recently and sent out a series of tweets about the Seven volcan01010 Posts You Can’t Afford to Miss!

### Iceland and volcanoes (volcan…)

• Soup or volcano?Inspired by media obsession with supervolcanoes, I created this fun quiz for anyone aged 9 to 99 (centenarians have a notoriously poor sense of humour). See if you can be it!

### Open source software and GIS (…01010)

Which five countries have the most volcanoes per person? This intro shows how to use SQLite to extract useful data from massive spreadsheets and how to use it to organise your own sample data.

There are different ways of describing a lognormal distribution and I found the way that they are used in Python quite confusing. I couldn’t find any good guides online, so I made my own.

### Highlights from 2011, 2012

The previous two anniversary posts are still available:

### Progress since last year

Volcan01010 now has 881 followers on Twitter (up from 459 last year), and in the last 12 months the blog had 27,894 page views from 17,435 unique visitors in 170 countries (with the vast majority in the UK and USA). The numbers of hits are up about 50% from last year. Traffic comes in more steadily now and is spread across more posts, but the software how-to’s are usually most popular. I’m pretty happy that there were 13 days last year when over 100 people visited the blog; that’s a lot more people than come to any of my lectures!

If you find the blog interesting or useful, then please tell all your friends. Or make a video of yourself reading a post, and at the end nominate two of your friends to do the same in 24 hours.

Categories: Uncategorized

## A history of ash clouds and aviation

During 2010’s Eyjafjallajökull eruption, as the planes stood on the tarmac, many people asked why this hadn’t happened before.  After all, Iceland’s volcanoes have been active since long before mankind took to the skies.  Well, there are three main reasons for this.  These are the volcanoes, the airline industry and flight safety regulations.  This post looks at how all three have changed since the Second World War.

## The volcanoes

The orange areas in the barcode-like diagram below show all the periods in which volcanoes in Iceland were erupting.  The data came from the Global Volcanism Program.  It’s a fairly regular occurrence, as you can see.  On average, as I explained in my first ever volcan01010 blog post, there is an eruption in Iceland about every 5 years, with 3/4 of them being explosive.  The wind blows towards the UK about 1/3 of the time, so you could expect a direct hit from an ash cloud about once every 20 years.

The Surtsey and Krafla Fires eruptions stand out for their long duration.  Surtsey, in particular, is interesting because the eruption produced a new island in the north Atlantic, with ash-rich explosions driven by hot magma boiling the water of the ocean.  It lasted three and a half years.  What would happen if a similar eruption began now?

I’ve marked the three most powerful explosive eruptions, Hekla 1947, Eyjafjallajökull 2010 and Grímsvötn 2011, with bold lines.  These produced much more ash than the others.  It is pure luck that there was such a long gap between them.

## The airline industry

The blue line shows the huge growth in the global airline industry over the past 70 years (averaging 5% per annum).  There were no transatlantic passenger flights at the time of Hekla 1947.  By 2010, there were 2.5 million passengers flying between London Heathrow and New York JFK per year.  The more planes that are flying around, the more chance there is that one will meet an ash cloud.  In the two most dramatic encounters (BA Flight 9 vs Galunggung, Indonesia and KLM Flight 867 vs Mt Redoubt, Alaska, USA) the ash caused the jet engines to fail.  This led to changes to flight rules described below.

An important point to note is that as society becomes more dependent on air transport, any disruption is going to be increasingly expensive.

## Flight safety regulations

The near-miss ash cloud encounters led to the establishment of the International Airways Volcano Watch in 1987, and the process of designating regional meteorological  agencies as Volcanic Ash Advisory Centres (VAACs) began in 1990.  With no proper measurements of how much ash was safe to fly through, the guidance was to ‘avoid all ash’.  The final graph shows the period when these rules were in effect.

In much of the world, where planes can just divert around dangerous areas, the guidance worked well.  But when Eyjafjallajökull dispersed ash across much of NW Europe in 2010, closing the airspace of entire countries, it led to 95,000 cancelled flights and the massive global disruption that made the volcano infamous.

The Eyjafjallajökull eruption was the most ash-rich explosive eruption in Iceland since the rules were put in place, but it wasn’t the first time that Icelandic eruptions had affected flights.  The Hekla 2000 eruption damaged a NASA DC-8 aircraft that accidentally flew through the plume, and the Grímsvötn 2004 eruption caused parts of Scandinavian airspace to be closed.  In fact, every Icelandic eruption of the 21st century has impacted aviation.

During the Eyjafjallajökull crisis, the aviation rules were relaxed and ash contamination was divided into different concentration zones (even though we can’t reliably map the difference between them).  In Europe, planes can now fly where up to 4000 micrograms of ash per cubic metre of atmosphere are predicted and this got things moving again in 2010 while the eruption was ongoing (yellow region on graph).  It is also a big reason why only 900 flights were cancelled during the 2011 Grímsvötn eruption, despite the fact that it erupted twice as much material in one tenth of the time.  With these new rules, it seems likely that only the largest eruptions could cause disruption on the the scale of Eyjafjallajökull.

## Looking to the future

The chaos caused by the Eyjafjallajökull eruption was unprecedented because the global airline industry ‘took off’ and became part major of society during a lucky gap between powerful explosive eruptions in Iceland.  We can’t predict the next 70 years, but the following trends are likely:

• Iceland’s volcanoes will continue to erupt.  In particular, the time since that last eruptions of Hekla and Katla is longer than the average gap between their more recent eruptions.  Both volcanoes typically produce ash-rich eruptions.
• Global air traffic will continue to rise, making future airspace closures more and more expensive.
• The new flight rules will result in smaller areas being closed, and for shorter lengths of time, than during the ‘Avoid all ash’ era.  This will make continent-wide closures like Eyjafjallajökull caused much less likely.  Given the right weather conditions, however, it will still be possible for ash clouds to close airports in the busiest parts of NW Europe.
Categories: Uncategorized

## Generate volcano trivia with this SQLite tutorial

Excel is not a database. Even so, spreadsheets are commonly used as such. They are convenient places to enter and store data, but not to get it out again. This post aims to show how using a real database makes this easier.

It uses an SQLite database, which is what many browsers (e.g. Firefox) use to store your bookmarks and history. These can also be read by other software e.g. Geographic Information Systems. It has none of the overly-complex wrappings of MS Access or LibreOffice Base and doesn’t need a server like MySQL or Oracle. Once the data are imported, typically from a comma separated value (csv) file, it simply provides an interface so that we can ask questions using Structured Query Language (SQL).

This example uses the Smithsonian Institute’s Global Volcanism Program catalogue of volcanoes, which can be downloaded as a csv file from their website, as the database.  It lists locations and recent eruptions of over 1,500 active volcanoes. Querying the list can generate a wealth of interesting (and less-interesting) volcano facts.

The commands may look complicated at first, but hopefully you can see where the advantages in a real database lie.  If so, there are instructions for getting started at the end.  If not, just enjoy the trivia.

### Get an A-Z list of all the volcanoes in the world.

SELECT "Volcano Name" FROM GVPVolcano
ORDER BY "Volcano Name";
Volcano name
Abu
Cabalían
Dabbahu
E-san
Falcon Island
Gabillema
Hachijo-jima
Iamalele
Jailolo
Kaba
La Palma
Ma Alalta
NW Eifuku
O’a Caldera
Pacaya
Qal’eh Hasan Ali
Rabaul
SW Usangu Basin
Ta’u
Ubehebe Craters
Vailulu’u
Waesche
Xianjindao
Yake-dake
Zacate Grande, Isla

The database contains information on 1555 volcanoes. That’s a big spreadsheet to manipulate by hand. This list is trimmed to give just the first example for each letter of the alphabet. There are 160 volcanoes whose name begins with ‘S’, but only one that begins with ‘X’ (Xianjindo in North Korea).

### Get a list of all the volcanoes in Iceland.

SELECT "Volcano Name" FROM GVPVolcano
WHERE "Country" IS "Iceland";
Volcano Name
Snaefellsjökull
Helgrindur
Ljósufjöll
Reykjanes
Krísuvík
Brennisteinsfjöll
Hengill
Hrómundartindur
Grímsnes
Prestahnukur
Hveravellir
Hofsjökull
Vestmannaeyjar
Eyjafjallajökull
Katla
Tindfjallajökull
Torfajökull
Hekla
Grímsvötn
Bárdarbunga
Tungnafellsjökull
Kverkfjöll
Fremrinamur
Krafla
Theistareykjarbunga
Tjörnes Fracture Zone
Öraefajökull
Esjufjöll
Kolbeinsey Ridge

If you wanted to plot them on a map, you can get their latitude and longitude, too.

SELECT "Volcano Name", Longitude, Latitude FROM GVPVolcano
WHERE "Country" IS "Iceland";
Volcano Name Longitude Latitude
Snaefellsjökull -23.78 64.8
Helgrindur -23.25 64.87
Ljósufjöll -22.23 64.87
Reykjanes -22.5 63.88
Krísuvík -22.1 63.93
Brennisteinsfjöll -21.83 63.92
Hengill -21.32 64.08
Hrómundartindur -21.202 64.073
Grímsnes -20.87 64.03
Prestahnukur -20.58 64.6
Hveravellir -19.98 64.75
Hofsjökull -18.92 64.78
Vestmannaeyjar -20.28 63.43
Eyjafjallajökull -19.62 63.63
Katla -19.05 63.63
Tindfjallajökull -19.57 63.78
Torfajökull -19.17 63.92
Hekla -19.7 63.98
Grímsvötn -17.33 64.42
Bárdarbunga -17.53 64.63
Tungnafellsjökull -17.92 64.73
Kverkfjöll -16.72 64.65
Fremrinamur -16.65 65.43
Krafla -16.78 65.73
Theistareykjarbunga -16.83 65.88
Tjörnes Fracture Zone -17.1 66.3
Öraefajökull -16.65 64.0
Esjufjöll -16.65 64.27
kolbeinsey ridge -18.5 66.67

### What can you tell me about Hekla?

SELECT * FROM GVPVolcano
WHERE "Volcano Name" IS "Hekla";

There isn’t room to show all the columns as a table, but the data look like:

Volcano Number = 372070
Volcano Name = Hekla
Country = Iceland
Primary Volcano Type = Stratovolcano
Last Known Eruption = 2000 CE
Region = Iceland and Arctic Ocean
Subregion = Iceland (southern)
Latitude = 63.98
Longitude = -19.7
Elevation (m) = 1491.0
Dominant Rock Type = Andesite / Basaltic Andesite
Tectonic Setting = Tensional Oceanic

### Which is taller, Mt Fiji or Mt Etna?

SELECT "Volcano Name", "Elevation (m)" FROM GVPVolcano
WHERE "Volcano Name" is "Fuji"
OR "Volcano Name" IS "Etna";
Volcano Name Elevation (m)
Etna 3330.0
Fuji 3776.0

Fuji wins! But Etna has been trying hard to catch up recently.

### What are the 10 tallest volcanoes in the world?

SELECT "Volcano Name", Country, "Elevation (m)" FROM GVPVolcano
WHERE "Elevation (m)" IS NOT "NaN"
ORDER BY "Elevation (m)" DESC
LIMIT 10;
Volcano Name Country Elevation (m)
Llullaillaco Chile-Argentina 6739.0
Tipas Argentina 6660.0
Cóndor, Cerro el Argentina 6532.0
Coropuna Peru 6377.0
Parinacota Chile-Bolivia 6348.0
Pular Chile 6233.0
Solo, El Chile-Argentina 6190.0

They are all in western South America. I suppose that this region has the advantage of the Pacific plate being subducted under the South American continent and pushing up the Andes mountain range. The volcanoes just sit on top of it. This highlights the issue that your definition of the tallest may depend on where you are measuring from. Sea level, the Earth’s crust, the centre of the Earth? This video from BBC Planet Earth Unplugged explains this nicely.

Ojos de Salados, on the Chile-Argentina border, is 6888 m tall and last erupted around 700 AD. Source: http://volcano.si.edu/volcano.cfm?vn=355130

### What are the 5 northernmost volcanoes in the world?

SELECT "Volcano Name", Country, Latitude, "Tectonic Setting"
FROM GVPVolcano
ORDER BY Latitude DESC
LIMIT 5;
Volcano Name Country Latitude Tectonic Setting
Unnamed Undersea Features 88.27 Tensional Oceanic
Unnamed Undersea Features 85.58 Tensional Oceanic
Jan Mayen Norway 71.08 Tensional Oceanic
Kolbeinsey Ridge Iceland 66.67 Tensional Oceanic
Tjörnes Fracture Zone Iceland 66.3 Tensional Oceanic

They all relate to the mid-ocean ridges, whereas the southern ones are all in Antarctica and are relate to subduction. There are no active volcanoes within 1,100 km of the South Pole.

Volcano Name Country Latitude Tectonic Setting
Morning, Mt. Antarctica -78.5 Intermediate Continental
Royal Society Range Antarctica -78.25 Intermediate Continental
Erebus Antarctica -77.53 Intermediate Continental
Waesche Antarctica -77.17 Intermediate Continental
Unnamed Antarctica -76.83 Intermediate Continental

Mount Morning, Antarctica, is the southernmost volcano in the world. Source: http://volcano.si.edu/volcano.cfm?vn=390017

### What are the most volcanically active countries in the world?

SELECT Country, COUNT(Country) AS NumberOfVolcanoes FROM GVPVolcano
GROUP BY Country
ORDER BY NumberOfVolcanoes DESC
LIMIT 5;
Country NumberOfVolcanoes
United States 184
Russia 154
Indonesia 142
Japan 114
Chile 78

### If you stood all the volcanoes in the world on top of each other, could you reach the Moon?

SELECT SUM("Elevation (m)") AS TotalHeight FROM GVPVolcano;
TotalHeight
2533877.0

Not even close! 2,534 km is nothing compared to the 384,000 km distance to the Moon. It isn’t even a tenth as high as the orbits of geostationary satellites (36,000 km).

### Which volcanoes have erupted since I was born?

You have to be a little bit tricky with this, as the eruption years in the database are in the form “2013 CE”, so you have to trim off the spare text and tell SQLite to treat it as a number (integer).

SELECT CAST(TRIM("Last Known Eruption", " CE") AS integer) AS Year,
"Volcano Name", Country FROM GVPVolcano
WHERE "Last Known Eruption" LIKE "% CE"
AND Year >= 1979
ORDER BY Year;
Year Volcano Name Country
1979 Curacoa Tonga
1979 Arenales Chile
1979 Lautaro Chile
1979 Soufrière St. Vincent Saint Vincent and the Grenadines
1980 Kuchinoerabujima Japan
1980 On-take Japan
1980 Callaqui Chile
1981 Okataina New Zealand
1981 Shikotsu Japan
1982 Chirpoi Russia
1982 Chichón, El Mexico
1983 Colo [Una Una] Indonesia
1983 Kusatsu-Shirane Japan
1984 Galunggung Indonesia
1984 Kaitoku Seamount Japan
1984 Mauna Loa United States
1984 Krafla Iceland
etc.

There were 273 of them, apparently. The database only lists the most recent eruption of each volcano, so Mt St Helens appears in 2008, and not 1980 in the snippet above. 57 volcanoes registered eruptions in 2013.

### How many volcanoes are in the poorest countries of the world?

The real power of SQL comes from combining data from different tables. In this example, we use a list of the countries with Gross Domestic Product per Capita of less than \$5,000 from the CIA World Factbook as a filter for volcanically-active countries. If you weren’t just doing this for fun, you’d need to check that all the country names are identical in the two tables.

SELECT COUNT("Volcano Name") AS NumOfCountries FROM GVPVolcano
WHERE Country IN (SELECT Country FROM CIAFactbook
WHERE "GDP - per capita (PPP)" < 5000);
NumOfCountries
482

So 482 of the 1555 active volcanoes are in the poorest 88 of the 261 countries in the CIA Factbook.

### Which countries have the most volcanoes per head?

This example uses a JOIN.  JOINs are extremely powerful when you have data of different types in different tables. The number of volcanoes per head is very small, so citizens per volcano is presented here instead.

SELECT v.Country,
COUNT(v.Country) AS NumberOfVolcanoes,
c.Population,
c.Population / COUNT(v.Country)*1.0 AS CitizensPerVolcano
FROM GVPVolcano AS v
LEFT JOIN CIAFactbook AS c
ON v.Country=c.Country
WHERE Population IS NOT Null
GROUP BY v.Country
ORDER BY CitizensPerVolcano ASC
LIMIT 5;
Country NumberOfVolcanoes Population CitizensPerVolcano
Tonga 18 120898 6716
Iceland 30 306694 10223
Dominica 5 72660 14532
Vanuatu 14 218519 15608
Saint Kitts and Nevis 2 40131 20065

The join works by matching the Countries column in each of the two tables. Unsurprisingly, I suppose, it turns out that volcanic island nations are the places where people live closest to active volcanoes.

## A practical example for geologists

Another purpose of this post is to demonstrate how scientists can benefit from using databases in their work. As a geologist, I need to keep track of samples collected from the field and the results that I get from analysing them. A suitable database might contain the following tables with the following columns:

• Site: Number, Latitude, Longitude
• Sample: Number, SiteNumber, Type (e.g. lava, ash), Description
• XRFData: SampleNumber, SiO2, Al2O3, NaO, K2O, …

The idea is that each table contains only one type of data and that each has one key column with unique values (e.g. site or sample numbers). You can then get your data with short queries.

For example, chemical composition data from the XRF instrument is commonly plotted on a ‘Total alkalis vs silica’ plot, which distinguishes between different magma types (e.g. basalt, andesite). You can extract the data with:

SELECT SampleNumber,
NaO+K2O AS TotalAlkali,
SiO AS Silica
FROM XRFData;

To plot a map of SiO2 content in lava samples you can join the tables together.

SELECT Sample.Number,
Site.Latitude,
Site.Longitude,
XRFData.SiO2
FROM Sample
LEFT JOIN Site ON Sample.SiteNumber=Site.Number
LEFT JOIN XRFData ON Sample.Number=XRFData.SampleNumber
WHERE Site.Type IS 'lava';

If you do more analysis, you can simply add another table (e.g. SieveData, LiteratureData) without having to mess around with the data that you already have and, as long as your sample numbers are distinct, you can keep data from different projects together instead of scattered across many spreadsheets.

## Getting started

There are two good programs for viewing SQLite databases. Both are free+open source software, so you can download and install them on as many machines as you like. SQLite Manager is an add-on for the Firefox web browser. It has a nice tool for importing data from csv files. Sqliteman is a small stand-alone package that runs on Linux (sudo apt-get install sqliteman on Ubuntu-like systems), Windows or Mac. There is also a command-line interface utility, sqlite3 that can import and export data.

Click here to download the SQLite file for the database used in this post. It includes data from the Smithsonian Institute’s Global Volcanism Program’s volcano spreadsheet and csv version of the CIA World Factbook from here.

I highly recommend the W3 Schools’ SQL tutorial for learning the language. It takes about an hour. It is also worth reading up on database structure, particularly normalization, to help you choose suitable tables.

Regular readers of volcan01010 may be surprised that I have got this far without mentioning Python, a free+open source programming language that is becoming central to a scientist’s toolbox. The sqlite3 module comes as standard and lets Python read and write directly from / to SQLite databases. The Zetcode SQLite Python tutorial gives a great introduction.  It’s often easiest to input and edit data as csv files and it’s straightforward to write a Python script to automatically import them as tables for analysis. As csv files are plain text, they are easily portable and can also be tracked with version control software.

Happy databasing…

Categories: Uncategorized

## QGIS on the FLOSS Weekly podcast

Each week, the FLOSS Weekly podcast takes an hour-long look at exciting projects in the world of Free/Libre and Open Source Software.  It recently covered QGIS (or Quantum GIS), which is a really nice, user friendly, Geographical Information Systems package for plotting and analysing map data.  It is well worth a listen:

FLOSS Weekly Episode 270: QGIS

Some of the interesting things discussed include:

• Use cases of the software, including flood hazard mapping and plotting utilities.
• The popularity of QGIS amongst the international development and disaster management communities.
• That much of the funding for the software development comes from local governments, who saw that they were spending so much money on licence and subscription costs for proprietary packages that it would be much better value to switch to open source and use the money to hire their own software developers to add features that they were missing.  (This is the same reason that the Spanish region of Valencia created another open source GIS package, gvSIG).
• That even the software developers can’t agree on whether the name is pronounced “Cue – Gee – Eye – Ess” or “Cue – Jiss”.

• Georeferencing scanned field maps so that they can be imported into GIS packages (Georeferencer plugin)
• Plotting up my own data with Google Maps (aerial photos or otherwise) or Open Street Map in the background.  This uses the QGIS Open Layers plugin.
• Using the Map Composer to make nice pdf maps for printing, sometimes including data from GRASS GIS (another open source GIS package that has many tools for analysis).

To see a list of other useful free/open source tools for geoscientists, check out my post All the Software a Geoscientist Needs, for Free!

Categories: Uncategorized

## Soup or Volcano?

Inspired by Erik Klemmetti’s recent blog post about the rise of the term ‘supervolcano’, and by the imminent launch of the Volcano Top Trumps card game, I’ve created a quick game of my own: Soup or Volcano?

The rules are simple: Look at the following five images and decide if they contain soup, or a volcano. Then scroll down to the answers and see how well you did.

## Soup or Volcano?

### 1.

Image by Dr Nelia Dunbar, http://erebus.nmt.edu

Image: Tesco.com

### 3.

Photo: JD Griggs, USGS

### 4.

Image: Sir Nico, Wikimedia Commons

### 5.

Image: Will Hutchison, Oxford University

Now scroll down for the answers…

.

.

.

…a wee bit further…

.

.

1. Volcano. The lava lake of Mount Erebus, Antarctica, is a bubbling cauldron of molten magma. The bubbles burst with a ‘pop’ of low frequency sound (called infrasound). By analysing this, volcanologists can work out the size and pressure of the bubbles and how much gas is released in each.
2. Soup. A delicious minestrone. Minestrone soup actually has a lot in common with magma. Both contain a hot liquid (tomatoey-goodness versus molten rock), solid bits (croutons, pasta shapes and vegetables versus crystals) and often gas bubbles (steam versus a mixture of steam, carbon dioxide, sulphur dioxide, chlorine, fluorine and others).
3. Volcano. A basalt lava flow a Kilauea, Hawaii. This is erupted a temperatures of over 1000°C. As it cools, the surface develops a skin, a bit like the skin on soup. Molten lava can flow inside the skin, and the whole flow gets thicker from within. There are some great time-lapse videos of this on YouTube.

4. Soup. A thick, creamy tomato soup. The measure of the ‘thickness’ or ‘stickiness’ of a liquid is the viscosity and it is measured in units called Pascal-seconds (Pa s). The viscosity of water is about 0.001 Pa s and I would guess that this soup is around 1 Pa s. The viscosity of magma depends on lots of things such as the chemical composition, the temperature, and how much water is dissolved in it. Crystal and water-free basalt has a viscosity of ~10 to ~100 Pa s.  Other types of magma can have viscosities of over 1,000,000 Pa s.
5. Volcano. The crater of Colima volcano, Mexico, contains a lava dome. The lava here is of andesite or dacite composition is much more viscous than the basalts in Hawaii. The dome is covered in blocks of broken, solidified lava, but the perfectly flat top surface is a clue that there is liquid underneath. New magma oozes into the crater, then spills over the edge and tumbles down the side in spectacular glowing rockfalls.

## How well did you do?

1. 5 points: Congratulations! Your powers of separating food from large bits of rock are impressive. Come back next week to try your luck against Level 2: Pasta or Planet? Or maybe not.
2. 0 to 4 points: Are you serious? This was not a hard quiz, but your results were terrible. I recommend booking a trip to Kilauea in Hawaii, or Stromboli in Italy to see some real volcanoes in action. Don’t forget to pack a spoon.
Categories: Uncategorized

## How to use lognormal distributions in Python

I’ve made an iPython Notebook that explains how to use lognormal distributions in Python/SciPy.  Python is a free and open source programming language that is becoming increasingly popular with scientists as a replacement for Matlab or IDL.  I hope that the notebook will be helpful to anyone who works with grainsize data e.g. volcanologists, sedimentologists, atmospheric scientists.  View it by clicking the picture below:

iPython notebooks contain formula, code, equations and text. Click for notebook on Using the Lognormal Distribution in Python.

The page includes a button to download the notebook so that you can play around with it on your own machine.

iPython notebooks are amazing; if you use Python for science and haven’t tried them yet, then I urge you to have a look.  They let you run Python code in little chunks, displaying the results immediately and interspersed with comments and LaTeX-rendered equations.  You can also render publicly-available notebooks using the iPython Notebook Viewer website, as I have done here.  I think that they are The Future.

iPython notebooks come nicely packaged for Windows and Mac in the Anaconda Python distribution (and probably others such as Enthought, too).  You can install the ipython-notebook package on Ubuntu-like Linux distributions with a single command (sudo apt-get install ipython-notebook), but to get the most up-to-date versions it is better to use pip:

sudo apt-get install python-pip
sudo pip install ipython

# Depending on what is already installed,
# you may also need to add some dependencies.

sudo apt-get install pandoc python-zmq python-tornado
Categories: Uncategorized

## Volcanoes of Southern Iceland

The panorama above shows the volcanoes of Southern Iceland highlighted by early Autumn snows.  Click the image for a full size version.  It was taken near the town of Hella.  From left to right, they are Hekla, Torfajökull, Tindfjallajökull, Katla (low, distant glacier in the background) and Eyjafjallajökull.

Volcanoes of Southern Iceland, as seen from Hella. Fresh September snow highlights the higher volcanic peaks.  Click to enlarge.

The image lists the dates of “historic eruptions”.  For Iceland, this is since the country was settled in 871+/-2 A.D.  The dates are taken from the catalogue of the Global Volcanism Program.  The 870 A.D. eruption of Torfajökull produced pale-coloured rhyolite magma and coincided with the eruption of dark-coloured basaltic magma from the Veiðivötn fissure further northeast.  The combination of eruptions produced distinctive two-coloured tephra (pumice and ash) marker layer that can be found in soil across the country called the Settlement Layer or Landnám tephra.  It can be used to look for environmental changes since people (and their sheeps) arrived in Iceland.

Only Hekla looks like the classic cone-shaped volcano that a child might draw (and even then it is only from this angle, it is actually a SW-NE running ridge).  The other volcanoes were mainly constructed by eruptions when Iceland was covered by ice over 1000 m thick.  Instead of lava flows, they contain lots of broken rock fragments, shattered when the hot magma hit cold meltwater (called hyaloclastite) and piled up where they erupted.  Most of the Hekla cone has formed since the ice melted, around 8,000 years ago.  Tindfjallajökull has had no historic eruptions, but it has some lavas that haven’t been affected by glaciers, so has had at least one eruption since then.

The image was stitched using Hugin, a free/open source panorama stitching program, and annotated with Inkscape, a free/open source Adobe Illustrator/Corel Draw.  They can be installed on Ubuntu-like Linux systems with the command sudo apt-get install inkscape hugin, and is also available for Windows and Mac.  My photos don’t really do the scene justice, so you should probably just go to Iceland and see for yourself.

Categories: Uncategorized

## Volcano suit / What to wear in Iceland

I have a special volcano suit. It isn’t a silvery heatproof number for sampling red-hot lava, though. It’s a fleece-lined boiler suit. I bought it for fieldwork in Iceland and it works very well.  This post describes the suit, then lists the clothing that I recommend more generally for hiking, camping or exploring the country.

Edit: 08 September 2013.  I have updated this post slightly, following an early autumn Iceland trip with a tight schedule that forced us to work in some very wet and fairly cold weather.  The new text is coloured blue.

## Volcano Suit

The Icelandic name for these suits is kuldagalli. They are sold in hardware stores and used by people working outdoors over the winter, or when riding snowmobiles. In my current project, sampling the deposits of the Hekla 3 and Hekla 4 eruptions from a camper van, I do a lot of work within 20 minutes walk from the road. I dig a hole in the soil, then spend up to 3 hours recording ash layers and measuring pumices within it.

Volcano suits. (a) Wearing the volcano suit at the summit crater of Eyjafjallajökull (notebook says “Congratulations David and Elaine”. (b) Gemma models a kuldagalli, while the hill behind models a lopapeysa (Icelandic wool sweater). Inset: Lopapeysa knitted by Dr Morgan Jones (@drmorganjones). (c) Sampling in a light sleet shower in perfect comfort.

My suit is very warm, with thick pile insulation and a tough polycotton exterior. It has a fluffy hood, and no gaps where the wind can get in. It isn’t waterproof, but that doesn’t really matter because it is still warm when it is damp (more on this below). It is perfect for long periods sitting still and, because I never walk far, I don’t get cooked when I do move about. Best of all, when I come back to the van, covered in mud, I can just take it off and throw it in the back so I don’t mess up the interior.

## A few words on Iceland’s Weather

The weather in Iceland during summer is similar to the hills of the UK in spring or autumn, and the weather in Iceland during spring or autumn is similar to the hills of the UK in winter. So this advice applies in the UK, too.  Rain is common and is often light or showery, but wind is the most important factor in how you feel.  If you have the flexibility, use the weather forecast (www.vedur.is) to plan your trip.  The best weather is usually found on the opposite side of the island to where the wind is blowing from.

## What to wear in Iceland

The following list describes what I currently wear for fieldwork in Iceland, and has evolved over 12 years of working there. There is one message that I want to get across: take waterproofs, but aim to wear them as little as possible. Instead, I recommend a ‘soft shell’, approach based on pile and Pertex.  Pertex is a fabric that few outside the UK have heard of.  It isn’t waterproof, but is very tough, windproof and breathable, and is much less stiff than waterproof fabrics. British climber, Andy Kirkpatrick (@psychovertical), gives a great description of the soft shell concept and how it is based on the traditional clothing of native Arctic hunters:

This single layer of skin and fur provided excellent insulation even when damp, providing the wearer’s body with enough warmth to stay alive and, in doing so, dry out the insulation from within rather than rob it of what heat it had left.

The main idea is that windproofing is most important, and that it doesn’t matter if you get wet as long as the clothing is breathable enough to take the water away from your skin. This philosophy is perfectly suited to Iceland’s climate, where you are frequently wet, but not too wet.  It lets you be warm and comfortable while others ask  “Aren’t you cold?  Don’t you need a jacket?”

Waterproof membrane layers, even with modern fabrics such as Gore Tex, trap sweat and make you cold.  They should only be worn only if you are forced to be out in heavy or persistent rain. On my recent fieldwork I decided that if it was wet enough to need Gore Tex it was too wet to take samples anyway, so I sat out the showers in the van.

Wicking baselayer:  This is probably the most important item on this list. It takes the moisture away from your skin, so sweating doesn’t chill you.  Cotton t-shirts (or jeans) do not wick like this and are very slow to dry.  If you are wearing a waterproof jacket, however, even these layers will get wet with sweat.  Helly Hansen make the classic wicking base layer. I often wear a winter version when I’m in Iceland, which is thicker and contains Merino wool, and wear a wicking t-shirt on warmer days.

Lumberjack shirt:  I like to wear shirts in the field for three reasons. Firstly, they let you fine-tune your temperature by undoing buttons and rolling up sleeves. Secondly, you can use the collar to keep the sun off your neck. Thirdly, the breast pockets are handy for a hand-lens and compass-clinometer, with the strings larks-footed through the button holes. Being made of cotton is less of an issue when it isn’t next to the skin, but if it gets really wet in the rain it will take a long time to dry so it is better to leave it behind if the weather is poor.

The soft shell jacket (or smock) lets you keep your waterproofs in your bag. When the wind starts to cool you, put this on instead.  I love my Buffalo Teclite Shirt. It is, without doubt, the most versatile and useful piece of outdoor clothing that I have ever owned. As well as for fieldwork, I’ve used it climbing, mountain biking, running, cycle touring, skiing and caving. It’s been on every adventure that I’ve had in the last 8 years, from the Arctic to the Equator and from 5000 m altitude to 100 m underground.

My Buffalo Teclite Shirt made its field début at Prestahnúkur, near Langjökull, in June 2005 and has had many adventures since. Teva sandals strapped to rucksack were used for river crossings.  Photo by Dave McGarvie (@subglacial).

It is so useful because it is so light (the ‘classic’ Buffalo Mountain Shirts are too hot and heavy), but by blocking the wind it still feels really warm.  I wear my Buffalo over my wicking base layer and can put more insulation or waterproof layers on top if necessary. When it is cold, I use the hood; when it is hot, I use the side vents and roll up the sleeves. It also has big pockets for maps and notebooks. If it gets wet it is still warm and the best way to dry it out is just to keep wearing it.  If it gets ripped, you can stitch it back up again.

Páramo, Montane and RAB (Vapour Rise) also do pile and Pertex soft shell gear.  Fleeces with a wind/waterproof membrane don’t count.  It requires a slight change in outlook to wear this system. You have to accept that being wet is OK, and that it isn’t the kind of thing that you would wear around town. But if you spend a lot of time outdoors, you will love how well it works.

The lopapeysa is the classic Icelandic wool sweater. These are popular for a good reason: they are very warm, even when damp. I wear mine instead of the Buffalo once I get back to the van or to civilisation. You can wear it over the top of a soft shell if it gets really cold.  Treat it like a belay jacket that you can wear indoors.

During prolonged, heavy rain, the pile and Pertex system cannot shift the moisture as quickly as it is coming at you.  For this reason, you still need to carry a waterproof jacket for when it gets really wet and you have no choice to be outside, for example when hiking between camps. It is also necessary in light rain if you aren’t moving much e.g. when making measurements or cooking outside your tent.  It seems that this “beyond Buffalo” rainfall corresponds to around 3-6mm/3hrs (green on the Iceland Met Office rainfall maps) and may be less if the wind is strong.  If the outer layer saturates and the rain is still falling it is time to put on waterproof outer shell layers.

I just invested in a Mountain Hardware Morpheus. It is an outer shell and little more. I chose it because it should be useful for work (big front pocket for maps/notebook) and play (pockets accessible with a harness on and hood goes over a helmet). In the second-most recent 14 days in Iceland, I only wore it twice.  In the most recent 8 days in the field, it was needed on 6.  Keeping it in my bag stopped me sweating and stopped it getting ruined on the lava and the scree and the ash.

Lined hiking trousers: Craghoppers hiking trousers are good for fieldwork because they have good notebook/map pockets. The winter ones have a tightly-woven polycotton outer, but are lined with fleece so they act in a similar way to pile and Pertex. They are excellent, because you never feel the cold against your legs, even if the outside is damp. This way you don’t need waterproof trousers unless the rain is pouring down.

Leather boots. Fleece-lined trousers. Wicking baselayer. Shirt. Hand lens. David Attenborough wears the same clothes every day because it helps with continuity when shooting TV programs. I wear the same clothes every day because they work really well, and because it is one less thing to think about.

You can get a similar effect by wearing wicking baselayer leggings under normal hiking trousers.  Some friends in Iceland use tough polycotton builders’ trousers from a hardware store as an outer layer – they even have a loop for a geological hammer. Technical alpine-style trousers, e.g. those made of Schoeller-type material (black, stretchy stuff that feels a bit like a neoprene wetsuit), are good for walking but don’t have the pockets for fieldwork.

If you get a soaking in the rain, cotton boxer shorts will stay wet and cold long after your other layers have dried.  Silk or wicking underwear is better.

With these options, you should only need waterproof trousers if it is really wet. I have an old Karrimor pair.  Their best feature is full-length zips that let you vent easily when you inevitably start sweat.  But if your legs are warm enough, you never need to wear them.

## Footwear

Leather hiking boots: I have Altberg Mallerstangs. They are ideal because they have a one-piece leather upper with minimal seams and stitching, which would get shredded by lava and scree. They also have a waterproof Sympatex lining (good for long hikes in slushy snow) and a B2 crampon fitting (good for glaciers and easy winter climbing). Canvas boots will be destroyed and technical mountaineering boots are too clumsy.

Sandals: These are vital for wading across rivers, but are also useful to have in the car. Driving between sites, you can put your boots in the boot (trunk) and give your feet some air. Ignore any comments from idiot fashionistas. There is only one good reason not to wear socks and sandals: wet grass. A straightforward pair of Tevas is ideal.

## Gloves

I usually have 2-3 pairs of gloves: a thin pair of liner gloves (or fingerless woolen ones) that I can still write in; thin leather gardening gloves (a bit like golf gloves) for serious digging; and thick mittens for when it is really cold (Buffalo and Montane make pile and Pertex ones).

Geography teacher friend Al Monteith (@al_monteith) wears all his headwear at once, against an onslaught of “Orifice Flies”. You can read about the 3 weeks we spent in the field last summer on his blog. Note the soft shell jacket.

The following items are all useful:

• Mosquito net. The flies in Iceland don’t bite, but they can swarm in huge numbers and love to crawl into your mouth, your nose, your ears and your eyes.
• Sunglasses / goggles. When the wind picks up, it brings the ash and sand with it, so these are really useful to protect your eyes. At least it also blows the flies away.
• Buff / bandana. These can be worn in many ways, such as neck warmers, ear warmers, or as a lightweight hat. Get a dark one, so that you can use it as a blindfold if daylight stops you sleeping at night.
• Woolly hat. Keeps your head warm.  You can use this to fine-tune your temperature, putting it on and taking it off frequently as necessary.

## Notes

All this gear is expensive and I don’t suggest going out and it all at once, especially just for a single holiday or a school trip.  Start with a good wicking baselayer (remember: not cotton). If you currently own nothing else like it, it will make a huge difference to your comfort.  Remember that all these items are also useful in the mountains of the UK, or any other cold, windy places.

I have made this list based on my experience and on conversations with friends. I have no affiliation with any of the brands or websites mentioned above. That said, if anyone wants to send me free kit, I wouldn’t complain…