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 (  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!