C**********************************************************                  SETTEE.2     
C             SUBROUTINE SETTEE                                              SETTEE.3     
C**********************************************************                  SETTEE.4     
      SUBROUTINE SETTEE                                                      SETTEE.5     
C                                                                            SETTEE.6     
C     Subroutine to give annual cycle of TRES if wanted                      SETTEE.7     
C                                                                            SETTEE.8     
C                                                                            PARAM1.2     
C     Determines model resolution                                            PARAM1.3     
C                                                                            PARAM1.4     
      PARAMETER(NN=21,MM=21,NHEM=2,NL=5,MOCT=1,MG=64,JG=16,NWJ2=121          NETCDF.35    
     P         ,NCRAY=64,JGL=JG,NTRAC=1,NLEVRF=1)                            NETCDF.36    
                                                                             PARAM1.7     
C                                                                            PARAM1.8     
C                                                                            PARAM2.2     
C     Sets basic constants, especially those needed for array dimensions     PARAM2.3     
C                                                                            PARAM2.4     
      PARAMETER(MH=2,PI=3.14159265359,PI2=2.0*PI                             PARAM2.5     
     +,NNP=NN+1,MGPP=MG+2,JGP=JG+1,JGG=JG*NHEM,JGGP=JGG+1,MJP=NWJ2+NWJ2      PARAM2.6     
     +,NLM=NL-1,NLP=NL+1,NLPP=NL+2,NLA=NL+3,NLB=NL+4,NL2=NL*NL               PARAM2.7     
     +,IDA=(MG+MG+MG)/2+1,IDB=NWJ2*NL,IDC=IDB+IDB,IDD=MGPP*NL                PARAM2.8     
     +,IDE=NL2*NN,IDF=NCRAY*(MG+1),IDG=JG*NL,IDH=JG*MG                       PARAM2.9     
     +,IDI=NNP/2,IDJ=IDI*IDI,IDK=NL*IDI,IDL=MGPP/2,IDM=NNP/2,IDN=IDM*NL      PARAM2.10    
     +,NWW=1+(MM-1)/MOCT)                                                    PARAM2.11    
      PARAMETER(IGA=NWJ2*NHEM,IGB=IDB*NHEM,IGC=MGPP*NHEM,IGD=IDD*NHEM        PARAM2.12    
     +,IGG=IDG*NHEM,IGL=IDL*NHEM,IGM=IDM*NHEM,IGN=IDN*NHEM                   PARAM2.13    
     +,IGO=IGA+IGA,IGP=IGB+IGB,NFTWG=(5+NTRAC)*NL+3                          PARAM2.14    
     +,NFTGW=(6+3*NTRAC)*NL+2,NFTGD=(3+NTRAC)*NL,NLTR=NL*NTRAC)              PARAM2.15    
C     Number of 2D (surface) output fields. This value is                    PARAM2.16    
C     Doubled due to averaged and instantaneous fields.                      PARAM2.17    
      PARAMETER (N2DFLD=21,NGRPAD=N2DFLD*2*IGC)                              PARAM2.18    
C                                                                            PARAM2.19    
C                                                                            OUTCON.2     
C     Switches counters and constants controlling type and frequency of      OUTCON.3     
C     model output                                                           OUTCON.4     
C                                                                            OUTCON.5     
      COMMON/OUTCON/RNTAPE,NCOEFF,NLAT,INLAT,INSPC                           OUTCON.6     
     +              ,RNTAPO                                                  OUTCON.7     
     +              ,KOUNTP,KOUNTE,KOUNTH,KOUNTR                             OUTCON.8     
     +              ,KOUTP,KOUTE,KOUTH,KOUTR,DAY                             OUTCON.9     
     +              ,SQR2,RSQR2,EAM1,EAM2,TOUT1,TOUT2,RMG                    OUTCON.10    
     +              ,LSPO(NL),LGPO(NL)                                       OUTCON.11    
     $              ,LSHIST,LMINIH                                           OUTCON.12    
      LOGICAL LSHIST,LMINIH                                                  OUTCON.13    
      LOGICAL LSPO,LGPO                                                      OUTCON.14    
C                                                                            OUTCON.15    
C                                                                            RESTIJ.2     
C     Restoration temperature field and constants which determine it,        RESTIJ.3     
C     also contains timescales                                               RESTIJ.4     
C                                                                            RESTIJ.5     
      COMMON/RESTIJ/TTRES(IGB)                                               RESTIJ.6     
     + ,DTNS,DTEP,DTTRP,FAC(NL),DDAMP(NL),TFRC(NL),YRLEN,TRS(NL)             RESTIJ.7     
     +  ,ALR,ZTROP,TGR                                                       RESTIJ.8     
      COMPLEX TTRES                                                          RESTIJ.9     
C                                                                            SETTEE.13    
C     If YRLEN is zero then no seasonal cycle.                               SETTEE.14    
C                                                                            SETTEE.15    
      IF (NINT(YRLEN) .EQ. 0) THEN                                           SETTEE.16    
         YPHS = (1./SQRT(6.))                                                SETTEE.17    
      ELSE                                                                   SETTEE.18    
         YPHS=(1./SQRT(6.))*SIN(PI2*DAY/YRLEN)                               SETTEE.19    
      ENDIF                                                                  SETTEE.20    
      IADB=NWJ2+1                                                            SETTEE.21    
      DO 10 L=1,NL                                                           SETTEE.22    
        IAD=IADB+(L-1)*IGA                                                   SETTEE.23    
        TTRES(IAD)=FAC(L)*DTNS*YPHS                                          SETTEE.24    
10    CONTINUE                                                               SETTEE.25    
      RETURN                                                                 SETTEE.26    
      END                                                                    SETTEE.27    
