Using R and JAMSTEC NetCDF Files to Examine Ocean Temperatures

By Andy May

It doesn’t matter if you think fossil fuel CO2 emissions are going to end the world or lead us to a greener and more beautiful one. Either way, to be a true climate change geek you need access to climate data! Unfortunately, much of the climate raw and gridded raw data comes in a very difficult to read format called NetCDF. Worldwide temperature data is complex, the dimensions of climate arrays are latitude, longitude, depth (or the equivalent pressure in the atmosphere or ocean), year, and month. It is very hard to simplify it more than that. NetCDF does handle data of this complexity in a machine independent way, but you will not be able to read it with Excel. So how do we do this?

R is a wonderful statistical package that is free. It is very widely used and lots of books and websites offer help. It is not easy to learn, but with work you can get a lot out of it. You can download it here. If you plan on working with climate data I recommend the 64 bit version, which requires a 64 bit computer running 64 bit Windows. The arrays are very large, often larger than the 32 bit limit of 2 GB. Try and use a computer with at least 12 GB of memory. The computer I use for this work has 18 GB and runs 64 bit Windows 10.

You can use the gui or text based interface built into R for all of your work, but I’ve found that RStudio is a better environment. RStudio can be downloaded here. It is also free for personal use. There are numerous books on R and I’ve certainly not read them all, but two books stand out for most R users. A good beginning book is R for Dummies. Once you’ve gotten started and you want to get in deeper you will need The R Book. R has powerful map making modules, called “packages,” and you will want to learn them, start here.

The NetCDF files we will be working with contain the JAMSTEC MOAA GPV worldwide grid of ocean temperatures to 2000 meters. You will want to download all of the files with names like “TS_YearMo_GLB.nc”. There are 176 files to download so I suggest using an ftp utility that offers multiple file downloading like Filezilla, which is also free. Each file contains the temperatures for one month, for example TS_201508_GLB.nc contains a world-wide grid of ocean temperatures from the surface to a depth of 2,000 meters for August, 2015.

JAMSTEC Ocean Temperature Dataset overview

The final lines of the R program described below build a summary matrix “MTYr” that holds the yearly mean global temperatures for 25 depths. Below is a plot of ocean depth versus temperature for 2001, 2005, 2010, and 2014 from the summary matrix.

The lines are indistinguishable at this scale below 100 meters. According to the JAMSTEC MILA-GPV grid, which can also be downloaded and read with a similar R program, the average mixed layer depth is about 59 meters. The mixed layer begins immediately below the surface layer, which is affected by the “skin” layer. The skin layer is less than a millimeter thick, but it can affect the surface water temperature down to 10 meters or so in some conditions during the daylight hours. Below 10 meters we encounter the sea surface foundation temperature.

Continue Reading

 

Published by Andy May

Petrophysicist, details available here: https://andymaypetrophysicist.com/about/

%d bloggers like this: