Main Content

matlab.io.hdfeos.sw.defBoxRegion

Namespace: matlab.io.hdfeos.sw

Define latitude-longitude region for swath

Syntax

regionID = defBoxRegion(swathID,lat,lon,mode)

Description

regionID = defBoxRegion(swathID,lat,lon,mode) defines a latitude-longitude box region for a swath. lat and lon are two-element arrays containing the latitude and longitude in decimal degrees of the box corners. A cross track is determined to be within the box if a condition is met according to the value of mode:

'MIDPOINT'The cross track midpoint is within the box.
'ENDPOINT'Either endpoint is within the box.
'ANYPOINT'Any point of the cross track is within the box.

All elements of a cross track are within the region if the condition is met. The swath must have both Longitude and Latitude (or Colatitude) defined.

regionID is an identifier to be used by sw.extractRegion to read all the entries of a data field within the region.

This function corresponds to the SWdefboxregion and SWregionindex functions in the HDF-EOS library C API.

Examples

import matlab.io.hdfeos.*
swfid = sw.open('swath.hdf');
swathID = sw.attach(swfid,'Example Swath');
lat = [34 44];
lon = [16 24];
regionID = sw.defBoxRegion(swathID,lat,lon,'MIDPOINT');
data = sw.extractRegion(swathID,regionID,'Temperature');
sw.detach(swathID);
sw.close(swfid);