module Evapotranspiration::Validation
Constants
- MAXLAT_RADIANS
- MAXSHA_RADIANS
- MAXSOLDEC_RADIANS
- MINLAT_RADIANS
Latitude
- MINSHA_RADIANS
Sunset hour angle
- MINSOLDEC_RADIANS
Solar declination
Public Class Methods
check_day_hours(hours, arg_name)
click to toggle source
Check that hours is in the range 1 to 24
# File lib/evapotranspiration/validation.rb, line 19 def self.check_day_hours(hours, arg_name) unless hours.between?(0,24) raise ArgumentError.new("#{arg_name} should be in the range 0-24: #{hours}") end end
check_doy(doy)
click to toggle source
Check day of the year is valid
# File lib/evapotranspiration/validation.rb, line 26 def self.check_doy(doy) unless doy.between?(1,366) raise ArgumentError.new("day of the year (doy) must be in range 1-366: #{doy}") end end
check_latitude_rad(latitude)
click to toggle source
# File lib/evapotranspiration/validation.rb, line 32 def self.check_latitude_rad(latitude) unless latitude.between?(MINLAT_RADIANS,MAXLAT_RADIANS) raise ArgumentError.new("latitude outside valid range #{MINLAT_RADIANS} to #{MAXLAT_RADIANS} rad: #{latitude}") end end
check_sol_dec_rad(sd)
click to toggle source
Solar declination can vary between -23.5 and +23.5 degrees. See mypages.iit.edu/~maslanka/SolarGeo.pdf
# File lib/evapotranspiration/validation.rb, line 40 def self.check_sol_dec_rad(sd) unless sd.between?(MINSOLDEC_RADIANS,MAXSOLDEC_RADIANS) raise ArgumentError.new("solar declination outside valid range #{MINSOLDEC_RADIANS} to #{MAXSOLDEC_RADIANS} rad: #{sd}") end end
check_sunset_hour_angle_rad(sha)
click to toggle source
Sunset hour angle has the range 0 to 180 degrees. See mypages.iit.edu/~maslanka/SolarGeo.pdf
# File lib/evapotranspiration/validation.rb, line 48 def self.check_sunset_hour_angle_rad(sha) unless sha.between?(MINSHA_RADIANS,MAXSHA_RADIANS) raise ArgumentError.new("sunset hour angle outside valid range #{MINSHA_RADIANS} to #{MAXSHA_RADIANS} rad: #{sha}") end end