| 1 |
#include <stdio.h> |
| 2 |
#include <math.h> |
| 3 |
#include <stdlib.h> |
| 4 |
|
| 5 |
double g_0(double bbalb, double ndvi, double tempk, double rnet, double time, |
| 6 |
int roerink) |
| 7 |
{ |
| 8 |
double a, b, result; |
| 9 |
double r0_coef = 1.1; |
| 10 |
|
| 11 |
if (time <= 9.0 || time > 15.0) |
| 12 |
r0_coef = 1.1; |
| 13 |
else if (time > 9.0 && time <= 11.0) |
| 14 |
r0_coef = 1.0; |
| 15 |
else if (time > 11.0 && time <= 13.0) |
| 16 |
r0_coef = 0.9; |
| 17 |
else if (time > 13.0 && time <= 15.0) |
| 18 |
r0_coef = 1.0; |
| 19 |
a = (0.0032 * (bbalb / r0_coef) + |
| 20 |
0.0062 * (bbalb / r0_coef) * (bbalb / r0_coef)); |
| 21 |
b = (1 - 0.978 * pow(ndvi, 4)); |
| 22 |
/* Spain (Bastiaanssen, 1995) */ |
| 23 |
result = (rnet * (tempk - 273.15) / bbalb) * a * b; |
| 24 |
/* HAPEX-Sahel (Roerink, 1995) */ |
| 25 |
if (roerink) |
| 26 |
result = result * 1.430 - 0.0845; |
| 27 |
|
| 28 |
return result; |
| 29 |
} |