8
8
/*****************************************************************************/
10
10
#include <string.h>
11
#include <grass/raster.h>
14
15
void close_down(void)
16
17
struct History history;
17
char map_title[RECORD_LEN], map_type[32];
18
char map_title[80], map_type[32];
19
20
/* Close connection with existing input raster. */
22
23
/* Write output raster map and close connection. */
25
26
/* write out map metadata */
26
G_short_history(rast_out_name, "raster", &history);
27
Rast_short_history(rast_out_name, "raster", &history);
28
strncpy(history.datsrc_1, rast_in_name, RECORD_LEN-1);
29
history.datsrc_1[RECORD_LEN-1] = '\0';
29
Rast_set_history(&history, HIST_DATSRC_1, rast_in_name);
38
38
strcpy(map_type, "Magnitude of maximum gradient");
39
G_write_raster_units(rast_out_name, "degrees");
39
Rast_write_units(rast_out_name, "degrees");
41
strcpy(history.edhist[0],
42
43
"Slope is given for steepest slope angle and measured in degrees.");
43
history.edlinecnt = 1;
47
47
strcpy(map_type, "Direction of maximum gradient");
48
G_write_raster_units(rast_out_name, "degrees");
48
Rast_write_units(rast_out_name, "degrees");
50
strcpy(history.edhist[0],
51
52
"Flow direction (aspect): W=0, E=180, N=+90, S=-90 degrees");
52
history.edlinecnt = 1;
56
56
strcpy(map_type, "Profile curvature");
57
strcpy(history.edhist[0],
58
59
"Curvature intersecting with the plane defined by the Z axis and");
59
strcpy(history.edhist[1],
60
62
"maximum gradient direction. Positive values describe convex profile");
61
strcpy(history.edhist[2], "curvature, negative values concave profile.");
62
history.edlinecnt = 3;
65
"curvature, negative values concave profile.");
66
69
strcpy(map_type, "Plan curvature");
67
strcpy(history.edhist[0],
68
72
"Plan curvature is the horizontal curvature, intersecting with");
69
strcpy(history.edhist[1],
71
history.edlinecnt = 2;
75
79
strcpy(map_type, "Longitudinal curvature");
76
strcpy(history.edhist[0],
77
82
"Longitudinal curvature is the profile curvature intersecting with the");
78
strcpy(history.edhist[1],
79
85
"plane defined by the surfacenormal and maximum gradient direction.");
80
history.edlinecnt = 2;
84
89
strcpy(map_type, "Cross-sectional curvature");
85
strcpy(history.edhist[0],
86
92
"Cross-sectional curvature is the tangential curvature intersecting");
87
strcpy(history.edhist[1],
88
95
"with the plane defined by the surface normal and a tangent to the");
89
strcpy(history.edhist[2],
90
98
"contour - perpendicular to maximum gradient direction.");
91
history.edlinecnt = 3;
95
102
strcpy(map_type, "Minimum curvature");
96
strcpy(history.edhist[0],
97
105
"Measured in direction perpendicular to the direction of of maximum curvature.");
98
history.edlinecnt = 1;
102
109
strcpy(map_type, "Maximum curvature");
103
strcpy(history.edhist[0],
104
112
"The maximum curvature is measured in any direction");
105
history.edlinecnt = 1;
109
116
strcpy(map_type, "Morphometric features");
110
strcpy(history.edhist[0],
111
119
"Morphometric features: peaks, ridges, passes, channels, pits and planes");
112
history.edlinecnt = 1;
120
G_command_history(&history);
121
G_write_history(rast_out_name, &history);
127
Rast_command_history(&history);
128
Rast_write_history(rast_out_name, &history);
123
130
sprintf(map_title, "DEM terrain parameter: %s", map_type);
124
G_put_cell_title(rast_out_name, map_title);
131
Rast_put_cell_title(rast_out_name, map_title);