anchor.diff:  		calc_solar_elevation = sin_lat_m(:,j) * sin(declination) + & 
   							   cos_lat_m(:,j) * cos(declination) * cos(hour_angle)
   		calc_solar_elevation = asin(calc_solar_elevation)
  -		
  -! 		if (j==10) then
  -! 			print*, " "
  -! 			print*, "hr  = ",hour_angle(10)/2/pi *24 !, (hour_angle(10)/2/pi - lon(10,j)/360.0) *24
  -! 			print*, "dec = ",declination(10)/2/pi*360, sin(calc_solar_elevation(10))
  -! 			print*, "elev= ",calc_solar_elevation(10)/2.0/pi * 360.0 !, calc_solar_elevation(10)
  -! 			print*, sin_lat_m(10,j), sin(declination(10)), cos_lat_m(10,j), cos(declination(10)), cos(hour_angle(10))
  -! 		endif
  +
  +		! if the sun is below the horizon just set elevation to 0
   		where(calc_solar_elevation<0) calc_solar_elevation=0
   	end function calc_solar_elevation
   	
  
positive.code: 	end function shortwave
  	
  	function longwave(T_air, cloud_cover,nx)
  		implicit none
  		real, dimension(nx) :: longwave
  		real, intent(in), dimension(nx) :: T_air,cloud_cover
  
negative.code: 	real, allocatable, dimension(:,:) :: cos_lat_m,sin_lat_m
  	real, parameter :: So=1367.0 ! Solar "constant" W/m^2
  	real, parameter :: qcmin=1e-5 ! arbitrarily selected minimum "cloud" water content to affect radiation
  	real, parameter :: MINIMUM_RH=1e-10 ! bounds on relative humidity = [min_rh to 1-min_rh]
  contains
  	subroutine ra_simple_init(domain,options)
  		implicit none
  