#2053: r.recode: 0.0 or 1.0 as limits do not seem to be taken into account
------------------------------------------+---------------------------------
Reporter: nikosa | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: unspecified
Keywords: r.recode, DCELL, CELL, rules | Platform: Unspecified
Cpu: Unspecified |
------------------------------------------+---------------------------------
Comment(by annakrat):
I've just run into this problem too. For some reason, r.recode tries to
guess the input type from the recode rules which seems to be nonsense and
leads to the errors above. -1.00 is considered as -1 and it reads the
values from the input map as integers although the map can be DCELL. A
simple change like this (they might be some more elegant way) seems to do
what everyone expects:
{{{
Index: read_rules.c
===================================================================
--- read_rules.c (revision 61256)
+++ read_rules.c (working copy)
@@ -50,7 +50,7 @@
DCELL oLow, oHigh, nLow, nHigh;
int line, n;
- in_type = out_type = CELL_TYPE;
+ in_type = Rast_map_type(name, "");
rules = (char **)G_malloc(INCR * sizeof(char *));
rule_size = INCR;
@@ -98,16 +98,12 @@
lookup the values in the quant table */
switch (sscanf(buf, "%lf:%lf:%lf:%lf", &oLow, &oHigh, &nLow,
&nHigh)) {
case 3:
- update_type(&in_type, oLow);
- update_type(&in_type, oHigh);
update_type(&out_type, nLow);
update_rules(buf);
Rast_fpreclass_add_rule(&rcl_struct, oLow, oHigh, nLow, nLow);
break;
case 4:
- update_type(&in_type, oLow);
- update_type(&in_type, oHigh);
update_type(&out_type, nLow);
update_type(&out_type, nHigh);
update_rules(buf);
}}}
It could be even enough if r.recode reads the map values as doubles always
and takes care just of the output map type.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2053#comment:2>
GRASS GIS <http://grass.osgeo.org>
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev