continue timestamp = parse_timestamp(tokens[0]) observed_toa = float(tokens[2]) observed_shortwave = float(tokens[3]) observed_longwave = tokens[4] observed_air_temperature = float(tokens[5]) + 273.15 observed_rh = float(tokens[6]) / 100.0 observed_rain = float(tokens[7]) if timestamp in cloud_observations: observed_cloud_cover = cloud_observations[timestamp] else: observed_cloud_cover = 'NA' mu = max(0.01, radiation.cos_zenith( latitude, radiation.year(timestamp), radiation.day_of_year(timestamp), radiation.seconds_of_day(timestamp))) model_toa = radiation.insolation(mu) observed_tau = radiation.optical_depth(observed_toa, observed_shortwave, mu) model_tau = model_optical_depth( observed_cloud_cover, cloud_optical_depth_coeff, clear_sky_optical_depth, default_optical_depth) model_shortwave = radiation.extinguish(model_toa, model_tau, mu) vapour_pressure = radiation.vapour_pressure(observed_rh, observed_air_temperature)
#!/usr/bin/env python3 import math import sys import radiation latitude = math.radians(float(sys.argv[1])) for day_of_year in range(0, 364): for seconds_of_day in range(0, 86399, 60*15): mu = max(0.01, radiation.cos_zenith(latitude, 2010, day_of_year, seconds_of_day)) short_wave = radiation.insolation(mu) print(str(radiation.to_date(2010, day_of_year, seconds_of_day)) + ',' + str(short_wave))