An Introduction to NetCDF Matrix-Based Features in Origin 2021b


Origin 2021b brings improved support for importing and analyzing data stored in NetCDF files. NetCDF is a popular data file format for climate scientists, so we geared our features towards their needs.

In this blog post, I’ll introduce many of the features based on functional grouping. It will serve as a reference for subsequent blog posts where various features will be utilized to produce different analysis and graphing outcomes.

Importing Features

NetCDF files are hierarchical by design, allowing the storage of single or multiple dimensional data variables. Additionally, NetCDF files can contain attributes associated with the data variables or the entire file itself. Origin’s NetCDF Data Connector allows the user to select a variable from a file and import it. Typically, single-dimensional variables are best imported into Origin Workbooks while multidimensional variables are best imported into  Matrixbooks.

For climate science type data, users are typically concerned with multidimensional variables such as sea surface temperature or precipitation. This type of variable is gridded along a set of  “standard” dimensions- time (a date-time), lat (latitude), and lon (longitude). Sometimes there is a forth dimension that is many times labelled as lev.

Let’s look at the basic steps of importing a multidimensional variable from a NetCDF file.

Import Steps
  1. From the Data menu in Origin, select Connect to File->NetCDF.
  2. Select a NetCDF file (*.nc or *.nc4).
  3. The Data Connector Browser dialog will appear. Observe the hierarchy of the variables in the left panel along with attributes display in the right panel.
  4. Select a multidimensional variable and click the Select Data to Import button.
  5. Optionally, specify Import Options (This will be discussed next).
  6. Click the OK button.
  7. The multidimensional variable will be imported as a stack of matrices in a matrixbook (we’ll learn more about this a bit later).
Import Options

In the Data Connector Browser dialog, clicking the Import Options button opens a sub-dialog that allows specifying various options to control what is imported.

  • From & To: data-time range to import.
  • Time Axis for Skipping:  Read m records and skip n records and repeat. For example, if data is monthly, Read: 1 Skip: 11 would read one month and skip 11 then repeat for the entire date-time range.
  • Averaging: Perform an average based on an Interval and either Sampling by Across Years or Consecutive. For example, Sampling: Across Years Interval: m would calculate an aggregate average for each month for the date-time range.
  • Longitude Shift: By convention, longitudes for NetCDF variables are based on a ~0 to ~360 degree mapping. Enabling this allows it to be shifted to ~-180 to ~180 degree mapping.
  • Latitude Flip: Based on how a variable is stored, it may be imported “upside down”. This option corrects for that.
  • Subregion: Specify a longitudinal and/or latitudinal subregion to import.
  • Formula (v): Apply a mathematical formula to the data during import. v represent the data value. for example, (v*9/5)+32 would shift temperate data from Celsius to Fahrenheit.

Matrixbook Features

As I previous mentioned, a multidimensional variable is typically brought into stack of matrices in a matrixbook. More correctly, the stack resides in a Matrixsheet. The following features of matrixbook, sheet, and stack are relevant to imported NetCDF data. Here is a matrixbook with imported data:

Most items in the illustration are fairly clear but three require explanations:

Navigator: similar to the Data Connector Browser, the Navigator displays the hierarchy of the entire imported file. You can right-click on different multidimensional variable to import that variable into another matrixsheet. The Import Options from the first imported sheet will carry over to the newly imported sheet.

Data Connector icon: clicking the icon provide access to a number of features with the important ones being: re-importing the data, unlocking the imported data, removing the Data Connector, and, perhaps most importantly, access to the Import Options dialog to change import settings.

Mini Toolbar: provides buttons for important settings including Missing Value Color, Slider or Thumbnails, and Dimensions/Labels (see below).

The Dimensions/Labels feature provides access to the Long NameUnits labels for the X, Y,  and Z dimensions of the matrix stack.

One last thing (it’s not on the Mini Toolbar). You can apply a color palette to the matrix stack via the regular Palette toolbar button.

Note that, from now on in this post, you will see that the matrix stack has had Missing Value Color and a Palette applied to it.

Region of Interest Features

Region of interests (ROIs) can be added to a matrix stack in order to operate on a subregion of the data in the stack. The animated illustration below shows how to create an ROI and the features associated with one.

You start by selecting the tool from the toolbar (there are different-shapes), and then dragging it onto the stack to create an ROI. You can add multiple ROIs to the same stack by changing the previous ROI‘s name (see below).

To work with an ROI, double-click on it to open a dialog to:

  • Set its Name.
  • Set its Coordinates.

You can also right-click to access a context menu of features including:

  • Copy PositionsPaste Positions to another ROI.
  • Export ROI positions to a file.
  • Import ROI positions from a file and apply to the current ROI.
  • Create New matrix stack from the ROI.
  • Extract as XYZ data from stack to a worksheet.
  • Generate an Intensity Profile for one or all ROIs and output to a worksheet. An Intensity Profile allows you to generate a statistic for the data within the ROI for each individual matrix in the stack. The generated data is 2D and is suitable for 2D graphing or analysis.

Note: In a future blog post, I’ll show you how you can create an ROI from a shape file!

Matrix Analysis Features

The MatrixAnalysis menus contain four analytical features applicable to NetCDF data.

  • Pixel Extraction: Extracts values for an XY coordinate pair from every matrix in a stack. Output goes to a worksheet. Note: you can use the Screen Reader tool to pick out the point prior to opening the dialog from the menu.
  • Linear Fit: Performs a linear fit of every XY coordinate pair in a matrix stack. Output goes to a new matrix stack.
  • Descriptive Statistics: Calculates descriptive statistics for every XY coordinate pair in a matrix stack. Output goes to a new matrix stack.
  • Subtract: Subtract matrices from each other. Output goes to a new matrix stack.

While the first three features are fairly straightforward, Subtract requires a bit of explanation.

Subtract requires two matrix stacks (technically Matrixsheets)- A B. B is subtracted from A. You can:

  • Subtract the active matrix in B from the active one in A.
  • Subtract the first matrix in B from the active one in A.
  • Subtract the same matrix in B as the active one in A.
  • Subtract the entire B stack from the A stack.

Not bad- just needed a little explanation!

Graphing Options

The Intensity ProfilePixel Extraction features generate 2D worksheet-based data and Origin has many well-known 2D graph types.

But what about matrix stack data? In this case, the primary graph type is the Image Plot. Image Plots are easy to make. You can add a world map, and even convert a single image plot into a Browser Graph. Watch:


This concludes this reference blog. We will add additional blog posts in the future demonstrating the various features in action. Thanks for taking the time to read through.

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 →


メールアドレスが公開されることはありません。 * が付いている欄は必須項目です