matlab.io.hdfeos.gd.readField
Namespace: matlab.io.hdfeos.gd
Read data from grid field
Syntax
data = readField(gridID,fieldname)
data = readField(gridID,fieldname,start,count)
data = readField(gridID,fieldname,start,count,stride)
[data,lat,lon] = readField(___)
Description
data = readField(gridID,fieldname)
reads
the entire grid field identified by fieldname
in
the grid identified by gridID
.
data = readField(gridID,fieldname,start,count)
reads
a contiguous hyperslab of data from the field. start
specifies
the zero-based starting index of the hyperslab. count
specifies
the number of values to read along each dimension.
data = readField(gridID,fieldname,start,count,stride)
reads
a strided hyperslab of data from the field. stride
specifies
the inter-element spacing along each dimension.
[data,lat,lon] = readField(___)
reads
the data and the associated geo-coordinates from the grid field.
This syntax is only allowed when the leading two dimensions of the
grid are 'XDim'
and 'YDim'
.
This function corresponds to the GDreadfield
function
in the HDF-EOS library C API.
Examples
Read the data, latitude, and longitude for the 'ice_temp'
field.
import matlab.io.hdfeos.* gfid = gd.open('grid.hdf'); gridID = gd.attach(gfid,'PolarGrid'); [data,lat,lon] = gd.readField(gridID,'ice_temp'); gd.detach(gridID); gd.close(gfid);
Read only the first 4x4 hyperslab of data, latitude, and longitude
for the 'ice_temp'
field.
import matlab.io.hdfeos.* gfid = gd.open('grid.hdf'); gridID = gd.attach(gfid,'PolarGrid'); [data2,lat2,lon2] = gd.readField(gridID,'ice_temp',[0 0], [4 4]); gd.detach(gridID); gd.close(gfid);