gmt_grd.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*--------------------------------------------------------------------
  2. * The GMT-system: @(#)gmt_grd.h 3.18 01/13/00
  3. *
  4. * Copyright (c) 1991-2000 by P. Wessel and W. H. F. Smith
  5. * See COPYING file for copying and redistribution conditions.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * Contact info: www.soest.hawaii.edu/gmt
  17. *--------------------------------------------------------------------*/
  18. /*
  19. * grd.h contains the definition for a GMT-SYSTEM Version >= 2 grd file
  20. *
  21. * grd is stored in rows going from west (xmin) to east (xmax)
  22. * first row in file has yvalue = north (ymax).
  23. * This is SCANLINE orientation.
  24. *
  25. * Author: Paul Wessel
  26. * Date: 26-MAY-1990
  27. * Revised: 21-OCT-1998
  28. */
  29. /* Nodes that are unconstrained are assumed to be set to NaN */
  30. #define GRD_COMMAND_LEN 320
  31. #define GRD_REMARK_LEN 160
  32. #define GRD_TITLE_LEN 80
  33. #define GRD_UNIT_LEN 80
  34. struct GRD_HEADER
  35. {
  36. int nx; /* Number of columns */
  37. int ny; /* Number of rows */
  38. int node_offset; /* 0 for node grids, 1 for pixel grids */
  39. double x_min; /* Minimum x coordinate */
  40. double x_max; /* Maximum x coordinate */
  41. double y_min; /* Minimum y coordinate */
  42. double y_max; /* Maximum y coordinate */
  43. double z_min; /* Minimum z value */
  44. double z_max; /* Maximum z value */
  45. double x_inc; /* x increment */
  46. double y_inc; /* y increment */
  47. double z_scale_factor; /* grd values must be multiplied by this */
  48. double z_add_offset; /* After scaling, add this */
  49. char x_units[GRD_UNIT_LEN]; /* units in x-direction */
  50. char y_units[GRD_UNIT_LEN]; /* units in y-direction */
  51. char z_units[GRD_UNIT_LEN]; /* grid value units */
  52. char title[GRD_TITLE_LEN]; /* name of data set */
  53. char command[GRD_COMMAND_LEN]; /* name of generating command */
  54. char remark[GRD_REMARK_LEN]; /* comments re this data set */
  55. };
  56. /*-----------------------------------------------------------------------------------------
  57. * Notes on node_offset:
  58. Assume x_min = y_min = 0 and x_max = y_max = 10 and x_inc = y_inc = 1.
  59. For a normal node grid we have:
  60. (1) nx = (x_max - x_min) / x_inc + 1 = 11
  61. ny = (y_max - y_min) / y_inc + 1 = 1
  62. (2) node # 0 is at (x,y) = (x_min, y_max) = (0,10) and represents the surface
  63. value in a box with dimensions (1,1) centered on the node.
  64. For a pixel grid we have:
  65. (1) nx = (x_max - x_min) / x_inc = 10
  66. ny = (y_max - y_min) / y_inc = 10
  67. (2) node # 0 is at (x,y) = (x_min + 0.5*x_inc, y_max - 0.5*y_inc) = (0.5, 9.5)
  68. and represents the surface value in a box with dimensions (1,1)
  69. centered on the node.
  70. -------------------------------------------------------------------------------------------*/