# 21.1 NetCDF Importing

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

## Import NetCDF

NetCDF file can only be imported into workbook/matrixbook. So make sure workbook window or matrix window is active.

1. To import a .nc file on local PC or network,
• Drag .nc file from Windows Explorer into Origin workspace, workbook or matrixbook.
• Choose Data: Connect to File: NetCDF... menu to pick the .nc file and click OK.
2. To import a .nc data on web, choose Data: Connect to Web, set File Type to NetCDF (optional) and enter URL link (e.g. https://psl.noaa.gov/thredds/fileServer/Datasets/cpc_us_precip/precip.V1.0.1948.nc), or click Recent URLs if you have down import in the past. Then click OK.
3. Data Connector Brower dialog opens with all variables listed on the left panel with basic info.
4. Origin only supports importing one variable at a time.
5. Click variable on the left to view extra info. on the right panel. E.g. sst in the following image is a 3 dimensional data.

### Import 1 Dimensional Variable

lat, lon and time, level, etc. are 1 dimensional data. They can only be imported into workbook.

1. Double click on a variable or click the down arrow to select the variable to import.
2. It will be put to bottom panel.
3. Click OK to import.
4. Click the data connector icon and click Select... to change to import another 1 dimensional data. It will replace the previously imported data.
5. All variables are listed on left panel of the workbook. Click on any other 1 dimensional data, right click and choose Add to active sheet to add it to current sheet.
6. Or choose Add and connect sheets to import the selected variable to a new sheet in same book.

### Import 2 Dimensional Variable

lat*lon, etc. are 2 dimensional data. They can only be imported into workbook or matrix.

1. With matrix window ative, open the netCDF Data Connector and pick a .nc file. Pick a double click on a 2 dimensional variable or click the down arrow to select the variable to import.
2. It will be put to bottom panel.
3. Click OK to import.
4. Click the data connector icon and click Select... to change to import another 2 dimensional data. It will replace the previously imported data.
5. All variables are listed on left panel of the workbook. Click on any other 2 dimensional data, right click and choose Add and connect sheets to import the selected variable to a new sheet in same book.

### Import 3 Dimensional Variable

3 and 4 dimensional data can be imported into either workbook or matrix book.

1. sst in above image is a 3 dimensional variable (e.g. time * lat * lon)
2. Double click or click the Down arrow button to add it to the bottom panel.
3. If a workbook is active and the file can be imported to either matrix or workbook, a dialog will popup for you to choose
• Use a new Matrixbook - this is the most straightforward way.
• Use an embedded Matrixbook - this will import data into matrix but the matrix is embedded as a sheet in workbook.
• Worksheet Columns (can be slow) -- this will import each time frame of matrix into multiple columns so it can create a worksheet with many many columns and cause slowness if data is big.
4. Choose Use a new Matrixbook and click OK.
5. Data will be listed at the bottom panel.
6. 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.
7. 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.
 Once a file is imported, you can change import options by clicking the Connector icon and choosing Options...; or choose another variable by choosing Select...

### Import 4 Dimensional Variable

1. If the variable's Dimensionality is 4, (e.g. time[248] * level[18] * lat[180] * lon[360]) and choose Use a new MatrixBook to import it, Origin will only pick one level to import (e.g. the middle level). A matrix book with one matrix sheet will be created for that level, each time frame will show on one matrix object. You can drag the slider on top of matrix sheet to view all imported time frames.
2. Click the the Connector icon and choose Select.. to view the connection string (e.g. NetCDF/t[z][10][y][x]. indicating that level 10 was imported).
3. You can modify it to be NetCDF/t[z][1][y][x]; to import the level 1 instead.
4. Use the following LabTalk script to import all 18 levels of data into one matrix book, each level on one matrix sheet.
newbook mat:=1 sheet:=18; //create a matrix book with 20 sheets.