NetCDF Import to Plot Sea Surface Temperature Changes


Origin 2021b brings improved support for climatology-based NetCDF files as well as new matrix manipulation features to support that type of data. NetCDF is a popular data file format among those in the climatology-related fields, so we made it a priority to improve our support.

In this blog post, I’ll highlight the improvements by illustrating changes to sea surface temperatures for the month of July over the last 100 years. I will isolate two regions of interest, one in the Atlantic, and one in the Pacific Ocean, and plot a profile of the change in temperature over the years for each region of interest.

The concepts illustrated here apply not only to sea surface temperatures, but to most climatology type datasets, especially when the data is stacked by a variable such as dates, and slicing needs to be performed.

Download the Companion Files

Please download the Companion Files to this blog post if you want to follow along or see the finished project.

Importing the Data

The first step is to import the NetCDF file (some steps are illustrated):

  1. Activate a new Matrix book.
  2. From the Data menu, select Connect to File:NetCDF.
  3. Select the file from the companion files and click OK.
  4. In the Data Connector Browser dialog,  select the sst variable. Note: you can usually tell which variable to import based on the number and name of dimensions. For example, you may see time, lat, and lon.
  5. Click the Select Data To Import button to specify that it the sst variable is to be imported.
  6. Next, click on the Partial Import – Multi dimensional slicing button.
  7. In the Partial Import dialog,  select  From: 1920-07-01 and To:<end>.
  8. Next enable Skip and set Read: 1 and Then Skip: 11. This tells Origin to import one slice of the sst variable ( a month) then skip 11 slices (months), then repeat. This will bring in all of the July data for 1920 to present.

With the data imported, you will observe a slider that allows you to view the stack of matrices that encompass the imported data.

Additionally, you have a couple of options for enhancing the color of the matrices. When you look at the imported data, you will observe red patches. These patches represent “missing values” from the NetCDF file (Origin is able to process missing values from NetCDF files). you can change the color for missing values using LabTalk. With the matrix book active run wks.nancolor=#; where # represents one of the integer values from the LabTalk List of Colors. You can also apply a palette to the matrices via the Palette toolbar button.

You can also view the latitude and longitude ranges via the Matrix menu, Set Dimensions/Labels… Note: most NetCDF files store longitudinal coordinates going from ~0 to ~359 degrees where 0 is in the International Date Line.

Finally, if you are interested, you can view a list of Attributes for the imported variable.

Creating Regions of Interest

We’ll create two regions of interest (ROIs), one in the Atlantic and one in the Pacific Ocean. To add an ROI, select the Rectangle Tool from the toolbar and click and drag the ROI to move or size it on the matrix. You can see below that I added one to the Atlantic. Note: I zoomed in the matrix for clarity.

If we double-click on the ROI, we can give it a meaningful name such as “Atlantic”.

We’ll repeat the process to add an ROI named “Pacific” to the Pacific Ocean.

With the two ROIs set, we can align them to share the same width, height, and vertical/longitudinal offset. The animated GIF below illustrates this technique.

Extracting Temperature Profile Data

To extract a profile of temperature data over the span of Julys from 1920 to the present, I’ll right click on each ROI and select Intensity Profile. In the dialog, I’ll keep the default options including using Mean for the Profile Quantity. Note that the profile Quantity values are based on all values within the ROI, meaning that when you specify “Mean”, it will take the mean of the values within the ROI.

The Intensity Profile data is extracted into a new worksheet named after the ROI name. Additionally, the new worksheet is linked to the source ROI such that when the ROI moves, the worksheet data is updated.

With the data imported, ROIs selected, and the Intensity Profile data extracted , we are ready to make the graph we set out to.

Plotting Two Profiles of Temperature Changes

We’ll create a graph with two line plots- one for each Ocean’s ROI from 1920 to the present. I’ll not go into the details of created the graph but will show you the final version:


Thanks for reading this post. I hope you’ve learned some about Origin 2021b’s improved support for climatology-based NetCDF files. We’ll continue to provides in improvements in this area, so stay tuned!


UDel_AirT_Precip data provided by the NOAA/OAR/ESRL PSL, Boulder, Colorado, USA, from their Web site at

About Chris Drozdowski

Chris Drozdowski is a Product Support Engineer at OriginLab. He loves to talk to customers and educate them. He particularly relishes diagnosing and solving difficult, edge-case issues. As well, he contributes code to help solve problems or enhance user experience. In his down time at work, he likes to research and write about esoteric product features. Outside of work, he enjoys spending time with his family, having fun with C++, working on his aquarium, and exploring craft beers.

View all posts by Chris Drozdowski →

Leave a Reply

Your email address will not be published. Required fields are marked *