2
************************************************************
3
* MODULE: r.le.patch/main.c *
4
* Version 5.0 Nov. 1, 2001 *
6
* AUTHOR: W.L. Baker, University of Wyoming *
9
* PURPOSE: To analyze attributes of patches in a landscape *
10
* main.c calls user_input.c to read the user's *
11
* requests from the screen, then displays those *
12
* choices on screen and calls patch_fore *
14
* COPYRIGHT: (C) 2001 by W.L. Baker *
16
* This program is free software under the GNU General *
17
* Public License(>=v2). Read the file COPYING that comes *
18
* with GRASS for details *
20
************************************************************/
25
#include <grass/gis.h>
26
#include <grass/glocale.h>
28
#include <grass/config.h>
33
struct CHOICE *choice;
36
int main(int argc, char **argv)
38
struct GModule *module;
40
/* initialize the GRASS GIS system */
43
/* allocate space for the choice data structure */
44
choice = (struct CHOICE *)G_calloc(1, sizeof(struct CHOICE));
46
module = G_define_module();
47
module->keywords = _("raster, landscape structure analysis, patch index");
49
_("Calculates attribute, patch size, core (interior) size, shape, "
50
"fractal dimension, and perimeter measures for sets of patches "
53
/* call user_input to read in the parameters */
54
user_input(argc, argv);
57
/* display the parameter choices */
58
fprintf(stderr, "\nPARAMETER CHOICES:\n");
59
fprintf(stderr, "\tMAP:\t %s\n", choice->fn);
60
if (choice->wrum == 'r')
61
fprintf(stderr, "\tREGION:\t %s\n", choice->reg);
63
fprintf(stderr, "\tSAMPLE:");
64
if (choice->wrum == 'w')
65
fprintf(stderr, "\t whole map ");
66
if (choice->wrum == 'm')
67
fprintf(stderr, "\t moving window");
68
if (choice->wrum == 'u')
69
fprintf(stderr, "\t units ");
70
if (choice->wrum == 'r')
71
fprintf(stderr, "\t regions ");
73
fprintf(stderr, "\tTRACING:");
75
fprintf(stderr, " 8 neighbor\n");
77
fprintf(stderr, " 4 neighbor\n");
79
if (choice->coremap || choice->patchmap || choice->units)
80
fprintf(stderr, "\tOUTPUT MAPS:\n");
82
fprintf(stderr, "\t\t interior\n");
84
fprintf(stderr, "\t\t num\n");
86
fprintf(stderr, "\t\t units_x\n");
89
fprintf(stderr, "\tATTRIBUTE MEASURES:\n");
91
fprintf(stderr, "\t\t mean pixel attribute\n");
93
fprintf(stderr, "\t\t st. dev. pixel attribute\n");
95
fprintf(stderr, "\t\t mean patch attribute\n");
97
fprintf(stderr, "\t\t st. dev. patch attribute\n");
99
fprintf(stderr, "\t\t cover by gp\n");
101
fprintf(stderr, "\t\t density by gp\n");
103
fprintf(stderr, "\t\t total density\n");
105
fprintf(stderr, "\t\t eff. mesh no.\n");
108
fprintf(stderr, "\tSIZE MEASURES:\n");
110
fprintf(stderr, "\t\t mean patch size\n");
112
fprintf(stderr, "\t\t st. dev. patch size\n");
114
fprintf(stderr, "\t\t mean patch size by gp\n");
116
fprintf(stderr, "\t\t st. dev. patch size by gp\n");
118
fprintf(stderr, "\t\t no. by size class\n");
120
fprintf(stderr, "\t\t no. by size class by gp\n");
122
fprintf(stderr, "\t\t eff. mesh size\n");
124
fprintf(stderr, "\t\t deg. landsc. division\n");
128
fprintf(stderr, "\tCORE MEASURES:\n");
130
fprintf(stderr, "\t\t mean core size\n");
132
fprintf(stderr, "\t\t st. dev. core size\n");
134
fprintf(stderr, "\t\t mean edge size\n");
136
fprintf(stderr, "\t\t st. dev. edge size\n");
138
fprintf(stderr, "\t\t mean core size by gp\n");
140
fprintf(stderr, "\t\t st. dev. core size by gp\n");
142
fprintf(stderr, "\t\t mean edge size by gp \n");
144
fprintf(stderr, "\t\t st. dev. edge size by gp\n");
146
fprintf(stderr, "\t\t no. by size class \n");
147
if (choice->core[10])
148
fprintf(stderr, "\t\t no. by size class by gp\n");
150
if (choice->shape[0])
151
fprintf(stderr, "\tSHAPE MEASURES:\n");
152
if (choice->shape[1])
153
fprintf(stderr, "\t\t mean patch shape\n");
154
if (choice->shape[2])
155
fprintf(stderr, "\t\t st. dev. patch shape\n");
156
if (choice->shape[3])
157
fprintf(stderr, "\t\t mean patch shape by gp\n");
158
if (choice->shape[4])
159
fprintf(stderr, "\t\t st. dev. patch shape by gp\n");
160
if (choice->shape[5])
161
fprintf(stderr, "\t\t no. by shape class\n");
162
if (choice->shape[6])
163
fprintf(stderr, "\t\t no. by shape class by gp\n");
165
if (choice->boundary[0])
166
fprintf(stderr, "\tBOUNDARY COMPLEXITY MEASURES:\n");
167
if (choice->boundary[1])
168
fprintf(stderr, "\t\t mean twist number\n");
169
if (choice->boundary[2])
170
fprintf(stderr, "\t\t st. dev. twist number\n");
171
if (choice->boundary[3])
172
fprintf(stderr, "\t\t mean omega index\n");
173
if (choice->boundary[4])
174
fprintf(stderr, "\t\t st. dev. omega index\n");
176
if (choice->perim[0])
177
fprintf(stderr, "\tPERIMETER MEASURES:\n");
178
if (choice->perim[1])
179
fprintf(stderr, "\t\t sum of perims\n");
180
if (choice->perim[2])
181
fprintf(stderr, "\t\t mean perim.\n");
182
if (choice->perim[3])
183
fprintf(stderr, "\t\t st. dev. perim.\n");
184
if (choice->perim[4])
185
fprintf(stderr, "\t\t sum of perims. by gp\n");
186
if (choice->perim[5])
187
fprintf(stderr, "\t\t mean perim. by gp\n");
188
if (choice->perim[6])
189
fprintf(stderr, "\t\t st. dev. perim. by gp\n");
191
/* if not moving window, setup the
192
r.le.out subdirectory */
194
if (choice->wrum != 'm')
200
return (EXIT_SUCCESS);