~ubuntu-branches/ubuntu/precise/grass/precise

« back to all changes in this revision

Viewing changes to raster/r.neighbors/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-04-13 17:08:41 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110413170841-ss1t9bic0d0uq0gz
Tags: 6.4.1-1
* New upstream version.
* Now build-dep on libjpeg-dev and current libreadline6-dev.
* Removed patch swig: obsolete.
* Policy bumped to 3.9.2, without changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    {c_mode, w_mode, NO_CATS, 1, 0, "mode", "most frequently occuring value"},
50
50
    {c_min, NULL, NO_CATS, 1, 0, "minimum", "lowest value"},
51
51
    {c_max, NULL, NO_CATS, 1, 0, "maximum", "highest value"},
 
52
    {c_range, NULL, NO_CATS, 1, 0, "range", "range value"},
52
53
    {c_stddev, w_stddev, NO_CATS, 0, 1, "stddev", "standard deviation"},
53
54
    {c_sum, w_sum, NO_CATS, 1, 0, "sum", "sum of values"},
54
55
    {c_var, w_var, NO_CATS, 0, 1, "variance", "statistical variance"},
89
90
        struct Option *method, *size;
90
91
        struct Option *title;
91
92
        struct Option *weight;
 
93
        struct Option *gauss;
92
94
    } parm;
93
95
    struct
94
96
    {
153
155
    parm.weight->gisprompt = "old_file,file,input";
154
156
    parm.weight->description = _("File containing weights");
155
157
 
 
158
    parm.gauss = G_define_option();
 
159
    parm.gauss->key = "gauss";
 
160
    parm.gauss->type = TYPE_DOUBLE;
 
161
    parm.gauss->required = NO;
 
162
    parm.gauss->description = _("Sigma (in cells) for Gaussian filter");
 
163
 
156
164
    flag.align = G_define_flag();
157
165
    flag.align->key = 'a';
158
166
    flag.align->description = _("Do not align output with the input");
189
197
        G_fatal_error(_("<%s> is an illegal file name"), p);
190
198
    }
191
199
    ncb.newcell.mapset = G_mapset();
 
200
    if (parm.weight->answer && parm.gauss->answer)
 
201
        G_fatal_error(_("weight= and gauss= are mutually exclusive"));
192
202
 
193
203
    if (!flag.align->answer) {
194
204
        if (G_get_cellhd(ncb.oldcell.name, ncb.oldcell.mapset, &cellhd) < 0)
240
250
        if (!newvalue_w)
241
251
            weights_mask();
242
252
    }
 
253
    else if (parm.gauss->answer) {
 
254
        if (!newvalue_w)
 
255
            G_fatal_error(_("Method %s not compatible with Gaussian filter"), parm.method->answer);
 
256
        gaussian_weights(atof(parm.gauss->answer));
 
257
    }
243
258
    else
244
259
        newvalue_w = NULL;
245
260
 
302
317
                G_set_d_null_value(rp, 1);
303
318
            else {
304
319
                if (newvalue_w)
305
 
                    newvalue_w(rp, values_w, n);
 
320
                    newvalue_w(rp, values_w, n, NULL);
306
321
                else
307
 
                    newvalue(rp, values, n);
 
322
                    newvalue(rp, values, n, NULL);
308
323
 
309
324
                if (half && !G_is_d_null_value(rp))
310
325
                    *rp += 0.5;