~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to raster3d/r3.support/check.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdlib.h>
 
2
#include <grass/gis.h>
 
3
#include <grass/raster.h>
 
4
#include <grass/raster3d.h>
 
5
#include <grass/glocale.h>
 
6
#include "local_proto.h"
 
7
 
 
8
 
 
9
/*
 
10
 * check_stats() - Check and update statistics 
 
11
 *
 
12
 * RETURN: EXIT_SUCCESS / EXIT_FAILURE
 
13
 */
 
14
int check_stats(const char *name)
 
15
{
 
16
    struct Categories cats;
 
17
    struct FPRange fprange;
 
18
    int cats_ok;
 
19
 
 
20
    G_message(_("Updating statistics for <%s>"), name);
 
21
    
 
22
    /* Get category status and max */
 
23
    cats_ok = (Rast3d_read_cats(name, "", &cats) >= 0);
 
24
    Rast3d_read_range(name, "", &fprange);
 
25
 
 
26
    /* Further category checks */
 
27
    if (!cats_ok)
 
28
        Rast_init_cats("", &cats);
 
29
    else if (cats.num != fprange.max) {
 
30
        cats.num = fprange.max;
 
31
        cats_ok = 0;
 
32
    }
 
33
 
 
34
    /* Update categories if needed */
 
35
    if (!cats_ok) {
 
36
        G_message(_("Updating the number of categories for <%s>"), name);
 
37
        Rast3d_write_cats(name, &cats);
 
38
    }
 
39
    Rast_free_cats(&cats);
 
40
 
 
41
    return 0;
 
42
}