Precipitating Precipitation Programs in Matlab

Ok that title is not terribly descriptive but sometimes you just can't go against alliteration like that! I recently was curious about the amount of rainfall in the region of Africa where I was working and thought "hey! there must be data for that!".  And of course there is! There's in fact more vintages of precipitation data than any lay-scientist/person could ever want but we wont complain about scientific riches.  Along the way to giving into this curiosity I found myself scripting simple Matlab programs to read in NetCDF formatted data which is ultimately the focus of the current blog. So if you're curious about how to access NetCDF data in Matlab or a bare-bones attempt at accessing climate data, read on!

A great place to start when looking into precipitation data is the Global Precipitation Climatology Centre (GPCC) Visualizer (https://kunden.dwd.de/GPCC/Visualizer).  This nifty website lets you view the data before you have to download it.  Select your favorite type of data, time-range, and geographic region and have at it! I specifically wanted monthly averages for the region surrounding Lake Malawi (East Africa) at the highest resolution possible so I went for the "Full Data Reanalysis Product".  

Once you've got your data in hand, it's time to get it loaded into your favorite program and start playing with it! I went for Matlab (home, sweet home) which was especially useful as Matlab has a suite of functions to handle NetCDF files.  The trick is to determine the name of the variable that you want to look at within the NetCDF file which can easily be done using the ncdisp function.  This function displays a summary of the file including the variables, size of the vectors/matrices, global attributes.  Once you've got the variables identified you can extract them using ncread and then you're ready to hit the road!  If you want to see an example of how I imported the data, including selecting the region of interest and plotting it, check out the script that I wrote here.  A figure displaying this data is shown below.

Example of mean monthly precipitation displayed over East Africa using the  NetCDF functions in Matlab.  

Example of mean monthly precipitation displayed over East Africa using the  NetCDF functions in Matlab.  

Well that about does it for now - until the next time I stumble on some interesting data or find myself down another rabbit hole of curiosity I'll make sure to get back to you guys. Happy discovering!

Necessarily Overly Complex: Driving Fortran programs from Matlab

As the title suggests, there are moments in your programming life when you'll need to be overly complex.  Yes, with more time and skill you could likely find a more elegant solution - something you could be proud to stand up and say "Yes! I wrote that!".  But often you'll find an inelegant fix will work just fine all the same. Sure, it's not pretty looking and you wont want to go around showing it off to your more tech savy friends but hey, you wont get any judgement from me! Plus it's likely that only in these moments of patching solutions together that you're really justified in using crass, explicit phrases to comment your code.  

What have I been up to - January 7th, 2017

Hello old stranger! It's been too long.

So what have I been up to in the last, wow, 3 months?! As you may be able to guess there has been lots of scripting, hypothesis testing, head scratching, and repeat! Throw in the annual American Geophysical Union Fall Meeting and that pretty much sums it up! But perhaps we should stick with tradition and dive in on one topic in particular - making movies in Matlab!

Now this used to be extremely convoluted and difficult to do - to the point that I never really got it to work until I upgraded to Matlab 2016B (apologies to all for whom this post is no longer applicable).  But now it's as easy as assigning individual frames to a variable and then writing that variable to a video object!  For my example I created a video of the earthquake sequence that occured prior to and following the M 7.8 event in New Zealand on November 13th.  To create this movie I downloaded the earthquake data from the USGS and if you're interested you can view the code I wrote to create the movie here.  And without further ado here's the video! 

That just about does it for now - after such a long break from writing blogs I'm going to have to ease back into this slowly ... Until next time, Happy 2017!


 

What does refraction picking actually look like?

What does refraction picking actually look like?

Given the plethora of hours I've been recently devoting to picking refraction data I thought why not make a video of it?? And so that's exactly what I did! This video will give you a taste for what the last several weeks of my life have been filled with, granted with a slightly different soundtrack (cough, so-much-netflix, cough).  Plus if you ever find yourself needing a solid program for picking refraction arrivals you should give OpendTect (a primarily reflection platform) a try! Enjoy :) 

What have I been up to? - September 19th Edition

What have I been up to? - September 19th Edition

Recently my life has been consumed with picking data! Picking, and picking, and piiicking, and piiiiiiiiicking ... But hey, that's ok! I'm 18 OBS down, 15 OBS to go, and ~ 45 onshore stations to pick! Wait, that's a lot more than I thought ... Ah, oh well I'm sure time will fly! To stave off madness I have been taking breaks brainstorming ways of effectively displaying my picking escapades. These include plots of my progress (to prove to my advisor I've been working ... cough, I mean to practice visualizing data)

Getting your Feet Wet - Why seismologists acquire simultaneous onshore/offshore data

Getting your Feet Wet - Why seismologists acquire simultaneous onshore/offshore data

Most major plate boundaries (with a few notable exceptions, can you think of which they are?) sit either completely offshore (i.e. mid-ocean ridges) or at the junction between an ocean and a continental land mass (i.e. subduction zones).  Thus to study the forces that control plate tectonics we commonly have to jump in and "get our feet wet" - i.e. go into the oceans. As seismologists we routinely get our feet wet by deploying ocean-bottom seismometers (OBS) to record ground motions both from near and far earthquakes as well as man-made sources.  

These are a Few of My Favorite Things - Debugging in Fortran

Hahaha, ok I'm already cracking myself up with this title because, really, who likes debugging and debugging in fortran nonetheless? The title is definitely a misnomer but it's a reality that as a graduate student in earth science (and likely other fields) at some point in time you're going to have to debug something written in Fortran.  

What have I been up to? - July 24th Edition

What have I been up to? - July 24th Edition

My life continues to be consumed by the awesome world of active-source seismology.  Specifically, picking, picking, picking, and more picking ... I have now realized that no matter what field of science you're in at some point in your career you're going to end up picking something.  Maybe you're picking spectral peaks to identify organic molecules in soil samples, or different types of pollen scraped off of bees (I've done this), irregular heartbeats in a mouse's cardiogram, boulders in satellite images of the Moon (I've done this too), or just regular ol' seismic arrivals to locate earthquakes, no matter what field you're in you'll likely end up picking something!  

These are a Few of My Favorite Things - The powerful awk command

These are a Few of My Favorite Things - The powerful awk command

I still remember with vivd clarity the day many years ago that a senior graduate student asked me the question "Do you know how to use awk?".  My embarrassed response, identical to what felt like a thousand previous questions concerning my knowledge of the scientific world during that first semester of graduate school, was a heavy-hearted "No". Luckily for me, I've managed to put several thousands of miles between myself and that naive, unknowing version of myself and can know happily shout from the rooftops - "Yes! And I LOVE it!".