Reads the data from a variable in a NetCDF source.
vardata = ncread(source, varname, [start, [count, [stride]]])
Path to a NetCDF file or URL of an OpenNDAP source (string).
Name of a existing variable (string).
Optional indexes at which the data is read (vector of double, each greater or eaqual to 1).
Optional number of values to read in each dimension (vector of double).
Optional inter-element spacing (vector of double).
Data in the variable (scalar, matrix or hypermatrix of double/integers, or a string).
ncread
reads the data of a variable varname from a source (NetCDF file or OpenNDAP source).
The location of the variable (i.e. the path of group at which the variable is stored) are specified in varname using the form /grp/subgrp/.../varname
.
The vardata Scilab type is the closest type of the variable NetCDF type.
In the case of double/float
variables, missing values or values equal to the fill value are automatically replaced by %nan
during the reading. The fill value is either the value specified in a parameter of nccreate or, by default the value defined by NetCDF.
The optional parameters start, count, stride are used to specify the indexes of data to read.
.scinetcdf_path = getSciNetCDFPath(); source = fullfile(scinetcdf_path, 'tests/examples/vars.nc'); // Reads the double 'x' ncread(source, 'x') // Reads the variable 'y' in the group 'grp' ncread(source, 'grp/y') // Reads the variable 'n' (int8 scalar) ncread(source, 'n') // Reads the string 'str' ncread(source, 'str') // Reads the 1D double array 'arr1' ncread(source, 'arr1') // Reads the values of the 1D array 'arr1' ncread(source, 'arr1') // Reads the values of the 2D array 'arr2' ncread(source, 'arr2') | ![]() | ![]() |