[GRASS-SVN] r31169 - in grass-addons/gipe: i.eb.deltat i.eb.disp i.eb.eta i.eb.evapfr i.eb.g0 i.eb.h0 i.eb.h_iter

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 28 22:56:48 EDT 2008


Author: ychemin
Date: 2008-04-28 22:56:47 -0400 (Mon, 28 Apr 2008)
New Revision: 31169

Modified:
   grass-addons/gipe/i.eb.deltat/main.c
   grass-addons/gipe/i.eb.disp/main.c
   grass-addons/gipe/i.eb.eta/main.c
   grass-addons/gipe/i.eb.evapfr/main.c
   grass-addons/gipe/i.eb.g0/main.c
   grass-addons/gipe/i.eb.h0/main.c
   grass-addons/gipe/i.eb.h_iter/main.c
Log:
new coding standards, continued

Modified: grass-addons/gipe/i.eb.deltat/main.c
===================================================================
--- grass-addons/gipe/i.eb.deltat/main.c	2008-04-29 02:36:08 UTC (rev 31168)
+++ grass-addons/gipe/i.eb.deltat/main.c	2008-04-29 02:56:47 UTC (rev 31169)
@@ -30,7 +30,7 @@
 	int nrows, ncols;
 	int row,col;
 
-	int verbose=1, wim=0;
+	int wim=0;
 	struct GModule *module;
 	struct Option *input1, *output1;
 	
@@ -61,27 +61,16 @@
 	module->description = _("difference of temperature between two heights as seen in Pawan (2004), this is part of sensible heat flux calculations, as in SEBAL (Bastiaanssen, 1995). A 'w' flag allows for a very generic approximation.");
 
 	/* Define the different options */
-	input1 = G_define_option() ;
+	input1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input1->key	   = _("tempk");
-	input1->type       = TYPE_STRING;
-	input1->required   = YES;
-	input1->gisprompt  =_("old,cell,raster") ;
-	input1->description=_("Name of the surface skin temperature map [Degree Kelvin]");
+	input1->description=_("Name of the surface skin temperature map [Kelvin]");
 	input1->answer     =_("tempk");
 
-	output1 = G_define_option() ;
+	output1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	output1->key        =_("delta");
-	output1->type       = TYPE_STRING;
-	output1->required   = YES;
-	output1->gisprompt  =_("new,cell,raster");
 	output1->description=_("Name of the output delta layer");
 	output1->answer     =_("delta");
 
-	
-	flag1 = G_define_flag();
-	flag1->key = 'q';
-	flag1->description = _("Quiet");
-
 	flag2 = G_define_flag();
 	flag2->key = 'w';
 	flag2->description = _("Wim's generic table");
@@ -93,7 +82,6 @@
 	tempk	 	= input1->answer;
 		
 	result1  	= output1->answer;
-	verbose 	= (!flag1->answer);
 	wim 		= flag2->answer;
 	/***************************************************/
 	mapset = G_find_cell2(tempk, "");
@@ -119,8 +107,7 @@
 	{
 		DCELL d;
 		DCELL d_tempk;
-		if(verbose)
-			G_percent(row,nrows,2);
+		G_percent(row,nrows,2);
 //		printf("row = %i/%i\n",row,nrows);
 		/* read soil input maps */	
 		if(G_get_raster_row(infd_tempk,inrast_tempk,row,data_type_tempk)<0)

Modified: grass-addons/gipe/i.eb.disp/main.c
===================================================================
--- grass-addons/gipe/i.eb.disp/main.c	2008-04-29 02:36:08 UTC (rev 31168)
+++ grass-addons/gipe/i.eb.disp/main.c	2008-04-29 02:56:47 UTC (rev 31169)
@@ -31,7 +31,6 @@
 	int nrows, ncols;
 	int row,col;
 
-	int verbose=1;
 	struct GModule *module;
 	struct Option *input1, *output1;
 	
@@ -62,31 +61,19 @@
 	module->description = _("Displacement height above skin surface, as seen in Pawan (2004). A flag (-s) permits direct SAVI input using the equation in the same document, be careful using it.");
 
 	/* Define the different options */
-	input1 = G_define_option() ;
+	input1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input1->key	   = _("lai");
-	input1->type       = TYPE_STRING;
-	input1->required   = YES;
-	input1->gisprompt  =_("old,cell,raster") ;
 	input1->description=_("Name of the LAI map [-]");
 	input1->answer     =_("lai");
 
-	output1 = G_define_option() ;
+	output1 = G_define_standard_option(G_OPT_R_OUTPUT) ;
 	output1->key        =_("disp");
-	output1->type       = TYPE_STRING;
-	output1->required   = YES;
-	output1->gisprompt  =_("new,dcell,raster");
 	output1->description=_("Name of the output disp layer");
 	output1->answer     =_("disp");
-
 	
-	flag1 = G_define_flag();
-	flag1->key = 'q';
-	flag1->description = _("Quiet");
-	
 	flag2 = G_define_flag();
 	flag2->key = 's';
 	flag2->description = _("use savi2lai conversion (Pawan, 2004)");
-
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);
@@ -94,7 +81,6 @@
 	lai	 	= input1->answer;
 		
 	result1  = output1->answer;
