[GRASS-SVN] r38021 - in grass-addons/gipe: . i.eb.eta

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 22 04:29:56 EDT 2009


Author: ychemin
Date: 2009-06-22 04:29:56 -0400 (Mon, 22 Jun 2009)
New Revision: 38021

Modified:
   grass-addons/gipe/Makefile.imagery
   grass-addons/gipe/gmmenu.tcl
   grass-addons/gipe/i.eb.eta/main.c
   grass-addons/gipe/readme.gipe
Log:
removed i.sattime, Landsat .MTL files have satellite time embedded now

Modified: grass-addons/gipe/Makefile.imagery
===================================================================
--- grass-addons/gipe/Makefile.imagery	2009-06-22 08:25:13 UTC (rev 38020)
+++ grass-addons/gipe/Makefile.imagery	2009-06-22 08:29:56 UTC (rev 38021)
@@ -29,7 +29,6 @@
 	i.evapo.TSA \
 	i.lmf \
 	i.modis.stateqa \
-	i.sattime \
 	i.vi.mpi \
 	i.water \
 	i.wi 

Modified: grass-addons/gipe/gmmenu.tcl
===================================================================
--- grass-addons/gipe/gmmenu.tcl	2009-06-22 08:25:13 UTC (rev 38020)
+++ grass-addons/gipe/gmmenu.tcl	2009-06-22 08:29:56 UTC (rev 38021)
@@ -584,7 +584,6 @@
 				{separator}
 				{command {[G_msg "Lat/long maps"]} {} "i.latlong" {} -command {execute i.latlong }}
 				{command {[G_msg "Sunshine hours (potential)"]} {} "i.sunhours" {} -command {execute i.sunhours }}
-				{command {[G_msg "Satellite overpass time"]} {} "i.sattime" {} -command {execute i.sattime }}
 				{separator}
 				{command {[G_msg "LMF temporal splinning"]} {} "i.lmf" {} -command {execute i.lmf }}
 		}}

