anchor.diff:          real,intent(in),dimension(:,:,:)::qv,p
           integer,intent(in)::j,nx
           real,dimension(nx) :: mr, e, es
  -        
  +
           ! convert sensible humidity to mixing ratio
           mr=qv(:,1,j)/(1-qv(:,1,j))
           ! convert mixing ratio to vapor pressure
  
positive.code: !!  [cloudfrac->],
  !!  [shortwave->],
  !!  [longwave->]
  !! 
  !! High level routine descriptions / purpose
  !!   ra_simple          - loops over X,Y grid cells, calls cloudfrac, shortwave,longwave on columns
  !!   cloudfrac           - calculates the cloud fraction following Xu and Randall (1996)
  !!   shortwave           - calculates shortwave at the surface following Reiff et al (1984)
  !!   longwave               - calculates longwave at the surface following Idso and Jackson (1969)
  !! 
  !! Driver inputs: p,th,pii,rho,qv,qc,qr,qs,rain,snow,dt,dz,nx,ny,nz
  !!   p   = pressure                      - 3D - input  - Pa     - (nx,nz,ny)
  !!   th  = potential temperature         - 3D - in/out - K      - (nx,nz,ny)
  
negative.code:         real,intent(in),dimension(nx)::rh,qc
          integer, intent(in) :: nx
          real,dimension(nx)::temporary
  
          temporary=((1-rh)*qc)**0.25
          where(temporary >1) temporary=1
          where(temporary <0.0001) temporary=0.0001
  
          cloudfrac=qc-qcmin
          where(cloudfrac<0) cloudfrac=0
  
          cloudfrac=(rh**0.25) * (1-exp((-2000*(cloudfrac)) / temporary))
          where(cloudfrac<0) cloudfrac=0
          where(cloudfrac>1) cloudfrac=1
  
      end function
  
      function calc_solar_elevation(date,lon,j,nx,day_frac)
          implicit none
          real, dimension(nx) :: calc_solar_elevation
  