[GRASS-SVN] r31181 - grass-addons/gipe/r.out.vic

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 30 01:30:54 EDT 2008


Author: ychemin
Date: 2008-04-30 01:30:54 -0400 (Wed, 30 Apr 2008)
New Revision: 31181

Modified:
   grass-addons/gipe/r.out.vic/main.c
Log:
Aspect-based r.watershed flow direction to AGNPS final(?) conversion bugfix for output direction file in r.out.vic

Modified: grass-addons/gipe/r.out.vic/main.c
===================================================================
--- grass-addons/gipe/r.out.vic/main.c	2008-04-30 03:57:47 UTC (rev 31180)
+++ grass-addons/gipe/r.out.vic/main.c	2008-04-30 05:30:54 UTC (rev 31181)
@@ -649,7 +649,27 @@
 			/*Grid cell flow direction value in that grid cell*/
 			if(flag2->answer){
 				/* Convert r.watershed flow dir to AGNPS */
-				fprintf(ef,"%d ",c_fdir+1);
+				if(c_fdir==0||c_fdir==8){
+					fprintf(ef,"3 ");
+				} else if(c_fdir==1){
+					fprintf(ef,"2 ");
+				} else if(c_fdir==2){
+					fprintf(ef,"1 ");
+				} else if(c_fdir==3){
+					fprintf(ef,"8 ");
+				} else if(c_fdir==4){
+					fprintf(ef,"7 ");
+				} else if(c_fdir==5){
+					fprintf(ef,"6 ");
+				} else if(c_fdir==6){
+					fprintf(ef,"5 ");
+				} else if(c_fdir==7){
+					fprintf(ef,"4 ");
+				} else if(c_fdir==-1){
+					fprintf(ef,"0 ");
+				} else {
+					fprintf(ef,"0 ");
+				}
 			} else {
 				if(c_fdir==-1){
 					/* Flow direction NODATA_value=0 */



More information about the grass-commit mailing list