-	verbose = (!flag1->answer);
 	/***************************************************/
 	mapset = G_find_cell2(lai, "");
 	if (mapset == NULL) {
@@ -119,8 +105,7 @@
 	{
 		DCELL d;
 		DCELL d_lai;
-		if(verbose)
-			G_percent(row,nrows,2);
+		G_percent(row,nrows,2);
 //		printf("row = %i/%i\n",row,nrows);
 		/* read soil input maps */	
 		if(G_get_raster_row(infd_lai,inrast_lai,row,data_type_lai)<0)

Modified: grass-addons/gipe/i.eb.eta/main.c
===================================================================
--- grass-addons/gipe/i.eb.eta/main.c	2008-04-29 02:36:08 UTC (rev 31168)
+++ grass-addons/gipe/i.eb.eta/main.c	2008-04-29 02:56:47 UTC (rev 31169)
@@ -29,7 +29,6 @@
 	int nrows, ncols;
 	int row,col;
 
-	int verbose=1;
 	struct GModule *module;
 	struct Option *input1, *input2, *input3, *output1;
 	
@@ -61,42 +60,25 @@
 	module->description = _("actual evapotranspiration for diurnal period (Bastiaanssen, 1995)");
 
 	/* Define the different options */
-	input1 = G_define_option() ;
+	input1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input1->key	   = _("rnetday");
-	input1->type       = TYPE_STRING;
-	input1->required   = YES;
-	input1->gisprompt  =_("old,cell,raster") ;
 	input1->description=_("Name of the diurnal Net Radiation map [W/m2]");
 	input1->answer     =_("rnetday");
 
-	input2 = G_define_option() ;
+	input2 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input2->key        =_("evapfr");
-	input2->type       = TYPE_STRING;
-	input2->required   = YES;
-	input2->gisprompt  =_("old,cell,raster");
 	input2->description=_("Name of the evaporative fraction map [-]");
 	input2->answer     =_("evapfr");
 
-	input3 = G_define_option() ;
+	input3 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input3->key        =_("tempk");
-	input3->type       = TYPE_STRING;
-	input3->required   = YES;
-	input3->gisprompt  =_("old,cell,raster");
 	input3->description=_("Name of the surface skin temperature [K]");
 	input3->answer     =_("tempk");
 
-	output1 = G_define_option() ;
+	output1 = G_define_standard_option(G_OPT_R_OUTPUT) ;
 	output1->key        =_("eta");
-	output1->type       = TYPE_STRING;
-	output1->required   = YES;
-	output1->gisprompt  =_("new,cell,raster");
 	output1->description=_("Name of the output actual diurnal evapotranspiration layer");
 	output1->answer     =_("eta");
-	
-	flag1 = G_define_flag();
-	flag1->key = 'q';
-	flag1->description = _("Quiet");
-
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);
@@ -106,7 +88,6 @@
 	tempk		= input3->answer;
 	
 	result1  = output1->answer;
-	verbose = (!flag1->answer);
 	/***************************************************/
 	mapset = G_find_cell2(rnetday, "");
 	if (mapset == NULL) {
@@ -155,8 +136,7 @@
 		DCELL d_rnetday;
 		DCELL d_evapfr;
 		DCELL d_tempk;
-		if(verbose)
-			G_percent(row,nrows,2);
+		G_percent(row,nrows,2);
 		/* read input maps */	
 		if(G_get_raster_row(infd_rnetday,inrast_rnetday,row,data_type_rnetday)<0)
 			G_fatal_error(_("Could not read from <%s>"),rnetday);

Modified: grass-addons/gipe/i.eb.evapfr/main.c
===================================================================
--- grass-addons/gipe/i.eb.evapfr/main.c	2008-04-29 02:36:08 UTC (rev 31168)
+++ grass-addons/gipe/i.eb.evapfr/main.c	2008-04-29 02:56:47 UTC (rev 31169)
@@ -30,7 +30,6 @@
 	int nrows, ncols;
 	int row,col;
 
-	int verbose=1;
 	int makin=0;//Makin Flag for root zone soil moisture output
 	struct GModule *module;
 	struct Option *input1, *input2, *input3, *output1, *output2;
@@ -64,55 +63,36 @@
 	module->description = _("evaporative fraction (Bastiaanssen, 1995) and root zone soil moisture (Makin, Molden and Bastiaanssen, 2001)");
 
 	/* Define the different options */
-	input1 = G_define_option() ;
+	input1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input1->key	   = _("rnet");
-	input1->type       = TYPE_STRING;
-	input1->required   = YES;
-	input1->gisprompt  =_("old,cell,raster") ;
 	input1->description=_("Name of the Net Radiation map [W/m2]");
 	input1->answer     =_("rnet");
 
-	input2 = G_define_option() ;
+	input2 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input2->key        =_("g0");
-	input2->type       = TYPE_STRING;
-	input2->required   = YES;
-	input2->gisprompt  =_("old,cell,raster");
 	input2->description=_("Name of the soil heat flux map [W/m2]");
 	input2->answer     =_("g0");
 
-	input3 = G_define_option() ;
+	input3 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input3->key        =_("h0");
-	input3->type       = TYPE_STRING;
-	input3->required   = YES;
-	input3->gisprompt  =_("old,cell,raster");
 	input3->description=_("Name of the sensible heat flux map [W/m2]");
 	input3->answer     =_("h0");
 
-	output1 = G_define_option() ;
+	output1 = G_define_standard_option(G_OPT_R_OUTPUT) ;
 	output1->key        =_("evapfr");
-	output1->type       = TYPE_STRING;
-	output1->required   = YES;
-	output1->gisprompt  =_("new,cell,raster");
 	output1->description=_("Name of the output evaporative fraction layer");
 	output1->answer     =_("evapfr");
 
-	output2 = G_define_option() ;
+	output2 = G_define_standard_option(G_OPT_R_OUTPUT) ;
 	output2->key        =_("theta");
-	output2->type       = TYPE_STRING;
 	output2->required   = NO;
-	output2->gisprompt  =_("new,cell,raster");
 	output2->description=_("Name of the output root zone soil moisture layer");
 	output2->answer     =_("theta");
 	
-	
 	flag1 = G_define_flag();
 	flag1->key = 'm';
 	flag1->description = _("root zone soil moisture output (Makin, Molden and Bastiaanssen, 2001)");
 	
-	flag2 = G_define_flag();
-	flag2->key = 'q';
-	flag2->description = _("Quiet");
-
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);
@@ -124,7 +104,6 @@
 	result1  = output1->answer;
 	result2  = output2->answer;
 	makin   = flag1->answer;
-	verbose = (!flag2->answer);
 	/***************************************************/
 	mapset = G_find_cell2(rnet, "");
 	if (mapset == NULL) {
@@ -180,8 +159,7 @@
 		DCELL d_rnet;
 		DCELL d_g0;
 		DCELL d_h0;
-		if(verbose)
-			G_percent(row,nrows,2);
+		G_percent(row,nrows,2);
 //		printf("row = %i/%i\n",row,nrows);
 		/* read soil input maps */	
 		if(G_get_raster_row(infd_rnet,inrast_rnet,row,data_type_rnet)<0)

Modified: grass-addons/gipe/i.eb.g0/main.c
===================================================================
--- grass-addons/gipe/i.eb.g0/main.c	2008-04-29 02:36:08 UTC (rev 31168)
+++ grass-addons/gipe/i.eb.g0/main.c	2008-04-29 02:56:47 UTC (rev 31169)
@@ -30,12 +30,11 @@
 	int nrows, ncols;
 	int row,col;
 
-	int verbose=1;
 	int roerink=0;//Roerink Flag for HAPEX-Sahel conditions
 	struct GModule *module;
 	struct Option *input1, *input2, *input3, *input4, *input5, *output1;
 	
-	struct Flag *flag1, *flag2;	
+	struct Flag *flag1;	
 	struct History history; //metadata
 	
 	/************************************/
@@ -100,11 +99,6 @@
 	flag1 = G_define_flag();
 	flag1->key = 'r';
 	flag1->description = _("HAPEX-Sahel empirical correction (Roerink, 1995)");
-	
-	flag2 = G_define_flag();
-	flag2->key = 'q';
-	flag2->description = _("Quiet");
-
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);

Modified: grass-addons/gipe/i.eb.h0/main.c
===================================================================
--- grass-addons/gipe/i.eb.h0/main.c	2008-04-29 02:36:08 UTC (rev 31168)
+++ grass-addons/gipe/i.eb.h0/main.c	2008-04-29 02:56:47 UTC (rev 31169)
@@ -30,7 +30,6 @@
 	int nrows, ncols;
 	int row,col;
 
-	int verbose=1;
 	int sebal=0;//SEBAL Flag for affine transform of surf. temp.
 	struct GModule *module;
 	struct Option *input1, *input2, *input3, *input4, *input5;
@@ -68,11 +67,8 @@
 	module->description = _("sensible heat flux equation, including flag for SEBAL version (Bastiaanssen, 1995)");
 
 	/* Define the different options */
-	input1 = G_define_option() ;
+	input1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input1->key	   = _("rohair");
-	input1->type       = TYPE_STRING;
-	input1->required   = YES;
-	input1->gisprompt  =_("old,cell,raster") ;
 	input1->description=_("Name of the air density map ~[0.9;1.5]");
 	input1->answer     =_("rohair");
 
@@ -84,29 +80,19 @@
 	input2->description=_("Value of the air specific heat [1000.0;1020.0]");
 	input2->answer     =_("1004.0");
 
-	input3 = G_define_option() ;
+	input3 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input3->key        =_("dtair");
-	input3->type       = TYPE_STRING;
-	input3->required   = NO;
-	input3->gisprompt  =_("old,cell,raster");
 	input3->description=_("Name of the skin-air Surface temperature difference map ~[0.0-80.0]");
-//	input3->answer     =_("dtair");
 
-	input4 = G_define_option() ;
+	input4 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input4->key        =_("rah");
-	input4->type       = TYPE_STRING;
-	input4->required   = YES;
-	input4->gisprompt  =_("old,cell,raster");
 	input4->description=_("Name of the aerodynamic resistance to heat transport map [s/m]");
 	input4->answer     =_("rah");
 
-	input5 = G_define_option() ;
+	input5 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input5->key        =_("tempk");
-	input5->type       = TYPE_STRING;
 	input5->required   = NO;
-	input5->gisprompt  =_("old,cell,raster");
 	input5->description=_("Name of the surface skin temperature map [degrees Kelvin], used with -s flag and affine coefs, disables dtair input");
-//	input5->answer     =_("tempk");
 
 	input6 = G_define_option() ;
 	input6->key        =_("a");
@@ -122,21 +108,14 @@
 	input7->gisprompt  =_("parameter, float number");
 	input7->description=_("Value of the intercept of the transform");
 	
-	output1 = G_define_option() ;
+	output1 = G_define_standard_option(G_OPT_R_OUTPUT) ;
 	output1->key        =_("h0");
-	output1->type       = TYPE_STRING;
-	output1->required   = YES;
-	output1->gisprompt  =_("new,cell,raster");
 	output1->description=_("Name of the output h0 layer");
 	output1->answer     =_("h0");
 
 	flag1 = G_define_flag();
 	flag1->key = 's';
 	flag1->description = _("Affine transform of Surface temperature, needs input of slope and intercept (Bastiaanssen, 1995)");
-	
-	flag2 = G_define_flag();
-	flag2->key = 'q';
-	flag2->description = _("Quiet");
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);
@@ -151,7 +130,6 @@
 	
 	result  = output1->answer;
 	sebal = flag1->answer;
