6
* do_histogram() - Creates histogram for CELL
8
* RETURN: EXIT_SUCCESS / EXIT_FAILURE
10
int do_histogram(char *name, char *mapset)
13
struct Cell_head cellhd;
14
struct Cell_stats statf;
19
if (G_get_cellhd(name, mapset, &cellhd) < 0)
22
G_set_window(&cellhd);
23
if ((fd = G_open_cell_old(name, mapset)) < 0)
26
nrows = G_window_rows();
27
ncols = G_window_cols();
28
cell = G_allocate_cell_buf();
30
G_init_cell_stats(&statf);
31
for (row = 0; row < nrows; row++) {
32
if (G_get_map_row_nomask(fd, cell, row) < 0)
35
G_update_cell_stats(cell, ncols, &statf);
39
G_write_histogram_cs(name, &statf);
41
G_free_cell_stats(&statf);