Debian Codegraph @

imagery/i.evapo.mh/mh_eto.c

raw
1 #include <stdio.h>
2 #include <math.h>
3 #include <stdlib.h>
4
5 /*Droogers and Allen, 2001. */
6 /*p is [mm/month] */
7 double mh_eto(double ra, double tavg, double tmax, double tmin, double p)
8 {
9 double td, result;
10
11 td = tmax - tmin;
12 if (tavg > 100.0) {
13 tavg = tavg - 273.15; /*in case temperature is in Kelvin */
14 }
15 ra = ra * (24.0 * 60.0 * 60.0 / 1000000.0); /*convert W -> MJ/d */
16 result = 0.0013 * 0.408 * ra * (tavg + 17.0) * pow((td - 0.0123 * p), 0.76);
17 return result;
18 }