-	verbose = (!flag2->answer);
 	/***************************************************/
 	mapset = G_find_cell2(rohair, "");
 	if (mapset == NULL) {
@@ -217,8 +195,7 @@
 		DCELL d_dtair;
 		DCELL d_affine;
 		DCELL d_tempk;
-		if(verbose)
-			G_percent(row,nrows,2);
+		G_percent(row,nrows,2);
 //		printf("row = %i/%i\n",row,nrows);
 		/* read soil input maps */	
 		if(G_get_raster_row(infd_rohair,inrast_rohair,row,data_type_rohair)<0)

Modified: grass-addons/gipe/i.eb.h_iter/main.c
===================================================================
--- grass-addons/gipe/i.eb.h_iter/main.c	2008-04-29 02:36:08 UTC (rev 31168)
+++ grass-addons/gipe/i.eb.h_iter/main.c	2008-04-29 02:56:47 UTC (rev 31169)
@@ -37,7 +37,6 @@
 	int nrows, ncols;
 	int row,col;
 
-	int verbose=1;
 	//If !sebal then use Delta T input file
 	int sebal=0;//SEBAL Flag for affine transform of surf. temp.
 	struct GModule *module;
@@ -81,11 +80,8 @@
 	module->description = _("sensible heat flux equation as in Pawan (2004), including flags for delta T affine transform from surf. temp.");
 
 	/* Define the different options */
-	input1 = G_define_option() ;
+	input1 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input1->key	   = _("rohair");
-	input1->type       = TYPE_STRING;
-	input1->required   = YES;
-	input1->gisprompt  =_("old,cell,raster") ;
 	input1->description=_("Name of the air density map ~[0.9;1.5], Pawan (2004) use 1.12 constant value");
 	input1->answer     =_("rohair");
 
@@ -97,19 +93,14 @@
 	input2->description=_("Value of the air specific heat [1000.0;1020.0]");
 	input2->answer     =_("1004.16");
 
-	input3 = G_define_option() ;
+	input3 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input3->key        =_("tempk");
-	input3->type       = TYPE_STRING;
-	input3->required   = YES;
-	input3->gisprompt  =_("old,cell,raster");
 	input3->description=_("Name of the surface skin temperature map [degrees Kelvin],if used with -s flag and affine coefs, it disables dtair input");
 	input3->answer     =_("tempk");
 
-	input4 = G_define_option() ;
+	input4 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input4->key        =_("dtair");
-	input4->type       = TYPE_STRING;
 	input4->required   = NO;
-	input4->gisprompt  =_("old,cell,raster");
 	input4->description=_("Name of the skin-air Surface temperature difference map ~[0.0-80.0], required unless you use -s flag (then you must give a & b coefs below)");
 
 	input5 = G_define_option() ;
@@ -126,43 +117,28 @@
 	input6->gisprompt  =_("parameter, float number");
 	input6->description=_("-s flag: Value of the intercept of the affine transform");
 	
-	input7 = G_define_option() ;
+	input7 = G_define_stnadard_option(G_OPT_R_INPUT) ;
 	input7->key        =_("disp");
-	input7->type       = TYPE_STRING;
-	input7->required   = YES;
-	input7->gisprompt  =_("old,cell,raster");
 	input7->description=_("Name of the displacement height input layer (m)");
 	input7->answer     =_("disp");
 	
-	input8 = G_define_option() ;
+	input8 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input8->key        =_("z0m");
-	input8->type       = TYPE_STRING;
-	input8->required   = YES;
-	input8->gisprompt  =_("old,cell,raster");
 	input8->description=_("Name of the z0m input layer (s/m)");
 	input8->answer     =_("z0m");
 	
-	input9 = G_define_option() ;
+	input9 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input9->key        =_("z0h");
-	input9->type       = TYPE_STRING;
-	input9->required   = YES;
-	input9->gisprompt  =_("old,cell,raster");
 	input9->description=_("Name of the z0h input layer (s/m)");
 	input9->answer     =_("z0h");
 	
-	input10 = G_define_option() ;
+	input10 = G_define_standard_option(G_OPT_R_INPUT) ;
 	input10->key        =_("u2m");
-	input10->type       = TYPE_STRING;
-	input10->required   = YES;
-	input10->gisprompt  =_("old,cell,raster");
 	input10->description=_("Name of the wind speed at 2m height input layer (m/s)");
 	input10->answer     =_("u2m");
 		
-	output1 = G_define_option() ;
+	output1 = G_define_standard_option(G_OPT_R_OUTPUT) ;
 	output1->key        =_("h0");
-	output1->type       = TYPE_STRING;
-	output1->required   = YES;
-	output1->gisprompt  =_("new,cell,raster");
 	output1->description=_("Name of the output h0 layer");
 	output1->answer     =_("h0");
 
@@ -170,9 +146,6 @@
 	flag1->key = 's';
 	flag1->description = _("Affine transform of Surface temperature into delta T, needs input of slope and intercept (Bastiaanssen, 1995)");
 	
-	flag2 = G_define_flag();
-	flag2->key = 'q';
-	flag2->description = _("Quiet");
 	/********************/
 	if (G_parser(argc, argv))
 		exit (EXIT_FAILURE);
@@ -198,7 +171,6 @@
 	
 	result  = output1->answer;
 	sebal = flag1->answer;
-	verbose = (!flag2->answer);
 
 	/***************************************************/
 	/* TEST FOR -s FLAG COEFS 
@@ -310,8 +282,7 @@
 		DCELL d_z0m;
 		DCELL d_z0h;
 		DCELL d_u2m;
-		if(verbose)
-			G_percent(row,nrows,2);
+		G_percent(row,nrows,2);
 		/* printf("row = %i/%i\n",row,nrows);*/
 		/* read input maps */	
 		if(G_get_raster_row(infd_rohair,inrast_rohair,row,data_type_rohair)<0)



More information about the grass-commit mailing list