Routines (alphabetical) > Routines: H > HDF-EOS Routines > EOS_GD_CREATE

# EOS_GD_CREATE

This function creates a grid within the file. The grid is created as a Vgroup within the HDF file with the name gridname and class GRID. This function establishes the resolution of the grid, (i.e., the number of rows and columns), and its location within the complete global projection through the upleftpt and lowrightpt arrays. These arrays should be in meters for all GCTP projections other than the Geographic Projection, which should be in packed degree format (q.v. below). For GCTP projection information, see the HDF-EOS User’s Guide, Volume 2: Reference Guide provided by NASA.

## Syntax

Result = EOS_GD_CREATE(fid, gridname, xdimsize, ydimsize, upleftpt, lowrightpt)

## Return Value

Returns the grid handle (gridID) and FAIL(–1) otherwise.

## Arguments

### fid

Grid file id (long) returned by EOS_GD_OPEN.

### gridname

Name of grid (string) to be created.

### xdimsize

Number of columns (long) in grid.

### ydimsize

Number of rows (long) in grid.

### upleftpt

Location (double, 2 element array) of upper left corner of the upper left pixel.

### lowrightpt

Location (double, 2 element array) of lower right corner of the lower right pixel.

## Keywords

None

## Examples

In this example, we create a UTM grid bounded by 54 E to 60 E longitude and 20 N to 30 N latitude. We divide it into 120 bins along the x-axis and 200 bins along the y-axis.

uplft[0]=10584.50041d

uplft[1]=3322395.95445d

lowrgt[0]=813931.10959d

lowrgt[1]=214162.53278d

xdim=120

ydim=200

gridID = EOS_GD_CREATE(fid, "UTMGrid", xdim, ydim, uplft, lowrgt)

The grid structure is then referenced by subsequent routines using the handle, gridID.

The xdim and ydim values are referenced in the field definition routines by the reserved dimensions: XDim and YDim.

For the Polar Stereographic, Goode Homolosine and Lambert Azimuthal projections, we have established default values in the case of an entire hemisphere for the first projection, the entire globe for the second and the entire polar or equatorial projection for the third.

In the case of the Geographic projection (linear scale in both longitude latitude), the upleftpt and lowrightpt arrays contain the longitude and latitude of these points in packed degree format (DDDMMMSSS.SS).

- upleftpt- Array that contains the X-Y coordinates of the upper left corner of the upper left pixel of the grid. First and second elements of the array contain the X and Y coordinates respectively. The upper left X coordinate value should be the lowest X value of the grid. The upper left Y coordinate value should be the highest Y value of the grid.
- lowrightpt - Array that contains the X-Y coordinates of the lower right corner of the lower right pixel of the grid. First and second elements of the array contain the X and Y coordinates respectively. The lower right X coordinate value should be the highest X value of the grid. The lower right Y coordinate value should be the lowest Y value of the grid.

If the projection is geographic (i.e., projcode=0) then the X-Y coordinates should be specified in degrees/minutes/seconds (DDDMMMSSS.SS) format. The first element of the array holds the longitude and the second element holds the latitude. Latitudes are from –90 to +90 and longitudes are from –180 to +180 (west is negative).

For all other projection types the X-Y coordinates should be in meters in double precision. These coordinates have to be computed using the GCTP software with the same projection parameters that have been specified in the projparm array. For UTM projections use the same zone code and its sign (positive or negative) while computing both upper left and lower right corner X-Y coordinates irrespective of the hemisphere.

## Version History

5.2 | Introduced