home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / gmt_os2.zip / src / gmt_grd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-17  |  2.2 KB  |  59 lines

  1. /*--------------------------------------------------------------------
  2.  *    The GMT-system:    @(#)gmt_grd.h    3.3  2/17/95
  3.  *
  4.  *    Copyright (c) 1991-1995 by P. Wessel and W. H. F. Smith
  5.  *    See README file for copying and redistribution conditions.
  6.  *--------------------------------------------------------------------*/
  7. /*
  8.  * grd.h contains the definition for a GMT-SYSTEM Version >= 2 grd file
  9.  *
  10.  * grd is stored in rows going from west (xmin) to east (xmax)
  11.  * first row in file has yvalue = north (ymax).  
  12.  * Author:    Paul Wessel
  13.  * Date:    26-MAY-1990
  14.  */
  15.  
  16. #include "netcdf.h"
  17.  
  18. /* Nodes that are unconstrained are assumed to be set to NaN */
  19.  
  20.  
  21. struct GRD_HEADER {
  22.     int nx;            /* Number of columns */
  23.     int ny;            /* Number of rows */
  24.     int node_offset;    /* 0 for node grids, 1 for pixel grids */
  25.     double x_min;        /* Minimum x coordinate */
  26.     double x_max;        /* Maximum x coordinate */
  27.     double y_min;        /* Minimum y coordinate */
  28.     double y_max;        /* Maximum y coordinate */
  29.     double z_min;        /* Minimum z value */
  30.     double z_max;        /* Maximum z value */
  31.     double x_inc;        /* x increment */
  32.     double y_inc;        /* y increment */
  33.     double z_scale_factor;    /* grd values must be multiplied by this */
  34.     double z_add_offset;    /* After scaling, add this */
  35.     char x_units[80];    /* units in x-direction */
  36.     char y_units[80];    /* units in y-direction */
  37.     char z_units[80];    /* grid value units */
  38.     char title[80];        /* name of data set */
  39.     char command[320];    /* name of generating command */
  40.     char remark[160];    /* comments re this data set */
  41. };
  42.  
  43. /* Note on node_offset:
  44.     Assume x_min = y_min = 0 and x_max = y_max = 10 and x_inc = y_inc = 1.
  45.     For a normal node grid we have:
  46.         (1) nx = (x_max - x_min) / x_inc + 1 = 11
  47.             ny = (y_max - y_min) / y_inc + 1 = 1
  48.         (2) node # 0 is at (x,y) = (x_min, y_max) = (0,10) and represents the surface
  49.             value in a box with dimensions (1,1) centered on the node.
  50.     For a pixel grid we have:
  51.         (1) nx = (x_max - x_min) / x_inc = 10
  52.             ny = (y_max - y_min) / y_inc = 10
  53.         (2) node # 0 is at (x,y) = (x_min + 0.5*x_inc, y_max - 0.5*y_inc) = (0.5, 9.5)
  54.             and represents the surface value in a box with dimensions (1,1)
  55.             centered on the node.
  56. */
  57.  
  58.         
  59.