Talk:Meteorological data from ECMWF models

From Agri4castWiki
Jump to: navigation, search

Description to calculate PenmanMonteith can be improved. See code below.

void PenmanMonteith(SStationData WS, SWeatherObsStation WeatherObsStation, long globrad, float angot, SPenman *pPenmanResults) { float z = 10.0; float u10 = WeatherObsStation.Windspeed_10M; float u2 = (u10 * 4.87) / log((67.8*z) - 5.42);

float Tmean = (WeatherObsStation.TemperatureMax + WeatherObsStation.TemperatureMin) / 2;

float Patm = 101.3 * pow( (293-(0.0065*WS.Altitude))/293, 5.26);

float gamma = 0.665 * 1.0e-3; gamma = gamma * Patm;

float delta = 4098 * (0.6108 * exp( (17.27 * Tmean) / (237.3 + Tmean) ) ); delta = delta / pow((Tmean + 237.3), 2);

float eTmax = 0.6108 * exp( (17.27 * WeatherObsStation.TemperatureMax) / (237.3 + WeatherObsStation.TemperatureMax) ); float eTmin = 0.6108 * exp( (17.27 * WeatherObsStation.TemperatureMin) / (237.3 + WeatherObsStation.TemperatureMin) ); float es = (eTmax + eTmin) / 2;


float ea = WeatherObsStation.Vapourpressure / 10;

float BoltzmannTmax = 4.903 * 1.0e-9 * pow((WeatherObsStation.TemperatureMax + 273.16), 4); float BoltzmannTmin = 4.903 * 1.0e-9 * pow((WeatherObsStation.TemperatureMin + 273.16), 4);

float ClearSkyRadiation = (0.75 + (0.00002 * WS.Altitude)) * angot; float Rnl = ((BoltzmannTmax + BoltzmannTmin) / 2) * (0.34 - (0.14 * pow(ea, float(0.5))));

if (ClearSkyRadiation != 0) { Rnl = Rnl * (1.35 * (globrad/ClearSkyRadiation) - 0.35);

float Rn = (0.77 * (globrad/1000.0)) - Rnl;

float ET0 = (0.408 * delta * Rn) + (gamma * (900/(Tmean + 273)) * u2 * (es - ea));

pPenmanResults->ET0 = ET0 / (delta + gamma * (1 + (0.34*u2)) );

if (pPenmanResults->ET0 < 0) pPenmanResults->ET0 = 0; } else pPenmanResults->ET0 = 0;

}