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