[pktools] 05/375: support ratio in pkndvi.cc

Bas Couwenberg sebastic at xs4all.nl
Wed Dec 3 21:53:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch upstream-master
in repository pktools.

commit 620ca4f97d3cbfab83828760a7fe34ba0de4d89a
Author: Pieter Kempeneers <kempenep at gmail.com>
Date:   Mon Sep 3 16:18:23 2012 +0200

    support ratio in pkndvi.cc
---
 src/apps/pkndvi.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/apps/pkndvi.cc b/src/apps/pkndvi.cc
index 709a819..1672607 100644
--- a/src/apps/pkndvi.cc
+++ b/src/apps/pkndvi.cc
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
   Optionpk<string> input_opt("i","input","input image file","");
   Optionpk<string> output_opt("o","output","output image file containing ndvi","");
   Optionpk<short> band_opt("b", "band", "Bands to be used for vegetation index (see rule option)", 0);
-  Optionpk<string> rule_opt("r", "rule", "Rule for index. [ndvi (b1-b0)/(b1+b0)|gvmi (b0+0.1)-(b1+0.02))/((b0+0.1)+(b1+0.02)))|vari (b1-b2)/(b1+b2-b0)|diff (b1-b0)|scale.", "ndvi");
+  Optionpk<string> rule_opt("r", "rule", "Rule for index. [ndvi (b1-b0)/(b1+b0)|gvmi (b0+0.1)-(b1+0.02))/((b0+0.1)+(b1+0.02)))|vari (b1-b2)/(b1+b2-b0)|diff (b1-b0)|scale|ratio.", "ndvi");
   Optionpk<double> invalid_opt("t", "invalid", "Mask value where image is invalid.", 0);
   Optionpk<int> flag_opt("f", "flag", "Flag value to put in image if not valid (0)", 0);
   Optionpk<string> colorTable_opt("ct", "ct", "color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid)", "");
@@ -239,6 +239,10 @@ int main(int argc, char *argv[])
           denom=(lineInput[0][icol]-offset_opt[0])/scale_opt[0];
           nom=1.0;
         }
+        else if(rule_opt[0]=="ratio"){
+          denom=(lineInput[0][icol]-offset_opt[0])/scale_opt[0];
+          nom=(lineInput[1][icol]-offset_opt[0])/scale_opt[0];
+        }
         else{
           std::cout << "Error: rule " << rule_opt[0] << " not supported" << std::endl;
           exit(1);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git



More information about the Pkg-grass-devel mailing list