[prev in list] [next in list] [prev in thread] [next in thread]
List: grass-commit
Subject: [GRASS-SVN] r69035 - grass/branches/releasebranch_7_0/imagery/i.vi
From: svn_grass () osgeo ! org
Date: 2016-07-24 23:40:29
Message-ID: 20160724234029.8B824390148 () trac ! osgeo ! org
[Download RAW message or body]
Author: neteler
Date: 2016-07-24 16:40:29 -0700 (Sun, 24 Jul 2016)
New Revision: 69035
Modified:
grass/branches/releasebranch_7_0/imagery/i.vi/main.c
Log:
i.vi: print msg which index is actually calculated; fix ARVI name; apply standard \
NDVI color table in case of viname=ndvi (trunk, r68692)
Modified: grass/branches/releasebranch_7_0/imagery/i.vi/main.c
===================================================================
--- grass/branches/releasebranch_7_0/imagery/i.vi/main.c 2016-07-24 23:37:59 UTC (rev \
69034)
+++ grass/branches/releasebranch_7_0/imagery/i.vi/main.c 2016-07-24 23:40:29 UTC (rev \
69035) @@ -112,7 +112,7 @@
G_asprintf(&desc,
"arvi;%s;dvi;%s;evi;%s;evi2;%s;gvi;%s;gari;%s;gemi;%s;ipvi;%s;msavi;%s;"
"msavi2;%s;ndvi;%s;pvi;%s;savi;%s;sr;%s;vari;%s;wdvi;%s",
- _("Atmospherically Resistant Vegetation Indices"),
+ _("Atmospherically Resistant Vegetation Index"),
_("Difference Vegetation Index"),
_("Enhanced Vegetation Index"),
_("Enhanced Vegetation Index 2"),
@@ -222,6 +222,7 @@
if(opt.bits->answer)
dnbits = atof(opt.bits->answer);
result = opt.output->answer;
+ G_message(_("Calculating %s"), viflag);
if (!strcasecmp(viflag, "sr") && (!(opt.red->answer) || !(opt.nir->answer)) )
G_fatal_error(_("sr index requires red and nir maps"));
@@ -534,11 +535,20 @@
G_free(outrast);
Rast_close(outfd);
- /* Color from -1.0 to +1.0 in grey */
- Rast_init_colors(&colors);
- val1 = -1;
- val2 = 1;
- Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
+ if (!strcasecmp(viflag, "ndvi")) {
+ /* apply predefined NDVI color table */
+ const char *style = "ndvi";
+ if (G_find_color_rule("ndvi")) {
+ Rast_make_fp_colors(&colors, style, -1.0, 1.0);
+ } else
+ G_fatal_error(_("Unknown color request '%s'"), style);
+ } else {
+ /* Color from -1.0 to +1.0 in grey */
+ Rast_init_colors(&colors);
+ val1 = -1;
+ val2 = 1;
+ Rast_add_c_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
+ }
Rast_write_colors(result, G_mapset(), &colors);
Rast_short_history(result, "raster", &history);
_______________________________________________
grass-commit mailing list
grass-commit@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic