param.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 RAD2DEG M_R2D
  19. #define DEG2RAD M_D2R
  20. #define TINY 1.0e-20
  21. /* Bug? start with 1 as G_set_cats() doesn't accept 0 category */
  22. #define FLAT 1
  23. #define PIT 2
  24. #define CHANNEL 3
  25. #define PASS 4
  26. #define RIDGE 5
  27. #define PEAK 6
  28. #define NUM_CATS 7
  29. #define ELEV 1
  30. #define SLOPE 2
  31. #define ASPECT 3
  32. #define PROFC 4
  33. #define PLANC 5
  34. #define LONGC 6
  35. #define CROSC 7
  36. #define MINIC 8
  37. #define MAXIC 9
  38. #define FEATURE 10
  39. /* The six quadratic coefficients are stored in the array coeff */
  40. #define C_A coeff[0]
  41. #define C_B coeff[1]
  42. #define C_C coeff[2]
  43. #define C_D coeff[3]
  44. #define C_E coeff[4]
  45. #define C_F coeff[5]
  46. /* ------ Declare functions ----- */
  47. DCELL param(int ptype, double *coeff); /* Calculates terrain parameters. */
  48. void interface(int argc, char **argv);
  49. void open_files(void);
  50. void process(void);
  51. void close_down(void);
  52. void write_cols(void);
  53. void write_cats(void);
  54. void find_normal(double **normal, /* Matrix of cross-products. */
  55. double *w); /* Weights matrix. */
  56. void find_obs(DCELL * z, /* Local window of elevs. */
  57. double *obs, /* Observed column vector. */
  58. double *w); /* Weighting matrix. */
  59. void find_weight(double *weight_ptr);
  60. DCELL feature(double *coeff); /* Set of six quadratic coefficients. */
  61. /* ------ Global variables ------ */
  62. extern const char
  63. *rast_in_name, /* Name of the raster file to process. */
  64. *rast_out_name; /* Name of the raster output file. */
  65. extern int
  66. constrained; /* Flag that forces quadtratic through */
  67. /* the central cell of the window. */
  68. extern int
  69. fd_in, /* File descriptor for input and */
  70. fd_out, /* output raster files. */
  71. wsize, /* Size of local processing window. */
  72. mparam; /* Morphometric parameter to calculate. */
  73. extern double
  74. resoln, /* Planimetric resolution. */
  75. exponent, /* Distance weighting exponent. */
  76. zscale, /* Vertical scaling factor. */
  77. slope_tol, /* Vertical tolerences for surface */
  78. curve_tol; /* feature identification. */