1subroutine grayline(nyear,month,nday,uth,mygrid,nduration,isun)
2
3  character*6 mygrid
4  real LST
5  real lat,lon
6
7  call grid2deg(MyGrid,elon,lat)
8  lon=-elon
9
10  uth0=uth-0.5*nduration/60.0
11  uth1=uth+0.5*nduration/60.0
12
13  call sun(nyear,month,nday,uth0,lon,lat,RASun,DecSun,LST,        &
14       AzSun,ElSun0,mjd,day)
15  call sun(nyear,month,nday,uth1,lon,lat,RASun,DecSun,LST,        &
16       AzSun,ElSun1,mjd,day)
17
18  elchk=-0.8333
19  isun=-1
20  if(elsun0.lt.elchk .and. elsun1.ge.elchk) then
21     isun=0
22  else if(elsun0.gt.elchk .and. elsun1.le.elchk) then
23     isun=2
24  else if(elsun1.gt.elchk) then
25     isun=1
26  else
27     isun=3
28  endif
29
30  return
31end subroutine grayline
32
33