[GRASS-SVN] r32975 - in grass-addons/gipe: i.water i.wi

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 21 10:12:59 EDT 2008


Author: ychemin
Date: 2008-08-21 10:12:59 -0400 (Thu, 21 Aug 2008)
New Revision: 32975

Modified:
   grass-addons/gipe/i.water/main.c
   grass-addons/gipe/i.wi/lswi.c
   grass-addons/gipe/i.wi/main.c
Log:
code cleaning, upgrade, standardization

Modified: grass-addons/gipe/i.water/main.c
===================================================================
--- grass-addons/gipe/i.water/main.c	2008-08-21 14:08:23 UTC (rev 32974)
+++ grass-addons/gipe/i.water/main.c	2008-08-21 14:12:59 UTC (rev 32975)
@@ -26,8 +26,8 @@
 
 int main(int argc, char *argv[])
 {
-	struct Cell_head cellhd; //region+header info
-	char *mapset; // mapset name
+	struct Cell_head cellhd; /*region+header info*/
+	char *mapset; /*mapset name*/
 	int nrows, ncols;
 	int row,col;
 
@@ -35,13 +35,13 @@
 	struct Option *input1, *input2, *input3, *output1;
 	
 	struct Flag *flag1;	
-	struct History history; //metadata
+	struct History history; /*metadata*/
 	
 	/************************************/
 	/* FMEO Declarations*****************/
-	char *name;   // input raster name
-	char *result1; //output raster name
-	//File Descriptors
+	char *name;   /*input raster name*/
+	char *result1; /*output raster name*/
+	/*File Descriptors*/
 	int infd_ndvi, infd_albedo, infd_ref7;
 	int outfd1;
 	
@@ -64,23 +64,20 @@
 	/* Define the different options */
 	input1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input1->key	   = _("ndvi");
-	input1->description=_("Name of the NDVI map [-]");
-	input1->answer     =_("ndvi");
+	input1->description=_("Name of the NDVI layer [-]");
 
 	input2 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input2->key        =_("albedo");
 	input2->required   = NO ;
-	input2->description=_("Name of the Albedo map [-]");
+	input2->description=_("Name of the Albedo layer [-]");
 
 	input3 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input3->key        =_("Modref7");
 	input3->required   = NO ;
-	input3->description=_("Name of the Modis surface reflectance band 7 [-]");
+	input3->description=_("Name of the Modis surface reflectance band 7 layer [-]");
 
 	output1 = G_define_standard_option(G_OPT_R_OUTPUT) ;
-	output1->key        =_("water");
 	output1->description=_("Name of the output water layer [0/1]");
-	output1->answer     =_("water");
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);

Modified: grass-addons/gipe/i.wi/lswi.c
===================================================================
--- grass-addons/gipe/i.wi/lswi.c	2008-08-21 14:08:23 UTC (rev 32974)
+++ grass-addons/gipe/i.wi/lswi.c	2008-08-21 14:12:59 UTC (rev 32975)
@@ -2,13 +2,13 @@
 #include<math.h>
 #include<stdlib.h>
 
-// Land Surface Water Index (LWSI)
-// a kind of Normalized Difference Water Index
-// Xiao X., Boles S., Frolking S., Salas W., Moore B., Li C., et al. (2002)
-// Landscape-scale characterization of cropland in China using vegetation and Landsat TM images.
-// International Journal of Remote Sensing, 23:3579-3594.
+/* Land Surface Water Index (LWSI)
+ * a kind of Normalized Difference Water Index
+ * Xiao X., Boles S., Frolking S., Salas W., Moore B., Li C., et al. (2002)
+ * Landscape-scale characterization of cropland in China using vegetation and Landsat TM images.
+ * International Journal of Remote Sensing, 23:3579-3594.
+ */
 
-
 double ls_wi( double nirchan, double swirchan )
 {
 	double result;

Modified: grass-addons/gipe/i.wi/main.c
===================================================================
--- grass-addons/gipe/i.wi/main.c	2008-08-21 14:08:23 UTC (rev 32974)
+++ grass-addons/gipe/i.wi/main.c	2008-08-21 14:12:59 UTC (rev 32975)
@@ -22,24 +22,24 @@
 
 int main(int argc, char *argv[])
 {
-	struct Cell_head cellhd; //region+header info
-	char *mapset; // mapset name
+	struct Cell_head cellhd; /*region+header info*/
+	char *mapset; /*mapset name*/
 	int nrows, ncols;
 	int row,col;
 
-	char *wiflag;// Switch for particular index
+	char *wiflag;/*Switch for particular index*/
 	
 	struct GModule *module;
 	struct Option *input1,*input2,*input3, *output;
 	
 	struct Flag *flag1;	
-	struct History history; //metadata
-	struct Colors colors; //Color rules	
+	struct History history; /*metadata*/
+	struct Colors colors; /*Color rules*/	
 	/************************************/
 	/* FMEO Declarations*****************/
-	char *name;   // input raster name
-	char *result; //output raster name
-	//File Descriptors
+	char *name;   /*input raster name*/
+	char *result; /*output raster name*/
+	/*File Descriptors*/
 	int infd_nirchan, infd_swirchan;
 	int outfd;
 	
@@ -72,18 +72,13 @@
 	input2 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input2->key	   = _("nir");
 	input2->description=_("Name of the NIR Channel surface reflectance map [0.0;1.0]");
-	input2->answer     =_("nirchan");
 
 	input3 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input3->key        =_("swir");
 	input3->description=_("Name of the SWIR Channel surface reflectance map [0.0;1.0]");
-	input3->answer     =_("swirchan");
 
 	output= G_define_standard_option(G_OPT_R_OUTPUT) ;
-	output->key        =_("wi");
 	output->description=_("Name of the output wi layer");
-	output->answer     =_("wi");
-
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);
@@ -129,7 +124,6 @@
 		DCELL d_nirchan;
 		DCELL d_swirchan;
 		G_percent(row,nrows,2);
-//		printf("row = %i/%i\n",row,nrows);
 		if(G_get_raster_row(infd_nirchan,inrast_nirchan,row,data_type_nirchan)<0)
 			G_fatal_error(_("Could not read from <%s>"),nirchan);
 		if(G_get_raster_row(infd_swirchan,inrast_swirchan,row,data_type_swirchan)<0)
@@ -159,8 +153,6 @@
 					d_swirchan = ((DCELL *) inrast_swirchan)[col];
 					break;
 			}
-			//	printf("col=%i/%i ",col,ncols);
-		// to change to multiple to output files.
 			if(G_is_d_null_value(&d_nirchan)||
 			G_is_d_null_value(&d_swirchan)){
 				G_set_d_null_value(&outrast[col],1);



More information about the grass-commit mailing list