[GRASS-SVN] r31452 - grass-addons/gipe/i.evapo.PT
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 20 18:30:09 EDT 2008
Author: ychemin
Date: 2008-05-20 18:30:09 -0400 (Tue, 20 May 2008)
New Revision: 31452
Modified:
grass-addons/gipe/i.evapo.PT/description.html
grass-addons/gipe/i.evapo.PT/main.c
grass-addons/gipe/i.evapo.PT/pt_daily_et.c
grass-addons/gipe/i.evapo.PT/pt_delta.c
grass-addons/gipe/i.evapo.PT/pt_ghamma.c
Log:
Cleaning+adding algorithmic accuracy+descriptions of alpha paramters candidates
Modified: grass-addons/gipe/i.evapo.PT/description.html
===================================================================
--- grass-addons/gipe/i.evapo.PT/description.html 2008-05-20 19:25:00 UTC (rev 31451)
+++ grass-addons/gipe/i.evapo.PT/description.html 2008-05-20 22:30:09 UTC (rev 31452)
@@ -1,9 +1,19 @@
<H2>DESCRIPTION</H2>
<EM>i.evapo.PT</EM> Calculates the diurnal evapotranspiration after Prestley and Taylor (1972).
+The Priestley-Taylor model (Priestley and Taylor, 1972) is a modification of Penman’s more theoretical equation.
<H2>NOTES</H2>
RNETD optional output from r.evapo.potrad is giving good results as input for net radiation in this module.
+
+Alpha values:
+1.32 for estimates from vegetated areas as a result of the increase in surface roughness (Morton, 1983; Brutsaert and Stricker, 1979)
+1.26 is applicable in humid climates (De Bruin and Keijman, 1979; Stewart and Rouse, 1976; Shuttleworth and Calder, 1979), and temperate hardwood swamps (Munro, 1979)
+1.74 has been recommended for estimating potential evapotranspiration in more arid regions (ASCE, 1990).
+
+Alpha values extracted from:
+http://www.civil.uwaterloo.ca/Watflood/Manual/02_03_1.htm
+
<H2>TODO</H2>
Modified: grass-addons/gipe/i.evapo.PT/main.c
===================================================================
--- grass-addons/gipe/i.evapo.PT/main.c 2008-05-20 19:25:00 UTC (rev 31451)
+++ grass-addons/gipe/i.evapo.PT/main.c 2008-05-20 22:30:09 UTC (rev 31452)
@@ -29,19 +29,17 @@
double pt_ghamma(double tempka, double p_atm);
//proto ET
-double pt_daily_et(double alpha_pt, double delta_pt, double ghamma_pt, double rnet, double g0 );
+double pt_daily_et(double alpha_pt, double delta_pt, double ghamma_pt, double rnet, double g0, double tempka );
int main(int argc, char *argv[])
{
/* buffer for input-output rasters */
void *inrast_TEMPKA,*inrast_PATM,*inrast_RNET,*inrast_G0;
+ DCELL *outrast;
- unsigned char *outrast;
-
/* pointers to input-output raster files */
int infd_TEMPKA,infd_PATM,infd_RNET,infd_G0;
-
int outfd;
/* mapsets for input raster files */
@@ -49,14 +47,12 @@
/* names of input-output raster files */
char *RNET, *TEMPKA, *PATM, *G0;
-
char *ETa;
/* input-output cell values */
DCELL d_tempka,d_pt_patm,d_rnet,d_g0;
DCELL d_pt_alpha, d_pt_delta, d_pt_ghamma, d_daily_et;
-
/* region informations and handler */
struct Cell_head cellhd;
int nrows, ncols;
@@ -86,36 +82,24 @@
"Prestley and Taylor formulation, 1972.");
/* Define different options */
- input_RNET = G_define_option();
+ input_RNET = G_define_standard_option(G_OPT_R_INPUT);
input_RNET->key = "RNET";
input_RNET->key_desc = "[W/m2]";
- input_RNET->type = TYPE_STRING;
- input_RNET->required = YES;
- input_RNET->gisprompt = "old,cell,raster";
input_RNET->description = _("Name of Net Radiation raster map");
- input_G0 = G_define_option();
+ input_G0 = G_define_standard_option(G_OPT_R_INPUT);
input_G0->key = "G0";
input_G0->key_desc = "[W/m2]";
- input_G0->type = TYPE_STRING;
- input_G0->required = YES;
- input_G0->gisprompt = "old,cell,raster";
input_G0->description = _("Name of Soil Heat Flux raster map");
- input_TEMPKA = G_define_option();
+ input_TEMPKA = G_define_standard_option(G_OPT_R_INPUT);
input_TEMPKA->key = "TEMPKA";
input_TEMPKA->key_desc = "[K]";
- input_TEMPKA->type = TYPE_STRING;
- input_TEMPKA->required = YES;
- input_TEMPKA->gisprompt = "old,cell,raster";
input_TEMPKA->description = _("Name of air temperature raster map");
- input_PATM = G_define_option();
+ input_PATM = G_define_standard_option(G_OPT_R_INPUT);
input_PATM->key = "PATM";
input_PATM->key_desc = "[millibars]";
- input_PATM->type = TYPE_STRING;
- input_PATM->required = YES;
- input_PATM->gisprompt = "old,cell,raster";
input_PATM->description = _("Name of Atmospheric Pressure raster map");
input_PT = G_define_option();
@@ -127,19 +111,12 @@
input_PT->description = _("Prestley-Taylor Coefficient");
input_PT->answer = "1.26";
- output = G_define_option() ;
+ output = G_define_standard_option(G_OPT_R_OUTPUT) ;
output->key = "output";
output->key_desc = "[mm/d]";
- output->type = TYPE_STRING;
- output->required = YES;
- output->gisprompt = "new,cell,raster" ;
output->description = _("Name of output Evapotranspiration layer");
/* Define the different flags */
- flag1 = G_define_flag() ;
- flag1->key = 'q' ;
- flag1->description = _("quiet");
-
zero = G_define_flag() ;
zero->key = 'z' ;
zero->description = _("set negative ETa to zero");
@@ -222,6 +199,7 @@
for (row = 0; row < nrows; row++)
{
+ G_percent(row, nrows, 2);
/* read input raster row into line buffer*/
if (G_get_raster_row (infd_RNET, inrast_RNET, row,data_type_rnet) < 0)
G_fatal_error (_("Could not read from <%s>"),RNET);
@@ -285,16 +263,14 @@
d_pt_ghamma = pt_ghamma(d_tempka, d_pt_patm);
//Calculate ET
- d_daily_et = pt_daily_et( d_pt_alpha, d_pt_delta, d_pt_ghamma, d_rnet, d_g0 );
+ d_daily_et = pt_daily_et( d_pt_alpha, d_pt_delta, d_pt_ghamma, d_rnet, d_g0, d_tempka );
if (zero->answer && d_daily_et<0)
d_daily_et=0.0;
/* write calculated ETP to output line buffer */
- ((DCELL *) outrast)[col] = d_daily_et;
+ outrast[col] = d_daily_et;
}
- if (!flag1->answer) G_percent(row, nrows, 2);
-
/* write output line buffer to output raster file */
if (G_put_raster_row (outfd, outrast, data_type_output) < 0)
G_fatal_error (_("Cannot write to <%s>"), ETa);
Modified: grass-addons/gipe/i.evapo.PT/pt_daily_et.c
===================================================================
--- grass-addons/gipe/i.evapo.PT/pt_daily_et.c 2008-05-20 19:25:00 UTC (rev 31451)
+++ grass-addons/gipe/i.evapo.PT/pt_daily_et.c 2008-05-20 22:30:09 UTC (rev 31452)
@@ -4,12 +4,21 @@
//Prestely and Taylor, 1972.
-double pt_daily_et(double alpha_pt,double delta_pt,double ghamma_pt,double rnet,double g0)
+double pt_daily_et(double alpha_pt,double delta_pt,double ghamma_pt,double rnet,double g0,double tempka)
{
- double result;
+ double result, latentHv;
+ double roh_w=1004.15;//mass density of water
+ double vap_slope_ratio;
+
+ /*Latent Heat of vaporization*/
+ latentHv = (2.501-(0.002361*(tempka-273.15)))*1000000.0;
+
+ /* Ratio of slope of saturation-vapour pressure Vs Temperature*/
+ /* ghamma_pt = psychrometric constant */
+ vap_slope_ratio = delta_pt / ( delta_pt + ghamma_pt );
+
+ result = (alpha_pt/(roh_w*latentHv)) * vap_slope_ratio * (rnet-g0);
- result = (alpha_pt/28.588) * ( delta_pt / ( delta_pt + ghamma_pt ) ) * ( rnet - g0 ) ;
-
return result;
}
Modified: grass-addons/gipe/i.evapo.PT/pt_delta.c
===================================================================
--- grass-addons/gipe/i.evapo.PT/pt_delta.c 2008-05-20 19:25:00 UTC (rev 31451)
+++ grass-addons/gipe/i.evapo.PT/pt_delta.c 2008-05-20 22:30:09 UTC (rev 31452)
@@ -3,18 +3,17 @@
#include<stdlib.h>
//Prestely and Taylor, 1972.
+//INPUT in Kelvin
double pt_delta(double tempka)
{
double a, b, result;
- if (tempka > 250.0){
- tempka = tempka - 273.15;
- }
- a = ( 17.27 * tempka ) / ( 237.3 + tempka ) ;
+ tempka -= 273.15;//Celsius
b = tempka + 237.3 ;
+ a = ( 17.27 * tempka ) / b ;
- result = 2504 * exp(a) / pow(b,2) ;
+ result = 2504.0 * exp(a) / pow(b,2) ;
return result;
}
Modified: grass-addons/gipe/i.evapo.PT/pt_ghamma.c
===================================================================
--- grass-addons/gipe/i.evapo.PT/pt_ghamma.c 2008-05-20 19:25:00 UTC (rev 31451)
+++ grass-addons/gipe/i.evapo.PT/pt_ghamma.c 2008-05-20 22:30:09 UTC (rev 31452)
@@ -3,15 +3,14 @@
#include<stdlib.h>
//Prestely and Taylor, 1972.
+//INPUT in Kelvin
double pt_ghamma(double tempka, double patm_pt)
{
double a, result;
double Cp = 1004.16;
- if (tempka > 250.0){
- tempka = tempka - 273.15;
- }
+ tempka -= 273.15;
a = 0.622 * pow(10,7) * (2.501 - (2.361 * pow(10,-3) * tempka));
More information about the grass-commit
mailing list