module AgwxBiophys::ET

Constants

ALBEDO
KELVIN
SFCEMISS
SOLCON
STEFAN

Public Instance Methods

angstrom(avg_v_press,min_temp,max_temp,avg_temp) click to toggle source
# File lib/agwx_biophys/et.rb, line 83
def angstrom(avg_v_press,min_temp,max_temp,avg_temp)
  1.0 - sky_emiss(avg_v_press,min_temp,max_temp,avg_temp) / SFCEMISS
end
av_eir(doy) click to toggle source
# File lib/agwx_biophys/et.rb, line 37
def av_eir(doy)
  SOLCON * ( 1 + 0.035 * Math.cos( 2 * Math::PI * doy / 365.0 ) )
end
c_to_k(temperature) click to toggle source
# File lib/agwx_biophys/et.rb, line 59
def c_to_k(temperature); temperature + KELVIN; end
clr_ratio(d_to_sol,doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 87
def clr_ratio(d_to_sol,doy,lat)
  dts = daily_to_sol(d_to_sol)
  tc = to_clr(doy,lat)
  # Never return higher than 1
  [dts/tc,1.0].min
end
daily_to_sol(total_sol) click to toggle source
# File lib/agwx_biophys/et.rb, line 16
def daily_to_sol(total_sol); 0.0864 * total_sol; end
day_hours(doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 35
def day_hours(doy,lat); 24 - 2 * sunrise_hour(doy,lat); end
declin(doy) click to toggle source
# File lib/agwx_biophys/et.rb, line 18
def declin(doy)
  0.41 * 
    Math::cos(
      2 * Math::PI * ( doy - 172.0 ) / 365.0
    )
end
et(max_temp,min_temp,avg_temp,avg_v_press,d_to_sol,doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 98
def et(max_temp,min_temp,avg_temp,avg_v_press,d_to_sol,doy,lat)
  lwnet = lwnet(avg_v_press,min_temp,max_temp,avg_temp,d_to_sol,doy,lat  )
  lwd = lwu(min_temp,max_temp) - lwnet
  r_net_1 = (1.0 - ALBEDO) * daily_to_sol(d_to_sol) - lwnet
  ret1 = 1.28 * sfactor(min_temp,max_temp) * r_net_1
  # puts "lwnet #{lwnet}, lwd #{lwd}, r_net_1 #{r_net_1}, ret1 #{ret1} refet #{ret1 / 62.3}"
  [ret1 / 62.3,clr_ratio(d_to_sol,doy,lat) * 100.0]
end
lwnet(avg_v_press,min_temp,max_temp,avg_temp,d_to_sol,doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 94
def lwnet(avg_v_press,min_temp,max_temp,avg_temp,d_to_sol,doy,lat)
  angstrom(avg_v_press,min_temp,max_temp,avg_temp) * lwu(min_temp,max_temp)  * clr_ratio(d_to_sol,doy,lat)
end
lwu(min_temp,max_temp) click to toggle source

Temps are in Deg C

# File lib/agwx_biophys/et.rb, line 63
def lwu(min_temp,max_temp)
  avg = (min_temp+max_temp) / 2.0
  SFCEMISS * STEFAN * (273.15+avg) ** 4
end
rad_lat(lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 14
def rad_lat(lat); lat * Math::PI / 180.0;end
sfactor(min_temp,max_temp) click to toggle source
# File lib/agwx_biophys/et.rb, line 68
def sfactor(min_temp,max_temp)
  avg = (min_temp+max_temp) / 2.0
  0.398 + 0.0171 * avg - 0.000142 * avg * avg
end
sky_emiss(avg_v_press,min_temp,max_temp,avg_temp) click to toggle source
# File lib/agwx_biophys/et.rb, line 73
def sky_emiss(avg_v_press,min_temp,max_temp,avg_temp)

  if ( avg_v_press > 0.5)
    0.7 + (5.95e-4) * avg_v_press * Math.exp( 1500/(273+avg_temp) )
  else
    avg_t = (min_temp+max_temp) / 2.0
    (1 - 0.261*Math.exp(-0.000777*avg_t*avg_t))
  end
end
sunrise_angle(doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 25
def sunrise_angle(doy,lat)
  Math.acos(
    -1 *
    Math.tan(declin(doy)) *
    Math.tan(rad_lat(lat))
  )
end
sunrise_hour(doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 33
def sunrise_hour(doy,lat); 12 - ( 12 / Math::PI ) * sunrise_angle(doy,lat); end
to_clr(doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 55
def to_clr(doy,lat)
  to_eir(doy,lat) * (-0.7 + 0.86*day_hours(doy,lat)) / day_hours(doy,lat)
end
to_eir(doy,lat) click to toggle source
# File lib/agwx_biophys/et.rb, line 41
def to_eir(doy,lat)
  ( 0.0864 / Math::PI ) * av_eir(doy) *

  (
    sunrise_angle(doy,lat) *
     Math.sin( declin(doy) ) *
     Math.sin( rad_lat(lat) ) +
     
    Math.cos( declin(doy) ) *
     Math.cos( rad_lat(lat) ) *
     Math.sin( sunrise_angle(doy,lat) )
  )
end