21.1 NetCDF Importing

In Origin, we support NetCDF Connector to import and partial import

Import NetCDF

To import a local .nc file:

  1. With a workbook or matrixbook active, choose Data: Connect to File in the menu and pick the file needed to import.
  2. In the Data Connector Brower dialog, select the imported dataset.
NetCDF Importing 01.png


To import web-stored .nc data by specifying a URL:

  1. With a workbook or matrixbook active, choose Data: Connect to Web.
  2. In the dialog that opens, set File Type to NetCDF (optional) and either (a) click on Recent URLs and choose a .nc file from the list or (b) directly enter a URL in the text box (e.g. https://psl.noaa.gov/thredds/fileServer/Datasets/cpc_us_precip/precip.V1.0.1948.nc), then click OK.
  3. In the Data Connector Brower dialog, select the imported dataset.



Data Connector Browser:

  1. Select the multi-dimensional variable (e.g. time * lat * lon) that you want to import and click the Select data to import button, adding the data to the bottom panel. If a workbook is active and the file requires a matrixbook, you will be asked if you want to (a) open a new matrixbook, (b) embed a matrixbook in the active workbook, or (c) import data to worksheet columns. Typically, single-dimensional variables should be imported into workbooks while multi-dimensional variables should imported into matrixbooks.
  2. Click the Import Options button (the "pencil" icon) and choose your options. Here, you can specify a partial import, convert longitude or flip your matrix vertically, or transform data using a formula.
    OH netcdf import options.png
  3. Click OK to close Import Options and click OK again to close the Browser and import your data. Large files may take some time to import. When the file is imported a Browser panel is added to the left side of the matrix. Note the slider at the top of the matrix window for viewing individual matrix objects.
OH matrix slider after import.png

Once a file is imported, you can make changes to Import Options by clicking the Connector icon and choosing Options.

Help connect netCDF import ch 3.png


Partial import NetCDF

Specify the time range for importing data

In the Data Connector Brower, after select the importing dataset, you can click on the Import Option - Slicing, Averaging, Formular button NetCDF Import Option.png to open the Import Option dialog.

  • From & To: data-time range to import.
  • Time Axis Skipping: Read m records and skip n records and repeat.
For example, if data is monthly, Read = 1 and Skip = 11 would repeat the pattern of read one month and skip 11 for the entire date-time range.
NetCDF Importing 02.png

Calculate annual/monthly average during import

In the importing process, you can import the annual/monthly average directly. Averaging option perform an average based on an Interval and either Sampling by Across Years or Consecutive.

NetCDF Importing 03.png

In the Import Option dialog, expand the Averaging section to set it.

Sampling
  • Consecutive: Calculate an average for consecutives time. For example, There is a dataset with 5 years. Set Interval = y, which means continuous 12 months. So that it is get 5 matrixes with annual average value.
  • Across Years: Calculate an average for the same month across the year. For example, There is a dataset with 5 years. Set Interval = m, then it get 12 matrixes and each matrix is the average value of the five years in the current month.
Interval

Enter numeric to indicate consecutive months.

Enter letter: d=daily, m=monthly, y=yearly, q=quarterly

Specify the region range of longitude and latitude

In the Import Option dialog, expand the Subregion section to specify the importing region part with longitude and latitude.

Longitude Shift

By default, the imported data is in 0, 360 range. Select this checkbox to change the longitude to -180, 180.


Latitude Flip

By default, the imported data is from south to north. Select this checkbox to change latitude to from south to north.

Formula

In the importing process, you can calculate new value in the matrix by formula.

For example, if you want to convert imported temperature data from Celsius to Fahrenheit, you can enter this formula in this edited box. v represent the original imported matrix cell value.

(v*9/5)+32

Connection String

Once you've set import options and closed the dialog, note that your connection string displays beside the variable in the bottom panel. Note, also, that this string is editable (and for those who are scripting, can be copied) by double-clicking on the string.

OH partial import connection string 1.png

While the connection string syntax can be complex, it follows the basic form of ...

NetCDF/variable[z][y][x]

... where "variable" is the variable that you are importing, and [z],[y] and [x] specify handling, including partial import, of z, y and x dimension data.

Note that while specifying partial import of z-dimension data starts with the basic Custom syntax described above, there are some NetCDF Connector-specific modifiers that are best understood by going through the GUI, setting Import Options, then reading or copying the connection string in the Browser dialog.