[pktools] 307/375: support different bounding box in ImgRegression.cc

Bas Couwenberg sebastic at xs4all.nl
Wed Dec 3 21:54:24 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 a29bbe4518708375801e892cc3f4b7617ddef5a8
Author: Pieter Kempeneers <kempenep at gmail.com>
Date:   Wed Jul 9 11:18:25 2014 +0200

    support different bounding box in ImgRegression.cc
---
 src/algorithms/ImgRegression.cc | 4 ++++
 src/apps/pkkalman.cc            | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/algorithms/ImgRegression.cc b/src/algorithms/ImgRegression.cc
index df88973..55b3c2f 100644
--- a/src/algorithms/ImgRegression.cc
+++ b/src/algorithms/ImgRegression.cc
@@ -50,6 +50,8 @@ double ImgRegression::getRMSE(const ImgReaderGdal& imgReader1, const ImgReaderGd
     imgReader2.geo2image(geox,geoy,icol2,irow2);
     icol2=static_cast<int>(icol2);
     irow2=static_cast<int>(irow2);
+    if(irow2<0||irow2>=imgReader2.nrOfRow())
+      continue;
     imgReader2.readData(rowBuffer2,GDT_Float64,irow2);
     for(icol1=0;icol1<imgReader1.nrOfCol();++icol1){
       if(icol1%m_down)
@@ -62,6 +64,8 @@ double ImgRegression::getRMSE(const ImgReaderGdal& imgReader1, const ImgReaderGd
       }
       imgReader1.image2geo(icol1,irow1,geox,geoy);
       imgReader2.geo2image(geox,geoy,icol2,irow2);
+      if(icol2<0||icol2>=imgReader2.nrOfCol())
+	continue;
       icol2=static_cast<int>(icol2);
       irow2=static_cast<int>(irow2);
       //check for nodata
diff --git a/src/apps/pkkalman.cc b/src/apps/pkkalman.cc
index f07c062..30dcda8 100644
--- a/src/apps/pkkalman.cc
+++ b/src/apps/pkkalman.cc
@@ -27,8 +27,6 @@ along with pktools.  If not, see <http://www.gnu.org/licenses/>.
 #include "algorithms/StatFactory.h"
 #include "algorithms/ImgRegression.h"
 
-				    //todo: keep original resolution of coarse model raster dataset
-				    //interprete 2nd band of obs dataset as uncert
 using namespace std;
 /*------------------
   Main procedure
@@ -423,6 +421,8 @@ int main(int argc,char **argv) {
 	if(verbose_opt[0])
 	  cout << "Calculating regression for " << imgReaderModel2.getFileName() << " " << imgReaderObs.getFileName() << endl;
 	errObs=imgreg.getRMSE(imgReaderModel2,imgReaderObs,c0obs,c1obs,verbose_opt[0]);
+	if(verbose_opt[0])
+	  cout << "c0obs, c1obs: " << c0obs << ", " << c1obs << endl;
       }
       //prediction (also to fill cloudy pixels in update mode)
       string input;

-- 
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