Coordinate word manipulation


The names of GDS routines which manipulate coordinate words all start with GDSC_. These routines relate grid coordinates to coordinate words and vice versa. There is an example at the end of this page.

Routines

GDSC_FILL
fills the undefined coordinates in a coordinate word with grids from an input array. It is primarily used to create coordinate words which denote the lower and upper file positions of the data an application needs to access.
GDSC_GRID
extracts a grid coordinate from a coordinate word. It is primarily used to get the grids of the lower and upper bounds of a subset.
GDSC_INTERSECT
returns the coordinate word of a subset which is the intersection of two other subsets
GDSC_NAME
returns the name of an axis
GDSC_NDIMS
returns the number of undefined coordinates in a coordinate word. In other words it returns the dimensionality of a subset.
GDSC_ORIGIN
returns the location of the reference pixel of an axis
GDSC_RANGE
returns two coordinate words denoting the lower left grid position and the upper right grid position in a subset
GDSC_SIZE
returns the size of an axis
GDSC_SUBSTRUCT
returns the subset coordinate word from two coordinate words containing grid positions in the subset
GDSC_WORD
inserts a grid coordinate in a coordinate word

Example

This example demonstrates how to obtain the grid positions of the first and last file position in a GDS set. Note that the subset coordinate word which denotes the whole set has no defined coordinates, so it is zero.
C
C     GDSC_RANGE returns in CWLO and CWUP coordinate words which
C     contain the position of the first pixel and the last pixel in
C     the subset.
C
      CALL GDSC_RANGE( SET, 0, CWLO, CWUP, GERROR )
C
C     GDSC_NDIMS returns the dimensionality of the subset, so the number
C     of undefined dimensions.
C
      SETDIM = GDSC_NDIMS( SET, 0 )
C
C     GDSC_GRID extracts a grid coordinate from a coordinate word.
C
      FOR NAXIS = 1, SETDIM
         LOWERGRID(N) = GDSC_GRID( SET, NAXIS, CWLO, GERROR )
         UPPERGRID(N) = GDSC_GRID( SET, NAXIS, CWUP, GERROR )
      CFOR
C

Programming GIPSY