Modified: grass-addons/gipe/i.eb.eta/main.c
===================================================================
--- grass-addons/gipe/i.eb.eta/main.c	2009-06-22 08:25:13 UTC (rev 38020)
+++ grass-addons/gipe/i.eb.eta/main.c	2009-06-22 08:29:56 UTC (rev 38021)
@@ -24,207 +24,108 @@
 
 int main(int argc, char *argv[]) 
 {
-    struct Cell_head cellhd;	/*region+header info */
-
-    char *mapset;		/*mapset name */
-
     int nrows, ncols;
-
     int row, col;
-
     struct GModule *module;
-
     struct Option *input1, *input2, *input3, *output1;
-
-    struct Flag *flag1;
-
     struct History history;	/*metadata */
-
-    
-
-	/************************************/ 
-	/* FMEO Declarations**************** */ 
-    char *name;			/*input raster name */
-
     char *result1;		/*output raster name */
-
-    
-	/*File Descriptors */ 
     int infd_rnetday, infd_evapfr, infd_tempk;
-
     int outfd1;
-
     char *rnetday, *evapfr, *tempk;
-
-    int i = 0, j = 0;
-
     void *inrast_rnetday, *inrast_evapfr, *inrast_tempk;
 
     DCELL * outrast1;
-    RASTER_MAP_TYPE data_type_output = DCELL_TYPE;
-    RASTER_MAP_TYPE data_type_rnetday;
-    RASTER_MAP_TYPE data_type_evapfr;
-    RASTER_MAP_TYPE data_type_tempk;
-    
+    G_gisinit(argv[0]);
 
-	/************************************/ 
-	G_gisinit(argv[0]);
     module = G_define_module();
     module->keywords = _("actual evapotranspiration, energy balance, SEBAL");
     module->description =
 	_("actual evapotranspiration for diurnal period (Bastiaanssen, 1995)");
     
-	/* Define the different options */ 
-	input1 = G_define_standard_option(G_OPT_R_INPUT);
-    input1->key = _("rnetday");
+    /* Define the different options */ 
+    input1 = G_define_standard_option(G_OPT_R_INPUT);
+    input1->key = "rnetday";
     input1->description = _("Name of the diurnal Net Radiation map [W/m2]");
-    input1->answer = _("rnetday");
+    input1->answer = "rnetday";
+
     input2 = G_define_standard_option(G_OPT_R_INPUT);
-    input2->key = _("evapfr");
+    input2->key = "evapfr";
     input2->description = _("Name of the evaporative fraction map [-]");
-    input2->answer = _("evapfr");
+    input2->answer = "evapfr";
+
     input3 = G_define_standard_option(G_OPT_R_INPUT);
-    input3->key = _("tempk");
+    input3->key = "tempk";
     input3->description = _("Name of the surface skin temperature [K]");
-    input3->answer = _("tempk");
+    input3->answer = "tempk";
+
     output1 = G_define_standard_option(G_OPT_R_OUTPUT);
-    output1->key = _("eta");
     output1->description =
 	_("Name of the output actual diurnal evapotranspiration layer");
     output1->answer = _("eta");
-    
 
-	/********************/ 
-	if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
+    if (G_parser(argc, argv))
+        exit(EXIT_FAILURE);
+
     rnetday = input1->answer;
     evapfr = input2->answer;
     tempk = input3->answer;
     result1 = output1->answer;
     
-
-	/***************************************************/ 
-	mapset = G_find_cell2(rnetday, "");
-    if (mapset == NULL) {
-	G_fatal_error(_("cell file [%s] not found"), rnetday);
-    }
-    data_type_rnetday = G_raster_map_type(rnetday, mapset);
-    if ((infd_rnetday = G_open_cell_old(rnetday, mapset)) < 0)
+    if ((infd_rnetday = G_open_cell_old(rnetday, "")) < 0)
 	G_fatal_error(_("Cannot open cell file [%s]"), rnetday);
-    if (G_get_cellhd(rnetday, mapset, &cellhd) < 0)
-	G_fatal_error(_("Cannot read file header of [%s])"), rnetday);
-    inrast_rnetday = G_allocate_raster_buf(data_type_rnetday);
+    inrast_rnetday = G_allocate_d_raster_buf();
     
-
-	/***************************************************/ 
-	mapset = G_find_cell2(evapfr, "");
-    if (mapset == NULL) {
-	G_fatal_error(_("cell file [%s] not found"), evapfr);
-    }
-    data_type_evapfr = G_raster_map_type(evapfr, mapset);
-    if ((infd_evapfr = G_open_cell_old(evapfr, mapset)) < 0)
+    if ((infd_evapfr = G_open_cell_old(evapfr, "")) < 0)
 	G_fatal_error(_("Cannot open cell file [%s]"), evapfr);
-    if (G_get_cellhd(evapfr, mapset, &cellhd) < 0)
-	G_fatal_error(_("Cannot read file header of [%s]"), evapfr);
-    inrast_evapfr = G_allocate_raster_buf(data_type_evapfr);
+    inrast_evapfr = G_allocate_d_raster_buf();
     
-
-	/***************************************************/ 
-	mapset = G_find_cell2(tempk, "");
-    if (mapset == NULL) {
-	G_fatal_error(_("Cell file [%s] not found"), tempk);
-    }
-    data_type_tempk = G_raster_map_type(tempk, mapset);
-    if ((infd_tempk = G_open_cell_old(tempk, mapset)) < 0)
+    if ((infd_tempk = G_open_cell_old(tempk, "")) < 0)
 	G_fatal_error(_("Cannot open cell file [%s]"), tempk);
-    if (G_get_cellhd(tempk, mapset, &cellhd) < 0)
-	G_fatal_error(_("Cannot read file header of [%s]"), tempk);
-    inrast_tempk = G_allocate_raster_buf(data_type_tempk);
+    inrast_tempk = G_allocate_d_raster_buf();
     
-
-	/***************************************************/ 
-	G_debug(3, "number of rows %d", cellhd.rows);
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outrast1 = G_allocate_raster_buf(data_type_output);
+    outrast1 = G_allocate_d_raster_buf();
     
-	/* Create New raster files */ 
-	if ((outfd1 = G_open_raster_new(result1, data_type_output)) < 0)
-	G_fatal_error(_("Could not open <%s>"), result1);
+    if ((outfd1 = G_open_raster_new(result1, data_type_output)) < 0)
+        G_fatal_error(_("Could not open <%s>"), result1);
     
-	/* Process pixels */ 
-	for (row = 0; row < nrows; row++)
-	 {
-	DCELL d;
+    /* Process pixels */ 
+    for (row = 0; row < nrows; row++)
+    {
+        DCELL d;
 	DCELL d_rnetday;
 	DCELL d_evapfr;
 	DCELL d_tempk;
 	G_percent(row, nrows, 2);
 	
-	    /* read input maps */ 
-	    if (G_get_raster_row
-		(infd_rnetday, inrast_rnetday, row, data_type_rnetday) < 0)
+	/* read input maps */ 
+	if (G_get_d_raster_row(infd_rnetday,inrast_rnetday,row)<0)
 	    G_fatal_error(_("Could not read from <%s>"), rnetday);
-	if (G_get_raster_row
-	     (infd_evapfr, inrast_evapfr, row, data_type_evapfr) < 0)
+	if (G_get_d_raster_row(infd_evapfr,inrast_evapfr,row)<0)
 	    G_fatal_error(_("Could not read from <%s>"), evapfr);
-	if (G_get_raster_row(infd_tempk, inrast_tempk, row, data_type_tempk)
-	     < 0)
+	if (G_get_d_raster_row(infd_tempk,inrast_tempk,row)<0)
 	    G_fatal_error(_("Could not read from <%s>"), tempk);
 	
-	    /*process the data */ 
-	    for (col = 0; col < ncols; col++)
-	     {
-	    switch (data_type_rnetday) {
-	    case CELL_TYPE:
-		d_rnetday = (double)((CELL *) inrast_rnetday)[col];
-		break;
-	    case FCELL_TYPE:
-		d_rnetday = (double)((FCELL *) inrast_rnetday)[col];
-		break;
-	    case DCELL_TYPE:
+    /*process the data */ 
+    for (col = 0; col < ncols; col++)
+    {
 		d_rnetday = ((DCELL *) inrast_rnetday)[col];
-		break;
-	    }
-	    switch (data_type_evapfr) {
-	    case CELL_TYPE:
-		d_evapfr = (double)((CELL *) inrast_evapfr)[col];
-		break;
-	    case FCELL_TYPE:
-		d_evapfr = (double)((FCELL *) inrast_evapfr)[col];
-		break;
-	    case DCELL_TYPE:
 		d_evapfr = ((DCELL *) inrast_evapfr)[col];
-		break;
-	    }
-	    switch (data_type_tempk) {
-	    case CELL_TYPE:
-		d_tempk = (double)((CELL *) inrast_tempk)[col];
-		break;
-	    case FCELL_TYPE:
-		d_tempk = (double)((FCELL *) inrast_tempk)[col];
-		break;
-	    case DCELL_TYPE:
 		d_tempk = ((DCELL *) inrast_tempk)[col];
-		break;
-	    }
 	    if (G_is_d_null_value(&d_rnetday) ||
 		 G_is_d_null_value(&d_evapfr) ||
-		 G_is_d_null_value(&d_tempk)) {
+		 G_is_d_null_value(&d_tempk)) 
 		G_set_d_null_value(&outrast1[col], 1);
-	    }
 	    else {
-		
-
-				/************************************/ 
-		    /* calculate soil heat flux         */ 
-		    d = et_a(d_rnetday, d_evapfr, d_tempk);
+		d = et_a(d_rnetday, d_evapfr, d_tempk);
 		outrast1[col] = d;
 	    }
-	    }
-	if (G_put_raster_row(outfd1, outrast1, data_type_output) < 0)
-	    G_fatal_error(_("Cannot write to output raster file"));
 	}
+	if (G_put_d_raster_row(outfd1,outrast1) < 0)
+	    G_fatal_error(_("Cannot write to output raster file"));
+    }
     G_free(inrast_rnetday);
     G_free(inrast_evapfr);
     G_free(inrast_tempk);

Modified: grass-addons/gipe/readme.gipe
===================================================================
--- grass-addons/gipe/readme.gipe	2009-06-22 08:25:13 UTC (rev 38020)
+++ grass-addons/gipe/readme.gipe	2009-06-22 08:29:56 UTC (rev 38021)
@@ -20,7 +20,8 @@
 20081012: Added i.latlong, removed i.latitude and i.longitude
 20081012: Moved i.latlong to main SVN
 20081020: Moved i.sunhours, i.emissivity to main SVN
-20090619: Moved i.eb.g0, i.eb.evapfr, i.eb.h_SEBAL01 to main SVN
+20090619: Moved i.eb.g0, i.eb.evapfr, i.eb.h_SEBAL01, i.eb.eta to main SVN
+20090619: Renamed i.eb.g0 to i.eb.soilheatflux inside main SVN
 
 Imagery modules
 ---------------
@@ -37,7 +38,7 @@
 
 -----IMPORT from DN to reflectance, radiance temperature or potential ET -------------
 i.dn2full.l5:	imports DN into radiance or reflectance/temperature for Landsat 5
-i.dn.full.l7:	imports DN into radiance or reflectance/temperature for Landsat 7 
+i.dn2full.l7:	imports DN into radiance or reflectance/temperature for Landsat 7 
 i.dn2potrad.l5: Calculates potential Evapotranspiration from Landsat 5 DN directly
 i.dn2potrad.l7: Calculates potential Evapotranspiration from Landsat 7 DN directly
 i.dn2ref.ast:	imports DN into radiance or reflectance for Terra-ASTER (not temperature)
@@ -47,7 +48,7 @@
 -----ENERGY balance-------------------------------------------------------------------
 i.eb.deltat:	Energy-Balance: Calculates a generic Soil to Air temperature difference
 i.eb.disp:	Energy-Balance: Calculates the displacement height above canopy
-i.eb.eta:	Energy-Balance: Calculates the Actual Evapotranspiration
+**i.eb.eta:	(Now in main SVN) Energy-Balance: Calculates the Actual Evapotranspiration
 **i.eb.evapfr:	(Now in main SVN) Energy-Balance: Calculates the Evaporative Fraction (and soil moisture)
 **i.eb.g0:	(Now in main SVN) Energy-Balance: Calculates the Soil Heat Flux
 i.eb.h0:	Energy-Balance: Calculates the Sensible Heat Flux
@@ -77,7 +78,7 @@
 -----Utilities-----------------------------------------------------------------------
 **i.latlong: 	Calculates latitude/longitude by reprojecting without datum transform
 **i.qc.modis:	(Now in Main SVN as i.modis.qc) Converts Terra-MODIS Quality Assessment bits to numeric classes
-i.sattime:	Calculates the time of satellite overpass
+<i.sattime>:	Calculates the time of satellite overpass -> REMOVED (not needed since Landsat MTL has it now)
 **i.sunhours:	(now in main SVN) Calculates potential sunshine hours
 -------------------------------------------------------------------------------------
 



More information about the grass-commit mailing list