matlab.io.hdfeos.sw.defGeoField
Namespace: matlab.io.hdfeos.sw
Define new data field within swath
Syntax
defGeoField(swathID,fieldname,dimlist,dtype)
defGeoField(swathID,fieldname,dimlist,dtype,mergeCode)
Description
defGeoField(swathID,fieldname,dimlist,dtype)
defines a geolocation field
to be stored in the swath identified by swathID
.
The dimlist
input can be a cell array character vectors or a string array
containing dimension names, or a single character vector or string scalar if there is only one
dimension. dimlist
should be ordered such that the fastest varying dimension
is listed first. This is opposite from the order in which the dimensions are listed in the C API.
dtype
is the data type of the field.
defGeoField(swathID,fieldname,dimlist,dtype,mergeCode)
defines
a geolocation field that may be merged with other geolocation fields
according to the value of mergeCode
. The mergeCode
argument
can 'automerge'
or 'nomerge'
.
If mergeCode
is 'automerge'
,
then the HDF-EOS library will attempt to merge swath fields into a
single object. This should not be done if you wish to access the
swath fields individually with the another interface. By default, mergeCode
is 'nomerge'
.
This function corresponds to the SWdefgeofield
function
in the HDF-EOS library C API, but because MATLAB® uses FORTRAN-style
ordering, the dimlist
parameter is reversed with
respect to the C library API.
Examples
import matlab.io.hdfeos.* swfid = sw.open('myfile.hdf','create'); swathID = sw.create(swfid,'MySwath'); sw.defDim(swathID,'GeoTrack',2000); sw.defDim(swathID,'GeoXtrack',1000); sw.defDim(swathID,'DataTrack',4000); sw.defDim(swathID,'DataXtrack',2000); sw.defDimMap(swathID,'GeoTrack','DataTrack',0,2); sw.defDimMap(swathID,'GeoXtrack','DataXtrack',1,2); dims = {'GeoXtrack','GeoTrack'}; sw.defGeoField(swathID,'Longitude',dims,'float'); sw.defGeoField(swathID,'Latitude',dims,'float'); sw.detach(swathID); sw.close(swfid);