[GRASS-SVN] r63401 - grass-addons/grass7/imagery/i.theilsen
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 6 09:43:22 PST 2014
Author: ychemin
Date: 2014-12-06 09:43:22 -0800 (Sat, 06 Dec 2014)
New Revision: 63401
Modified:
grass-addons/grass7/imagery/i.theilsen/main.c
Log:
Palette fixing
Modified: grass-addons/grass7/imagery/i.theilsen/main.c
===================================================================
--- grass-addons/grass7/imagery/i.theilsen/main.c 2014-12-06 17:01:19 UTC (rev 63400)
+++ grass-addons/grass7/imagery/i.theilsen/main.c 2014-12-06 17:43:22 UTC (rev 63401)
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <math.h>
#include <grass/imagery.h>
#include <grass/glocale.h>
@@ -49,7 +50,7 @@
int outfd0, outfd1;
DCELL *outrast0, *outrast1;
- CELL val1, val2;
+ DCELL val1, val2;
/************************************/
G_gisinit(argv[0]);
@@ -153,9 +154,9 @@
/* Extract median slope (list halfway) */
outrast0[col] = sorted[n0n1/2];
/* Prepare Theil-Sen colour palette range from data */
- if (sorted[n0n1/2]<min)
+ if (sorted[n0n1/2]<ts_min)
ts_min=sorted[n0n1/2];
- if (sorted[n0n1/2]>max)
+ if (sorted[n0n1/2]>ts_max)
ts_max=sorted[n0n1/2];
/* Mann-Kendall Trend Test */
/* Not yet implemented */
@@ -184,8 +185,8 @@
/* Color table from slope min to slope max */
Rast_init_colors(&colors);
val1 = ts_min;
- val2 = ts_max;
- Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
+ val2 = ceil(ts_max);
+ Rast_add_d_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
/* Metadata */
Rast_short_history(out0->answer, "raster", &history);
Rast_command_history(&history);
@@ -194,8 +195,8 @@
/* Color table from Mann-Kendall test min and max */
Rast_init_colors(&colors);
val1 = mk_min;
- val2 = mk_max;
- Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
+ val2 = ceil(mk_max);
+ Rast_add_d_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
/* Metadata */
Rast_short_history(out1->answer, "raster", &history);
Rast_command_history(&history);
More information about the grass-commit
mailing list