njtbx-icon
Netcdf-Java Toolbox
previous Method getAttributes
Method getJNetcdfDataset Next

 
 
Method getData

PURPOSE ^

mVar/getData - Read data from variable.

SYNOPSIS ^

function result = getData(mVarObj, start, count, stride)

DESCRIPTION ^

mVar/getData - Read data from variable.

 Method Usage:
   data=getData(mVarObj)  - Read the entire dataset
   data=getData(mVarObj, start, count)
   data=getData(mVarObj, start, count, stride)  - Read hyperslab by 
                                                     specifying corner and edges.
 where,
   mVarObj - mVar object
   start - A 1-based array specifying the position in the file to begin reading or corner of a
           hyperslab e.g [1 2 1]. Specify 'inf' for last index.
           The values specified must not exceed the size of any dimension of the data set.
   count - A 1-based array specifying the length of each dimension to be read. e.g [6 10 inf]. 
           Specify 'inf' to get all the values from start index.
   stride [optional] - A 1-based array specifying the interval between the
                       values to read. e.g [1 2 2]
 returns,
   data - matlab array

 e.g.
   Assuming Array shape is [8,20,60,160]
   data=getData(mVarObj);  - all data      
   data=getData(mVarObj,[1 1 1 1],[1 1 20 inf],[1 1 2 2]);  %hyperslab
   data=getData(mVarObj,[1 1 1 1],[1 1 20 inf]); 

 Data can also be accessed by using matlab subscripting references with 'mVar' object.

 Usage:
   data = mVarobj(i,j, ...);
 where,
       mVarObj - mVar object
       i/j/k... - startindex:stride:endindex
 returns,
   data - matlab array

 e.g.
   Assuming Array shape is [8,20,60,160]
   data = mVarobj(:,2:2:20,1:59,1:160); 
   data = mVarobj(1,2:2:20,1:59,1:end);

 As a convenience method, the variable data can be directly retrieved 
 from netcdf data object(mDataset) without creating variable object.
e.g.
 data = mDatasetObj{'variable_name'}(1,20,1:60,1:end);
          

   See also mGeoGridVar/getData

CROSS-REFERENCE INFORMATION ^

See functions using getData:
  • nj_grid_varget NJ_GRID_VARGET - get variable data and associated grid coordinates from local NetCDF file, NetCDF URL or OpenDAP URL
  • nj_tslice NJ_TSLICE - Get data and coordinates from a CF-compliant file at a specific time step and level
  • nj_varget NJ_VARGET - get variable data from local NetCDF file, NetCDF URL or OpenDAP URL


previous Method getAttributes
Method getJNetcdfDataset Next
© 2006-2009   Mississippi State University   • License Terms   • Credits