      subroutine _name_(suntheta,sunphi,skytheta,skyphi, skyrad)
c
c     user template on file h41\template\skyrad.txt
c
c     This template shows the form required for subroutines that 
c     return the sky radiance distribution.  The radiance values
c     returned by this routine do not need to be "absolute" or 
c     "calibrated" radiances; the magnitude of the sky radiances
c     will be adjusted (in core routine qasky) to give the direct and
c     diffuse irradiance values specified by the skyirrad routine.
c
c     The subroutines on files h41\maincode\hcnrad.f and cosrad.f are
c     specific examples of how to implement this template.
c
c     A skyrad routine is called by Hydrolight core routines to obtain
c     the angular (directional) pattern of the sky radiance distribution.
c     The skyrad routine is incorporated into the Hydrolight core routines 
c     via include statements of the form
c        INCLUDE 'SKYRAD.INC'
c     The include file SKYRAD.INC is created by the front-end program
c     when the user selects the sky radiance model to be used in the run.
c
c     The required format of the subroutine is
c
c     subroutine _name_(suntheta,sunphi,skytheta,skyphi, skyrad)
c
c     where
c
c     _name_ is replaced by the desired name of the routine, e.g. myskyrad
c
C     INPUT:
c	suntheta,sunphi = the (theta,phi) position of the sun:
c                       theta = 0 is the zenith direction
c                       phi = 0 is the direction of the sun
c	                 
c	skymu,skyphi = the (theta,phi) direction where the sky radiance 
c                    is to be computed
c
c     all angles are in radians, i.e.
c          0.0 .le. suntheta,skytheta .le. pi/2
c          0.0 .le. sunphi,skyphi .le. 2pi
c
c**** Note: any other input needed by the user's radiance model, such as
c           the current wavelength, can be passed via common blocks.
c
c     OUTPUT:
c	skyrad = the (relative or absolute) sky radiance in direction
c             (skytheta,skyphi)
c
c**** Note:  after creating a new routine from this template,
c        1.  save the file with a .f extension, e.g. myskyrad.f
c        2.  place the new file in the maincode directory
c        3.  add the new filename to the makefile in the maincode directory
c
      data kall/0/
c     MUST save values between subroutine calls:
      save
c
      if(kall.eq.0) then
c
c        Initialization on the first call:
c
c        In this section, perform any initialization calculations that
c        need to be done only once, such as computing the parameters of
c        a model or reading in a data file.  
c
c------- Add user initialization code here: ---------------------------
c
c------- End user initialization code ---------------------------------
c
         kall = 1
      endif
c
c     Subsequent calls to the routine execute only the following code.
c     Use this code to define the sky radiance for the given input
c     directions.  Make this code as efficient as possible.  
c
c---- Add user code here: -----------------------------------------------
c
c******* Note: If desired, an atmospheric radiative transfer model such as
c        LOWTRAN or MODTRAN could be called here to compute the sky radiance.
c
c******* Note: be sure to define the sky radiance via a statement of the form
c        skyrad = ...
c
c---- End user code -----------------------------------------------------   
c
      return
      end
