[GRASS-SVN] r32966 - grass-addons/gipe/i.evapo.TSA
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Aug 21 07:48:44 EDT 2008
Author: ychemin
Date: 2008-08-21 07:48:43 -0400 (Thu, 21 Aug 2008)
New Revision: 32966
Modified:
grass-addons/gipe/i.evapo.TSA/main.c
grass-addons/gipe/i.evapo.TSA/tsa_daily_et.c
grass-addons/gipe/i.evapo.TSA/tsa_g0g.c
grass-addons/gipe/i.evapo.TSA/tsa_g0v.c
grass-addons/gipe/i.evapo.TSA/tsa_hg.c
grass-addons/gipe/i.evapo.TSA/tsa_hv.c
grass-addons/gipe/i.evapo.TSA/tsa_ra.c
grass-addons/gipe/i.evapo.TSA/tsa_rg.c
grass-addons/gipe/i.evapo.TSA/tsa_rng.c
grass-addons/gipe/i.evapo.TSA/tsa_rnv.c
grass-addons/gipe/i.evapo.TSA/tsa_rv.c
grass-addons/gipe/i.evapo.TSA/tsa_tempkg.c
grass-addons/gipe/i.evapo.TSA/tsa_tempkv.c
Log:
code cleaning, upgrade, standardization
Modified: grass-addons/gipe/i.evapo.TSA/main.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/main.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/main.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -1,14 +1,13 @@
/*****************************************************************************
*
* MODULE: i.evapo.TSA
-* AUTHOR: Yann Chemin (2007)
-* yann.chemin_AT_gmail.com
+* AUTHOR: Yann Chemin yann.chemin at gmail.com
*
* PURPOSE: To estimate the daily actual evapotranspiration by means
* of of a Two-Source Algorithm from Chen et al. (2005).
* IJRS, 26(8):1755-1762
*
-* COPYRIGHT: (C) 2007 by the GRASS Development Team
+* COPYRIGHT: (C) 2007-2008 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* Licence (>=2). Read the file COPYING that cames with GRASS
@@ -25,23 +24,23 @@
#include <grass/glocale.h>
-//protos Net radiation
+/*protos Net radiation*/
double rn_g(double rnet, double fv);
double rn_v(double rnet, double fv);
-//protos temperature fractions
+/*protos temperature fractions*/
double tempk_g(double tempk, double tempk_v, double fv);
double tempk_v(double tempk, double fv);
-//protos soil heat flux
+/*protos soil heat flux*/
double g_0g(double rnet);
double g_0v(double bbalb, double ndvi, double tempk_v, double rnet);
-//protos sensible heat flux
+/*protos sensible heat flux*/
double h_g(double tempk_g, double tempk_v, double tempk_a, double r_g, double r_v, double r_a );
double h_v(double tempk_g, double tempk_v, double tempk_a, double r_g, double r_v, double r_a );
-//protos necessary for sensible heat flux calculations
+/*protos necessary for sensible heat flux calculations*/
double ra(double d, double z0, double h, double z, double u_z, double tempk_a, double tempk_v);
double rg(double d, double z0, double z0s, double h, double z, double w, double u_z, double tempk_a, double tempk_v);
double rv(double d, double z0, double h, double z, double w, double u_z, double tempk_a, double tempk_v);
-//proto ET
+/*proto ET*/
double daily_et(double et_instantaneous, double time, double sunshine_hours);
@@ -52,7 +51,7 @@
void *inrast_UZ,*inrast_DISP,*inrast_Z0,*inrast_HV;
void *inrast_Z0S,*inrast_W,*inrast_TIME,*inrast_SUNH;
- unsigned char *outrast;
+ DCELL *outrast;
/* pointers to input-output raster files */
int infd_FV,infd_TEMPK,infd_TEMPKA,infd_ALB,infd_NDVI,infd_RNET;
@@ -81,7 +80,6 @@
DCELL d_le_inst_g,d_le_inst_v,d_le_inst;
DCELL d_time,d_sunh;
-
/* region informations and handler */
struct Cell_head cellhd;
int nrows, ncols;
@@ -92,7 +90,7 @@
struct Option *input_RNET, *input_FV, *input_TEMPK, *input_TEMPKA, *input_ALB, *input_NDVI;
struct Option *input_UZ,*input_Z,*input_DISP,*input_Z0,*input_HV;
struct Option *input_Z0S,*input_W,*input_TIME,*input_SUNH,*output;
- struct Flag *flag1, *zero;
+ struct Flag *zero;
struct Colors color;
struct History history;
@@ -122,61 +120,40 @@
"Two-Source Algorithm formulation, after Chen et al., 2005.");
/* 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_RNET->description = _("Name of Net Radiation raster layer");
- input_FV = G_define_option();
+ input_FV = G_define_standard_option(G_OPT_R_INPUT);
input_FV->key = "FV";
input_FV->key_desc = "[-]";
- input_FV->type = TYPE_STRING;
- input_FV->required = YES;
- input_FV->gisprompt = "old,cell,raster";
- input_FV->description = _("Name of Vegetation Fraction raster map");
+ input_FV->description = _("Name of Vegetation Fraction raster layer");
- input_TEMPK = G_define_option();
+ input_TEMPK = G_define_standard_option(G_OPT_R_INPUT);
input_TEMPK->key = "TEMPK";
input_TEMPK->key_desc = "[K]";
- input_TEMPK->type = TYPE_STRING;
- input_TEMPK->required = YES;
- input_TEMPK->gisprompt = "old,cell,raster";
- input_TEMPK->description = _("Name of surface temperature raster map");
+ input_TEMPK->description = _("Name of surface temperature raster layer");
- 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_TEMPKA->description = _("Name of air temperature raster layer");
- input_ALB = G_define_option();
+ input_ALB = G_define_standard_option(G_OPT_R_INPUT);
input_ALB->key = "ALB";
input_ALB->key_desc = "[-]";
- input_ALB->type = TYPE_STRING;
- input_ALB->required = YES;
- input_ALB->gisprompt = "old,cell,raster";
- input_ALB->description = _("Name of Albedo raster map");
+ input_ALB->description = _("Name of Albedo raster layer");
- input_NDVI = G_define_option();
+ input_NDVI = G_define_standard_option(G_OPT_R_INPUT);
input_NDVI->key = "NDVI";
input_NDVI->key_desc = "[-]";
- input_NDVI->type = TYPE_STRING;
- input_NDVI->required = YES;
- input_NDVI->gisprompt = "old,cell,raster";
- input_NDVI->description = _("Name of NDVI raster map");
+ input_NDVI->description = _("Name of NDVI raster layer");
- input_UZ = G_define_option();
+ input_UZ = G_define_standard_option(G_OPT_R_INPUT);
input_UZ->key = "UZ";
input_UZ->key_desc = "[m/s]";
- input_UZ->type = TYPE_STRING;
- input_UZ->required = YES;
- input_UZ->gisprompt = "old,cell,raster";
- input_UZ->description = _("Name of wind speed (at z ref. height) raster map");
+ input_UZ->description = _("Name of wind speed (at z ref. height) raster layer");
input_Z = G_define_option();
input_Z->key = "Z";
@@ -187,75 +164,49 @@
input_Z->gisprompt = "value,parameter";
input_Z->description = _("Value of reference height for UZ");
- input_DISP = G_define_option();
+ input_DISP = G_define_standard_option(G_OPT_R_INPUT);
input_DISP->key = "DISP";
input_DISP->key_desc = "[m]";
- input_DISP->type = TYPE_STRING;
input_DISP->required = NO;
- input_DISP->gisprompt = "old,cell,raster";
- input_DISP->description = _("Name of displacement height raster map");
+ input_DISP->description = _("Name of displacement height raster layer");
- input_Z0 = G_define_option();
+ input_Z0 = G_define_standard_option(G_OPT_R_INPUT);
input_Z0->key = "Z0";
input_Z0->key_desc = "[m]";
- input_Z0->type = TYPE_STRING;
input_Z0->required = NO;
- input_Z0->gisprompt = "old,cell,raster";
- input_Z0->description = _("Name of surface roughness length raster map");
+ input_Z0->description = _("Name of surface roughness length raster layer");
- input_HV = G_define_option();
+ input_HV = G_define_standard_option(G_OPT_R_INPUT);
input_HV->key = "HV";
input_HV->key_desc = "[m]";
- input_HV->type = TYPE_STRING;
input_HV->required = NO;
- input_HV->gisprompt = "old,cell,raster";
- input_HV->description = _("Name of vegetation height raster map (one out of DISP, Z0 or HV should be given!)");
+ input_HV->description = _("Name of vegetation height raster layer (one out of DISP, Z0 or HV should be given!)");
- input_Z0S = G_define_option();
+ input_Z0S = G_define_standard_option(G_OPT_R_INPUT);
input_Z0S->key = "Z0S";
input_Z0S->key_desc = "[m]";
- input_Z0S->type = TYPE_STRING;
- input_Z0S->required = YES;
- input_Z0S->gisprompt = "old,cell,raster";
- input_Z0S->description = _("Name of bare soil surface roughness length raster map");
+ input_Z0S->description = _("Name of bare soil surface roughness length raster layer");
- input_W = G_define_option();
+ input_W = G_define_standard_option(G_OPT_R_INPUT);
input_W->key = "W";
input_W->key_desc = "[g]";
- input_W->type = TYPE_STRING;
- input_W->required = YES;
- input_W->gisprompt = "old,cell,raster";
- input_W->description = _("Name of leaf weight raster map");
+ input_W->description = _("Name of leaf weight raster layer");
- input_TIME = G_define_option();
+ input_TIME = G_define_standard_option(G_OPT_R_INPUT);
input_TIME->key = "TIME";
input_TIME->key_desc = "[HH.HH]";
- input_TIME->type = TYPE_STRING;
- input_TIME->required = YES;
- input_TIME->gisprompt = "old,cell,raster";
- input_TIME->description = _("Name of local Time at satellite overpass raster map");
+ input_TIME->description = _("Name of local Time at satellite overpass raster layer");
- input_SUNH = G_define_option();
+ input_SUNH = G_define_standard_option(G_OPT_R_INPUT);
input_SUNH->key = "SUNH";
input_SUNH->key_desc = "[HH.HH]";
- input_SUNH->type = TYPE_STRING;
- input_SUNH->required = YES;
- input_SUNH->gisprompt = "old,cell,raster";
- input_SUNH->description = _("Name of Sunshine hours raster map");
+ input_SUNH->description = _("Name of Sunshine hours raster layer");
- output = G_define_option() ;
- output->key = "output";
+ output = G_define_standard_option(G_OPT_R_OUTPUT) ;
output->key_desc = "[mm/d]";
- output->type = TYPE_STRING;
- output->required = YES;
- output->gisprompt = "new,cell,raster" ;
output->description = _("Name of output Actual 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");
@@ -455,6 +406,7 @@
/* start the loop through cells */
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)
@@ -579,7 +531,7 @@
break;
}
}else{
- d_disp = -10.0;//negative, see inside functions
+ d_disp = -10.0;/*negative, see inside functions*/
}
if(Z0!=NULL){
switch(data_type_z0){
@@ -594,7 +546,7 @@
break;
}
}else{
- d_z0 = -10.0;//negative, see inside functions
+ d_z0 = -10.0;/*negative, see inside functions*/
}
if(HV!=NULL){
switch(data_type_hv){
@@ -609,7 +561,7 @@
break;
}
}else{
- d_hv = -10.0;//negative, see inside functions
+ d_hv = -10.0;/*negative, see inside functions*/
}
switch(data_type_z0s){
case CELL_TYPE:
@@ -656,19 +608,19 @@
break;
}
- //Calculate Net radiation fractions
+ /*Calculate Net radiation fractions*/
d_rn_g = rn_g( d_rnet, d_fv);
d_rn_v = rn_v( d_rnet, d_fv);
- //Calculate temperature fractions
+ /*Calculate temperature fractions*/
d_tempk_v = tempk_v( d_tempk, d_fv);
d_tempk_g = tempk_g( d_tempk, d_tempk_v, d_fv);
- //Calculate soil heat flux fractions
+ /*Calculate soil heat flux fractions*/
d_g0_g = g_0g( d_rnet);
d_g0_v = g_0v( d_alb, d_ndvi, d_tempk_v, d_rnet);
- //Data necessary for sensible heat flux calculations
+ /*Data necessary for sensible heat flux calculations*/
if(d_disp<0.0&&d_z0<0.0&&d_hv<0.0){
G_fatal_error (_("DISP, Z0 and HV are all negative, cannot continue, bailing out... Check your optional input files again"));
}else{
@@ -676,16 +628,16 @@
d_rg = rg( d_disp, d_z0, d_z0s, d_hv, d_z, d_w, d_uz, d_tempka, d_tempk_v);
d_rv = rv( d_disp, d_z0, d_hv, d_z, d_w, d_uz, d_tempka, d_tempk_v);
}
- //Calculate sensible heat flux fractions
+ /*Calculate sensible heat flux fractions*/
d_h_g = h_g( d_tempk_g, d_tempk_v, d_tempka, d_rg, d_rv, d_ra );
d_h_v = h_v( d_tempk_g, d_tempk_v, d_tempka, d_rg, d_rv, d_ra );
- //Calculate LE
+ /*Calculate LE*/
d_le_inst_v = d_rn_v - d_g0_v - d_h_v;
d_le_inst_g = d_rn_g - d_g0_g - d_h_g;
d_le_inst = d_le_inst_v + d_le_inst_g;
- //Calculate ET
+ /*Calculate ET*/
d_daily_et = daily_et( d_le_inst, d_time, d_sunh);
@@ -693,10 +645,9 @@
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)
Modified: grass-addons/gipe/i.evapo.TSA/tsa_daily_et.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_daily_et.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_daily_et.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,14 +2,17 @@
#include<math.h>
#include<stdlib.h>
-//Xie, X.Q., 1991: Estimation of daily evapo-transpiration (ET) from one time-of-day remotely sensed canopy temperature. Remote Sensing of Environment China, 6, pp.253-259.
+/* Xie, X.Q., 1991: Estimation of daily evapo-transpiration (ET)
+ * from one time-of-day remotely sensed canopy temperature.
+ * Remote Sensing of Environment China, 6, pp.253-259.
+ */
#define PI 3.1415927
double daily_et(double et_instantaneous, double time, double sunshine_hours)
{
double n_e, result;
- //Daily ET hours
+ /*Daily ET hours*/
n_e = sunshine_hours - 2.0 ;
result = et_instantaneous * (2 * n_e) / (PI * sin(PI*time/n_e)) ;
Modified: grass-addons/gipe/i.evapo.TSA/tsa_g0g.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_g0g.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_g0g.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,8 +2,9 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
double g_0g(double rnet)
{
Modified: grass-addons/gipe/i.evapo.TSA/tsa_g0v.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_g0v.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_g0v.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,8 +2,9 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
double g_0v(double bbalb, double ndvi, double tempk_v, double rnet)
{
Modified: grass-addons/gipe/i.evapo.TSA/tsa_hg.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_hg.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_hg.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,8 +2,9 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
double h_g(double tempk_g, double tempk_v, double tempk_a, double r_g, double r_v, double r_a )
{
Modified: grass-addons/gipe/i.evapo.TSA/tsa_hv.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_hv.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_hv.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,8 +2,9 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
double h_v(double tempk_g, double tempk_v, double tempk_a, double r_g, double r_v, double r_a )
{
Modified: grass-addons/gipe/i.evapo.TSA/tsa_ra.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_ra.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_ra.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,49 +2,51 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ *
+ * d = zero plane displacement (m)
+ * z0 = surface roughness length gouverning heat and vapour transfers (m)
+ * h = vegetation height (m)
+ * z = reference height of air temperature and humidity measurements (m)
+ * u_z = wind speed at reference height z (m/s)
+ * tempk_a = air temperature (at reference height z?) (K)
+ * tempk_v = surface temperature of vegetation (K)
+ *
+ * If h (vegetation height) is given then d and z0 will be:
+ * d = 0.63h
+ * z0 = 0.13h
+ * If d OR z0 are positive a relationship will find the second one
+ * based on the equations above
+ * If d AND z0 are positive they are used regardless of h values
+ */
-// d = zero plane displacement (m)
-// z0 = surface roughness length gouverning heat and vapour transfers (m)
-// h = vegetation height (m)
-// z = reference height of air temperature and humidity measurements (m)
-// u_z = wind speed at reference height z (m/s)
-// tempk_a = air temperature (at reference height z?) (K)
-// tempk_v = surface temperature of vegetation (K)
-
-//If h (vegetation height) is given then d and z0 will be:
-//d = 0.63h
-//z0 = 0.13h
-//If d OR z0 are positive a relationship will find the second one
-//based on the equations above
-//If d AND z0 are positive they are used regardless of h values
-
double ra(double d, double z0, double h, double z, double u_z, double tempk_a, double tempk_v)
{
double ra_0, molength, u_star, psi, result;
- double vonKarman = 0.41; // von Karman constant
- double g = 9.81 ; // gravitational acceleration (m/s)
+ double vonKarman = 0.41; /*von Karman constant*/
+ double g = 9.81 ; /*gravitational acceleration (m/s)*/
- //Deal with input of vegetation height
+ /*Deal with input of vegetation height*/
if ( h > 0.0 ){
d = 0.63*h;
z0 = 0.13*h;
- //Deal with input of displacement height
+ /*Deal with input of displacement height*/
} else if (d > 0.0 && z0 < 0.0){
z0 = 0.13 * (d/0.63);
- //Deal with input of surface roughness length
+ /*Deal with input of surface roughness length*/
} else if (d < 0.0 && z0 > 0.0){
d = 0.63 * (z0/0.13);
}
ra_0 = pow(log ((z-d)/z0),2) / ( pow(vonKarman,2)* u_z );
- //psi, molength, u_star: Ambast S.K., Keshari A.K., Gosain A.K. 2002.
- //An operational model for estimating evapotranspiration
- //through Surface Energy Partitioning (RESEP).
- //International Journal of Remote Sensing, 23, pp. 4917-4930.
+ /* psi, molength, u_star: Ambast S.K., Keshari A.K., Gosain A.K. 2002.
+ * An operational model for estimating evapotranspiration
+ * through Surface Energy Partitioning (RESEP).
+ * International Journal of Remote Sensing, 23, pp. 4917-4930.
+ */
u_star = vonKarman * u_z / log((z-d)/z0);
molength = u_star*((tempk_v+tempk_a)/2)/(vonKarman*g*(tempk_a-tempk_v)/u_z) ;
@@ -53,9 +55,10 @@
} else {
psi = (1+5*((z-d)/molength));
}
- //psi & ra: Wang, C.Y., Niu Z., Tang H.J. 2002.
- //Technology of Earth Observation and Precision agriculture
- //(Beijing: Science Press)
+ /* psi & ra: Wang, C.Y., Niu Z., Tang H.J. 2002.
+ * Technology of Earth Observation and Precision agriculture
+ * (Beijing: Science Press)
+ */
result = ra_0 * ( 1 + (psi*(z-d)/z0) ) ;
return result;
Modified: grass-addons/gipe/i.evapo.TSA/tsa_rg.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_rg.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_rg.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,41 +2,42 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ *
+ * d = zero plane displacement (m)
+ * z0 = surface roughness length gouverning heat and vapour transfers (m)
+ * h = vegetation height (m)
+ * w = weight of leaf (g)
+ * z = reference height of air temperature and humidity measurements (m)
+ * u_z = wind speed at reference height (m/s)
+ * u_h = wind speed at plant height (m/s)
+ * tempk_a = air temperature (at reference height z?) (K)
+ * tempk_v = surface temperature of vegetation (K)
+ *
+ * If h (vegetation height) is given then d and z0 will be:
+ * d = 0.63h
+ * z0 = 0.13h
+ * If d OR z0 are positive a relationship will find the second one
+ * based on the equations above
+ * If d AND z0 are positive they are used regardless of h values
+ */
-// d = zero plane displacement (m)
-// z0 = surface roughness length gouverning heat and vapour transfers (m)
-// h = vegetation height (m)
-// w = weight of leaf (g)
-// z = reference height of air temperature and humidity measurements (m)
-// u_z = wind speed at reference height (m/s)
-// u_h = wind speed at plant height (m/s)
-// tempk_a = air temperature (at reference height z?) (K)
-// tempk_v = surface temperature of vegetation (K)
-
-//If h (vegetation height) is given then d and z0 will be:
-//d = 0.63h
-//z0 = 0.13h
-//If d OR z0 are positive a relationship will find the second one
-//based on the equations above
-//If d AND z0 are positive they are used regardless of h values
-
double rg(double d, double z0, double z0s, double h, double z, double w, double u_z, double tempk_a, double tempk_v)
{
double alpha, molength, u_star, k_h, temp, result;
- double vonKarman = 0.41; // von Karman constant
- double g = 9.81 ; // gravitational acceleration (m/s)
+ double vonKarman = 0.41; /* von Karman constant*/
+ double g = 9.81 ; /*gravitational acceleration (m/s)*/
- //Deal with input of vegetation height
+ /*Deal with input of vegetation height*/
if ( h > 0.0 ){
d = 0.63*h;
z0 = 0.13*h;
- //Deal with input of displacement height
+ /*Deal with input of displacement height*/
} else if (d > 0.0 && z0 < 0.0){
z0 = 0.13 * (d/0.63);
- //Deal with input of surface roughness length
+ /*Deal with input of surface roughness length*/
} else if (d < 0.0 && z0 > 0.0){
d = 0.63 * (z0/0.13);
}
@@ -45,15 +46,17 @@
h = d / 0.63 ;
}
- //molength, u_star: Ambast S.K., Keshari A.K., Gosain A.K. 2002.
- //An operational model for estimating evapotranspiration
- //through Surface Energy Partitioning (RESEP).
- //International Journal of Remote Sensing, 23, pp. 4917-4930.
+ /* molength, u_star: Ambast S.K., Keshari A.K., Gosain A.K. 2002.
+ * An operational model for estimating evapotranspiration
+ * through Surface Energy Partitioning (RESEP).
+ * International Journal of Remote Sensing, 23, pp. 4917-4930.
+ */
u_star = vonKarman * u_z / log((z-d)/z0);
molength = u_star*((tempk_v+tempk_a)/2)/(vonKarman*g*(tempk_a-tempk_v)/u_z) ;
- //rv: Choudhury B.J. and Monteith J.L. 1988.
- //A four-layer model for the heat budget of homogeneous land surfaces.
- //Quarterly Journal of the Royal Meteorological Society,114,pp.373-398.
+ /* rv: Choudhury B.J. and Monteith J.L. 1988.
+ * A four-layer model for the heat budget of homogeneous land surfaces.
+ * Quarterly Journal of the Royal Meteorological Society,114,pp.373-398.
+ */
k_h = 1.5*pow(vonKarman,2)*(h-d)*u_z/(log((z-d)/z0));
alpha = 1.0 / ((d/h)*log((h-d)/z0));
temp = h*exp(alpha)/(alpha*k_h) ;
Modified: grass-addons/gipe/i.evapo.TSA/tsa_rng.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_rng.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_rng.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,8 +2,9 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
double rn_g(double rnet, double fv)
{
Modified: grass-addons/gipe/i.evapo.TSA/tsa_rnv.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_rnv.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_rnv.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,8 +2,9 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
double rn_v(double rnet, double fv)
{
Modified: grass-addons/gipe/i.evapo.TSA/tsa_rv.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_rv.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_rv.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -2,53 +2,55 @@
#include<math.h>
#include<stdlib.h>
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ *
+ * d = zero plane displacement (m)
+ * z0 = surface roughness length gouverning heat and vapour transfers (m)
+ * h = vegetation height (m)
+ * w = weight of leaf (g)
+ * z = reference height of air temperature and humidity measurements (m)
+ * u_z = wind speed at reference height (m/s)
+ * u_h = wind speed at plant height (m/s)
+ * tempk_a = air temperature (at reference height z?) (K)
+ * tempk_v = surface temperature of vegetation (K)
+ *
+ * If h (vegetation height) is given then d and z0 will be:
+ * d = 0.63h
+ * z0 = 0.13h
+ * If d OR z0 are positive a relationship will find the second one
+ * based on the equations above
+ * If d AND z0 are positive they are used regardless of h values
+ */
-// d = zero plane displacement (m)
-// z0 = surface roughness length gouverning heat and vapour transfers (m)
-// h = vegetation height (m)
-// w = weight of leaf (g)
-// z = reference height of air temperature and humidity measurements (m)
-// u_z = wind speed at reference height (m/s)
-// u_h = wind speed at plant height (m/s)
-// tempk_a = air temperature (at reference height z?) (K)
-// tempk_v = surface temperature of vegetation (K)
-
-//If h (vegetation height) is given then d and z0 will be:
-//d = 0.63h
-//z0 = 0.13h
-//If d OR z0 are positive a relationship will find the second one
-//based on the equations above
-//If d AND z0 are positive they are used regardless of h values
-
double rv(double d, double z0, double h, double z, double w, double u_z, double tempk_a, double tempk_v)
{
double alpha, molength, u_star, u_h, result;
- double vonKarman = 0.41; // von Karman constant
- double g = 9.81 ; // gravitational acceleration (m/s)
-
+ double vonKarman = 0.41; /* von Karman constant */
+ double g = 9.81 ; /* gravitational acceleration (m/s) */
- //Deal with input of vegetation height
+ /* Deal with input of vegetation height */
if ( h > 0.0 ){
d = 0.63*h;
z0 = 0.13*h;
- //Deal with input of displacement height
+ /* Deal with input of displacement height */
} else if (d > 0.0 && z0 < 0.0){
z0 = 0.13 * (d/0.63);
- //Deal with input of surface roughness length
+ /* Deal with input of surface roughness length */
} else if (d < 0.0 && z0 > 0.0){
d = 0.63 * (z0/0.13);
}
- //molength, u_star: Ambast S.K., Keshari A.K., Gosain A.K. 2002.
- //An operational model for estimating evapotranspiration
- //through Surface Energy Partitioning (RESEP).
- //International Journal of Remote Sensing, 23, pp. 4917-4930.
+ /* molength, u_star: Ambast S.K., Keshari A.K., Gosain A.K. 2002.
+ * An operational model for estimating evapotranspiration
+ * through Surface Energy Partitioning (RESEP).
+ * International Journal of Remote Sensing, 23, pp. 4917-4930.
+ */
u_star = vonKarman * u_z / log((z-d)/z0);
molength = u_star*((tempk_v+tempk_a)/2)/(vonKarman*g*(tempk_a-tempk_v)/u_z) ;
- //rv: Choudhury B.J. and Monteith J.L. 1988.
- //A four-layer model for the heat budget of homogeneous land surfaces.
- //Quarterly Journal of the Royal Meteorological Society,114,pp.373-398.
+ /* rv: Choudhury B.J. and Monteith J.L. 1988.
+ * A four-layer model for the heat budget of homogeneous land surfaces.
+ * Quarterly Journal of the Royal Meteorological Society,114,pp.373-398.
+ */
u_h = 1.5*u_z*log((h-d)/z0)/(log((z-d)/z0));
alpha = 1.0 / ((d/h)*log((h-d)/z0));
result = 50.0*alpha*pow(abs(w/u_h),0.5) / (molength*(1-exp(-alpha/2))) ;
Modified: grass-addons/gipe/i.evapo.TSA/tsa_tempkg.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_tempkg.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_tempkg.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -3,10 +3,12 @@
#include<stdlib.h>
-//Temperature of ground from Tvegetation
-//Based on two sources pixel split
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Temperature of ground from Tvegetation
+ * Based on two sources pixel split
+ * Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
+
double tempk_g(double tempk, double tempk_v, double fv)
{
double result;
Modified: grass-addons/gipe/i.evapo.TSA/tsa_tempkv.c
===================================================================
--- grass-addons/gipe/i.evapo.TSA/tsa_tempkv.c 2008-08-21 11:23:44 UTC (rev 32965)
+++ grass-addons/gipe/i.evapo.TSA/tsa_tempkv.c 2008-08-21 11:48:43 UTC (rev 32966)
@@ -3,10 +3,12 @@
#include<stdlib.h>
-//Temperature of vegetation
-//Based on two sources pixel split
-//Chen et al., 2005. IJRS 26(8):1755-1762.
-//Estimation of daily evapotranspiration using a two-layer remote sensing model.
+/* Temperature of vegetation
+ * Based on two sources pixel split
+ * Chen et al., 2005. IJRS 26(8):1755-1762.
+ * Estimation of daily evapotranspiration using a two-layer remote sensing model.
+ */
+
double tempk_v(double tempk, double fv)
{
double a, result;
More information about the grass-commit
mailing list