| 1 |
#include <stdio.h> |
| 2 |
#include <math.h> |
| 3 |
#include <stdlib.h> |
| 4 |
#include <grass/gis.h> |
| 5 |
|
| 6 |
/*Hargreaves et al, 1985. */ |
| 7 |
double mh_original(double ra, double tavg, double tmax, double tmin, |
| 8 |
double p G_UNUSED) |
| 9 |
{ |
| 10 |
double td, result; |
| 11 |
|
| 12 |
td = tmax - tmin; |
| 13 |
if (tavg > 100.0) { |
| 14 |
tavg = tavg - 273.15; /*in case Temperature is in Kelvin */ |
| 15 |
} |
| 16 |
ra = ra * (24.0 * 60.0 * 60.0 / 1000000.0); /*convert W -> MJ/d */ |
| 17 |
result = 0.0023 * 0.408 * ra * (tavg + 17.8) * pow(td, 0.5); |
| 18 |
return result; |
| 19 |
} |