: V = ncArray(filename, varname)
: V = ncArray(filename, varname, propertyname, propertyvalue, …)

Create a ncArray that can be accessed as a normal array.

Inputs

filename - filename to read

varname - variable name to read from file

propertyname, propertyvalue - property name and value pairs.

Outputs

V - a ncArray of the read file.

For read access filename can be compressed if it has the extensions ".gz" or ".bz2". It use the function cache_decompress to cache to decompressed files.

Data is loaded by ncread and saved by ncwrite. Values equal to _FillValue are thus replaced by NaN and the scaling (add_offset and scale_factor) is applied during loading and saving.

Example

Loading the variable (assuming V is 3 dimensional):

x = V(1,1,1);   % load element 1,1,1
x = V(:,:,:);   % load the complete array
x = V();  x = full(V)  % loads also the complete array

Saving data in the netcdf file:

V(1,1,1) = x;   % save x in element 1,1,1
V(:,:,:) = x;

Attributes

units = V.units; % get attribute called "units"
V.units = 'degree C'; % set attributes;

Note: use the ’.()’ notation if the attribute has a leading underscore (due to a limitation in the matlab parser):

V.('_someStrangeAttribute') = 123;

See also: cache_decompress, ncCatArray. Web: http://modb.oce.ulg.ac.be/mediawiki/index.php/ncArray

Package: ncarray