[GRASS-SVN] r37967 - in grass/trunk: gui/wxpython/xml imagery
imagery/i.eb.eta
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 19 12:49:18 EDT 2009
Author: ychemin
Date: 2009-06-19 12:49:18 -0400 (Fri, 19 Jun 2009)
New Revision: 37967
Added:
grass/trunk/imagery/i.eb.eta/
grass/trunk/imagery/i.eb.eta/Makefile
grass/trunk/imagery/i.eb.eta/eta.c
grass/trunk/imagery/i.eb.eta/i.eb.eta.html
grass/trunk/imagery/i.eb.eta/main.c
Modified:
grass/trunk/gui/wxpython/xml/menudata.xml
grass/trunk/imagery/Makefile
Log:
added module for actual evapotranspiration (i.eb.eta)
Modified: grass/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml 2009-06-19 16:25:03 UTC (rev 37966)
+++ grass/trunk/gui/wxpython/xml/menudata.xml 2009-06-19 16:49:18 UTC (rev 37967)
@@ -2293,9 +2293,16 @@
<command>i.eb.evapfr</command>
</menuitem>
<menuitem>
+ <label>Actual Evapotranspiration</label>
+ <help>Computes the actual evapotranspiration (ETa)</help>
+ <keywords>imagery,energy balance,land flux,actual evapotranspiration</keywords>
+ <handler>self.OnMenuCmd</handler>
+ <command>i.eb.eta</command>
+ </menuitem>
+ <menuitem>
<label>ET Temporal Integration</label>
<help>Temporal integration of satellite ET actual (ETa) following the daily ET reference (ETo) from meteorological station(s)</help>
- <keywords>evapotranspiration,temporal,integration</keywords>
+ <keywords>imagery,evapotranspiration,temporal,integration</keywords>
<handler>self.OnMenuCmd</handler>
<command>i.evapo.time_integration</command>
</menuitem>
@@ -2697,4 +2704,4 @@
</items>
</menu>
</menubar>
-</menudata>
\ No newline at end of file
+</menudata>
Modified: grass/trunk/imagery/Makefile
===================================================================
--- grass/trunk/imagery/Makefile 2009-06-19 16:25:03 UTC (rev 37966)
+++ grass/trunk/imagery/Makefile 2009-06-19 16:49:18 UTC (rev 37967)
@@ -6,6 +6,7 @@
i.cca \
i.cluster \
i.eb.evapfr \
+ i.eb.eta \
i.eb.g0 \
i.eb.h_SEBAL01 \
i.evapo.time_integration \
Added: grass/trunk/imagery/i.eb.eta/Makefile
===================================================================
--- grass/trunk/imagery/i.eb.eta/Makefile (rev 0)
+++ grass/trunk/imagery/i.eb.eta/Makefile 2009-06-19 16:49:18 UTC (rev 37967)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../..
+
+PGM = i.eb.eta
+
+LIBES = $(GISLIB)
+DEPENDENCIES = $(GISDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+ifneq ($(USE_LARGEFILES),)
+ EXTRA_CFLAGS = -D_FILE_OFFSET_BITS=64
+endif
+
+default: cmd
Added: grass/trunk/imagery/i.eb.eta/eta.c
===================================================================
--- grass/trunk/imagery/i.eb.eta/eta.c (rev 0)
+++ grass/trunk/imagery/i.eb.eta/eta.c 2009-06-19 16:49:18 UTC (rev 37967)
@@ -0,0 +1,14 @@
+#include<stdio.h>
+#include<math.h>
+
+double et_a(double r_net_day, double evap_fr, double tempk)
+{
+ double latent, t_celsius, result;
+
+ t_celsius = tempk - 273.15;
+ latent = 86400 / ((2.501 - 0.002361 * t_celsius) * pow(10, 6));
+
+ result = r_net_day * evap_fr * latent;
+
+ return result;
+}
Added: grass/trunk/imagery/i.eb.eta/i.eb.eta.html
===================================================================
--- grass/trunk/imagery/i.eb.eta/i.eb.eta.html (rev 0)
+++ grass/trunk/imagery/i.eb.eta/i.eb.eta.html 2009-06-19 16:49:18 UTC (rev 37967)
@@ -0,0 +1,46 @@
+<H2>DESCRIPTION</H2>
+
+<EM>i.eb.eta</EM> calculates the actual evapotranspiration (ETa ; mm/d) for diurnal period after [1], implemented in [3].
+It takes input of Diurnal Net Radiation (see r.sun), evaporative fraction (see r.eb.evapfr) and surface skin temperature.
+
+<H2>NOTES</H2>
+Full ETa processing will need those:
+<ul>
+ <li>i.vi, i.albedo, i.latlong, i.emissivity
+ <li>i.evapo.potrad
+ <li>i.eb.netrad, i.eb.soilheatflux, i.eb.h_sebal01
+ <li>i.eb.evapfr, i.eb.eta
+</ul>
+
+(for time integration: i.evapo.time_integration)
+
+<p>For more details on the algorithms see [1][2][3].
+
+<H2>TODO</H2>
+
+
+<H2>SEE ALSO</H2>
+
+<em>
+<A HREF="r.sun.html">r.sun</A><br>
+<A HREF="i.eb.evapfr.html">i.eb.evapfr</A><br>
+<A HREF="i.eb.netrad.html">i.eb.netrad</A><br>
+</em>
+
+<H2>REFERENCES</H2>
+
+ <p>[1] Bastiaanssen, W.G.M., 1995.
+ Estimation of Land surface paramters by remote sensing under clear-sky conditions. PhD thesis, Wageningen University, Wageningen, The Netherlands.
+
+ <p>[2] Chemin Y., Alexandridis T.A., 2001. Improving spatial resolution of ET seasonal for irrigated rice in Zhanghe, China. Asian Journal of Geoinformatics. 5(1):3-11,2004.
+
+ <p>[3] Alexandridis T.K., Cherif I., Chemin Y., Silleos N.G., Stavrinos E., Zalidis G.C. Integrated methodology for estimating water use in Mediterranean agricultural areas. Remote Sensing. -(-):,2009. (submitted))
+
+
+<H2>AUTHORS</H2>
+
+Yann Chemin, Asian Institute of Technology, Thailand<BR>
+
+
+<p>
+<i>Last changed: $Date: 2006/10/11 16:40:12 $</i>
Added: grass/trunk/imagery/i.eb.eta/main.c
===================================================================
--- grass/trunk/imagery/i.eb.eta/main.c (rev 0)
+++ grass/trunk/imagery/i.eb.eta/main.c 2009-06-19 16:49:18 UTC (rev 37967)
@@ -0,0 +1,143 @@
+
+/****************************************************************************
+ *
+ * MODULE: i.eb.eta
+ * AUTHOR(S): Yann Chemin - yann.chemin at gmail.com
+ * PURPOSE: Calculates the actual evapotranspiration for diurnal period
+ * as seen in Bastiaanssen (1995)
+ *
+ * COPYRIGHT: (C) 2002-2009 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public
+ * License (>=v2). Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ *****************************************************************************/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+double et_a(double r_net_day, double evap_fr, double tempk);
+
+int main(int argc, char *argv[])
+{
+ int nrows, ncols;
+ int row, col;
+ struct GModule *module;
+ struct Option *input1, *input2, *input3, *output1;
+ struct History history; /*metadata */
+ char *result1; /*output raster name */
+ int infd_rnetday, infd_evapfr, infd_tempk;
+ int outfd1;
+ char *rnetday, *evapfr, *tempk;
+ void *inrast_rnetday, *inrast_evapfr, *inrast_tempk;
+
+ DCELL * outrast1;
+ G_gisinit(argv[0]);
+
+ module = G_define_module();
+ module->keywords = _("imagery, 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";
+ input1->description = _("Name of the diurnal Net Radiation map [W/m2]");
+ input1->answer = "rnetday";
+
+ input2 = G_define_standard_option(G_OPT_R_INPUT);
+ input2->key = "evapfr";
+ input2->description = _("Name of the evaporative fraction map [-]");
+ input2->answer = "evapfr";
+
+ input3 = G_define_standard_option(G_OPT_R_INPUT);
+ input3->key = "tempk";
+ input3->description = _("Name of the surface skin temperature [K]");
+ input3->answer = "tempk";
+
+ output1 = G_define_standard_option(G_OPT_R_OUTPUT);
+ output1->description =
+ _("Name of the output actual evapotranspiration layer [mm/d]");
+ output1->answer = "eta";
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
+ rnetday = input1->answer;
+ evapfr = input2->answer;
+ tempk = input3->answer;
+ result1 = output1->answer;
+
+ if ((infd_rnetday = G_open_cell_old(rnetday, "")) < 0)
+ G_fatal_error(_("Unable to open raster map <%s>"), rnetday);
+ inrast_rnetday = G_allocate_d_raster_buf();
+
+ if ((infd_evapfr = G_open_cell_old(evapfr, "")) < 0)
+ G_fatal_error(_("Unable to open raster map <%s>"), evapfr);
+ inrast_evapfr = G_allocate_d_raster_buf();
+
+ if ((infd_tempk = G_open_cell_old(tempk, "")) < 0)
+ G_fatal_error(_("Unable to open raster map <%s>"), tempk);
+ inrast_tempk = G_allocate_d_raster_buf();
+
+ nrows = G_window_rows();
+ ncols = G_window_cols();
+ outrast1 = G_allocate_d_raster_buf();
+
+ if ((outfd1 = G_open_raster_new(result1, DCELL_TYPE)) < 0)
+ G_fatal_error(_("Unable to create raster map <%s>"), result1);
+
+ /* 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_d_raster_row(infd_rnetday,inrast_rnetday,row)<0)
+ G_fatal_error(_("Unable to read from <%s> row %d"), rnetday, row);
+ if (G_get_d_raster_row(infd_evapfr,inrast_evapfr,row)<0)
+ G_fatal_error(_("Unable to read from <%s> row %d"), evapfr, row);
+ if (G_get_d_raster_row(infd_tempk,inrast_tempk,row)<0)
+ G_fatal_error(_("Unable to read from <%s> row %d"), tempk, row);
+
+ /*process the data */
+ for (col = 0; col < ncols; col++)
+ {
+ d_rnetday = ((DCELL *) inrast_rnetday)[col];
+ d_evapfr = ((DCELL *) inrast_evapfr)[col];
+ d_tempk = ((DCELL *) inrast_tempk)[col];
+ if (G_is_d_null_value(&d_rnetday) ||
+ G_is_d_null_value(&d_evapfr) ||
+ G_is_d_null_value(&d_tempk))
+ G_set_d_null_value(&outrast1[col], 1);
+ else {
+ d = et_a(d_rnetday, d_evapfr, d_tempk);
+ outrast1[col] = d;
+ }
+ }
+ if (G_put_d_raster_row(outfd1,outrast1) < 0)
+ G_fatal_error(_("Failed writing raster map <%s>"), result1);
+ }
+ G_free(inrast_rnetday);
+ G_free(inrast_evapfr);
+ G_free(inrast_tempk);
+ G_close_cell(infd_rnetday);
+ G_close_cell(infd_evapfr);
+ G_close_cell(infd_tempk);
+ G_free(outrast1);
+ G_close_cell(outfd1);
+ G_short_history(result1, "raster", &history);
+ G_command_history(&history);
+ G_write_history(result1, &history);
+ exit(EXIT_SUCCESS);
+}
+
+
More information about the grass-commit
mailing list