## NAME

           grdraster - extract subregion from a binary raster and write a grd file

## SYNOPSIS

           grdraster [ filenumber ] -Rwest/east/south/north[r] [ -Ggrdfilename ] [
           -Ix_inc[m|c][/y_inc[m|c]] ] [ -Jparams ] [ -V ] [ -bo[s] ]

## DESCRIPTION

           grdraster reads a file called grdraster.info from the directory pointed
           to by the environment parameter $GMT_GRIDDIR (if this parameter is  not
           set  it defaults to $GMTHOME/share/dbase). The info file defines binary
           arrays of data stored in scan-line format in data files. Each  file  is
           given  a filenumber in the info file. grdraster figures out how to load
           the raster data into a grd file spanning a region defined  by  -R.   By
           default  the  grid spacing equals the raster spacing. The -I option may
           be used to sub-sample the raster data. No filtering or interpolating is
           done, however; the x_inc and y_inc of the grd file must be multiples of
           the increments of the raster file and grdraster simply takes every n’th
           point.   The  output  of  grdraster  is either grid or pixel registered
           depending on the registration of the raster used. It is up to  the  GMT
           system  person  to  maintain the grdraster.info file in accordance with
           the available rasters at each site. Raster data sets are  not  supplied
           with GMT but can be obtained by anonymous ftp and on CD-ROM (see README
           page in dbase directory). grdraster will list the available files if no
           arguments are given. Finally, grdraster will write xyz-triplets to std-
           out if no output gridfile name is given

           filenumber
                  An  integer  matching  one  of   the   files   listed   in   the
                  grdraster.info file.

           -R     xmin,  xmax,  ymin, and ymax specify the Region of interest. For
                  geographic regions,  these  limits  correspond  to  west,  east,
                  south,  and north and you may specify them in decimal degrees or
                  in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r  if  lower  left
                  and  upper  right map coordinates are given instead of wesn. The
                  two shorthands  -Rg  -Rd  stand  for  global  domain  (0/360  or
                  -180/+180  in longitude respectively, with -90/+90 in latitude).
                  For calendar time coordinates you may either give relative  time
                  (relative  to  the  selected  TIME_EPOCH  and  in  the  selected
                  TIME_UNIT; append t to -JX|x), or  absolute  time  of  the  form
                  [date]T[clock]  (append  T  to  -JX|x). At least one of date and
                  clock must be present; the T is always required. The date string
                  must  be  of  the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or
                  yyyy[-Www[-d]] (ISO week calendar), while the clock string  must
                  be  of  the form hh:mm:ss[.xxx]. The use of delimiters and their
                  type and positions must be as indicated  (however,  input/output
                  and  plotting  formats are flexible).  If r is appended, you may
                  also specify a map  projection  to  define  the  shape  of  your
                  region.  The  output  region  will be rounded off to the nearest
                  whole grid-step in both dimensions.

## OPTIONS

           -G     Name of output grid file. If not set, the grid will  be  written

                  CYLINDRICAL PROJECTIONS:

                  -Jclon0/lat0/scale (Cassini)
                  -Jjlon0/scale (Miller)
                  -Jmscale (Mercator - Greenwich and Equator as origin)
                  -Jmlon0/lat0/scale (Mercator - Give meridian and standard paral-
                  lel)
                  -Joalon0/lat0/azimuth/scale  (Oblique  Mercator  -   point   and
                  azimuth)
                  -Joblon0/lat0/lon1/lat1/scale (Oblique Mercator - two points)
                  -Joclon0/lat0/lonp/latp/scale  (Oblique  Mercator  -  point  and
                  pole)
                  -Jqlon0/scale (Equidistant Cylindrical  Projection  (Plate  Car-
                  ree))
                  -Jtlon0/scale (TM - Transverse Mercator, with Equator as y = 0)
                  -Jtlon0/lat0/scale (TM - Transverse Mercator, set origin)
                  -Juzone/scale (UTM - Universal Transverse Mercator)
                  -Jylon0/lats/scale (Basic Cylindrical Projection)

                  AZIMUTHAL PROJECTIONS:

                  -Jalon0/lat0/scale (Lambert).
                  -Jelon0/lat0/scale (Equidistant).
                  -Jflon0/lat0/horizon/scale (Gnomonic).
                  -Jglon0/lat0/scale (Orthographic).
                  -Jslon0/lat0/[slat/]scale (General Stereographic)

                  CONIC PROJECTIONS:

                  -Jblon0/lat0/lat1/lat2/scale (Albers)
                  -Jdlon0/lat0/lat1/lat2/scale (Equidistant)
                  -Jllon0/lat0/lat1/lat2/scale (Lambert)

                  MISCELLANEOUS PROJECTIONS:

                  -Jhlon0/scale (Hammer)
                  -Jilon0/scale (Sinusoidal)
                  -Jk[f|s]lon0/scale (Eckert IV (f) and VI (s))
                  -Jnlon0/scale (Robinson)
                  -Jrlon0/scale (Winkel Tripel)
                  -Jvlon0/scale (Van der Grinten)
                  -Jwlon0/scale (Mollweide)

                  NON-GEOGRAPHICAL PROJECTIONS:

                  -Jp[a]scale[/origin]  (polar  (theta,r)  coordinates, optional a
                  for azimuths and offset theta [0])
                  -Jxx-scale[l|ppow][/y-scale[l|ppow]][d] (Linear, log, and  power
                  scaling)
                  More details can be found in the psbasemap man pages.

           -V     Selects verbose mode, which will send progress reports to stderr
                  [Default runs "silently"].

           of  grdraster  has  edges defined by parallels and meridians, while the
           oblique map in general does not. Hence, to get all the data  from  data
           set  3 needed to make a contour map for the region defined by its lower
           left and upper right corners and the desired projection, use

           grdraster 3 -R160/20/220/30r -Joc190/25.5/292/69/1 -Gdata.grd

           To extract data from raster 3 and write it as binary  double  precision
           xyz-triplets to standard output:

           grdraster 3 -R20/25/-10/5 -bo >! triplets.b

## SEE ALSO

           gmtdefaults(GMTMANSECTION),   gmt(GMTMANSECTION),  grdsample(GMTMANSEC-
           TION), grdfilter(GMTMANSECTION)

## REFERENCES

           Wessel, P., and W. H. F. Smith, 2004, The Generic Mapping  Tools  (GMT)
           version 4 Technical Reference & Cookbook, SOEST/NOAA.
           Wessel,  P., and W. H. F. Smith, 1998, New, Improved Version of Generic
           Mapping Tools Released, EOS Trans., AGU, 79 (47), p. 579.
           Wessel, P., and W. H. F. Smith, 1995, New Version of the  Generic  Map-
           ping Tools Released, EOS Trans., AGU, 76 (33), p. 329.
           Wessel,  P.,  and W. H. F. Smith, 1995, New Version of the Generic Map-
           ping Tools Released, http: American Geophysical Union.
           Wessel, P., and W. H. F. Smith, 1991, Free Software Helps Map and  Dis-
           play Data, EOS Trans., AGU, 72 (41), p. 441.

    GMT4.0                            1 Oct 2004          GRDRASTER(GMTMANSECTION)