param.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /************************************************************************/
  2. /*** ***/
  3. /*** param.h ***/
  4. /*** Header file for use with r.param.scale ***/
  5. /*** Jo Wood, ASSIST, Dept of Geography, University of Leicester ***/
  6. /*** V1.0 - 7th February, 1993 ***/
  7. /*** ***/
  8. /************************************************************************/
  9. #include <grass/gis.h>
  10. #include <grass/raster.h>
  11. /* programs. It sets up the necessary */
  12. /* prototypes for GRASS library calls. */
  13. #include <math.h>
  14. #define EDGE ((wsize-1)/2) /* Number of rows/cols that make up the */
  15. /* 'blank' edge around raster. */
  16. #define MAX_WSIZE 499 /* Maximum dimensions of window. */
  17. /* Some useful labels. */
  18. #define TRUE 1
  19. #define FALSE 0
  20. #define RAD2DEG M_R2D
  21. #define DEG2RAD M_D2R
  22. #define TINY 1.0e-20
  23. /* Bug? start with 1 as G_set_cats() doesn't accept 0 category */
  24. #define FLAT 1
  25. #define PIT 2
  26. #define CHANNEL 3
  27. #define PASS 4
  28. #define RIDGE 5
  29. #define PEAK 6
  30. #define NUM_CATS 7
  31. #define ELEV 1
  32. #define SLOPE 2
  33. #define ASPECT 3
  34. #define PROFC 4
  35. #define PLANC 5
  36. #define LONGC 6
  37. #define CROSC 7
  38. #define MINIC 8
  39. #define MAXIC 9
  40. #define FEATURE 10
  41. /* The six quadratic coefficients are stored in the array coeff */
  42. #define C_A coeff[0]
  43. #define C_B coeff[1]
  44. #define C_C coeff[2]
  45. #define C_D coeff[3]
  46. #define C_E coeff[4]
  47. #define C_F coeff[5]
  48. /* ------ Declare functions ----- */
  49. DCELL param(int ptype, double *coeff); /* Calculates terrain parameters. */
  50. void interface(int argc, char **argv);
  51. void open_files(void);
  52. void process(void);
  53. void close_down(void);
  54. void write_cols(void);
  55. void write_cats(void);
  56. void find_normal(double **normal, /* Matrix of cross-products. */
  57. double *w); /* Weights matrix. */
  58. void find_obs(DCELL * z, /* Local window of elevs. */
  59. double *obs, /* Observed column vector. */
  60. double *w); /* Weighting matrix. */
  61. void find_weight(double *weight_ptr);
  62. DCELL feature(double *coeff); /* Set of six quadratic coefficients. */
  63. /* ------ Global variables ------ */
  64. extern const char
  65. *rast_in_name, /* Name of the raster file to process. */
  66. *rast_out_name; /* Name of the raster output file. */
  67. extern int
  68. constrained; /* Flag that forces quadtratic through */
  69. /* the central cell of the window. */
  70. extern int
  71. fd_in, /* File descriptor for input and */
  72. fd_out, /* output raster files. */
  73. wsize, /* Size of local processing window. */
  74. mparam; /* Morphometric parameter to calculate. */
  75. extern double
  76. resoln, /* Planimetric resolution. */
  77. exponent, /* Distance weighting exponent. */
  78. zscale, /* Vertical scaling factor. */
  79. slope_tol, /* Vertical tolerences for surface */
  80. curve_tol; /* feature identification. */