      SUBROUTINE GTPRED(ID1,ITAU,FD,JJ,II,TEMP,NWHERE,CORE,ICND,*)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK                                    
C                                                                       
C SUBPROGRAM:    GTPRED      GETS PREDICTORS FOR REGRESSION EQNS.       
C   PRGMMR: DALLAVALLE       ORG: W/OSD211     DATE: 89-04-07           
C                                                                       
C ABSTRACT: OBTAINS PREDICTORS FROM THE MOSMAT (OBSERVATIONS),          
C   MOSCONST, OR NMC MODEL FILES.                                       
C                                                                       
C PROGRAM HISTORY LOG:                                                  
C   77-05-01  H.R.GLAHN                                                 
C   89-04-07  DALLAVALLE-ADDED DOCUMENTATION BLOCK                      
C   90-10-18  JENSENIUS   CHANGED TO READ VSAM MOSMAT FILE.  CALLS      
C                         TO SUBROUTINE MOSCST WERE CHANGED TO RDMOSV.  
C   91-09-17  GILBERT     FORTRAN 77.                                   
C   98-07-28  ERICKSON   CHANGE LINE 110 TO USE ID1 NOT ID(1)
C                        DETERMINED THAT NWHERE =1 IS NOT USED
C                        OBSPRED IS USED TO GET OBS PREDICTORS
C                        
C USAGE:                                                                
C                                                                       
C   SEE BELOW FOR MDL STANDARDS                                         
C                                                                       
C     PROGRAM GTPRED                                                    
C                                                                       
C        MAY 1977   H.R.GLAHN   MDL   NAS9000                           
C                                                                       
C        PURPOSE                                                        
C            PREDICTORS FROM MOSMAT (OBSERVATIONS), MOSCONST, OR NMC    
C            MODEL FILES ARE RETURND.                                   
C                                                                       
C        DATA SET USE                                                   
C            NONE                                                       
C                                                                       
C        VARIABLES                                                      
C          ID( ) = 2-WORD MDL ID ACCOMODATED. HOWEVER, 2ND WORD IS USED 
C                  ONLY WITH MOSRD (NWHERE=2) AND MAY BE TRASH WHEN     
C                  RDMOSV OR RDMODL IS TO BE CALLED (NWHERE=1 OR 3).    
C           ITAU = TAU CORRESPONDING TO ID( ).                          
C      FD(JJ,II) = ARRAY TO PUT DATA INTO FOR RETURN (NOT NECESSARY     
C                  TO DIMENSION).                                       
C         NWHERE = 1 IF PREDICTOR FROM MOSMAT.                          
C                = 2 IF PREDICTOR FROM MOSCONST.                        
C                = 3 IF PREDICTOR FROM NMC GRID FIELDS.                 
C           ICND = RETURNED AS ZERO FOR A GOOD FETCH.                   
C              * = ERROR RETURN TO STATEMENT NUMBER.                    
C         NCYCLE = CYCLE, 00 OR 12.                                     
C          MODP1 = MODEL NUMBER PLUS 1, 1 THROUGH 5                     
C         NID( ) = 25-WORD NMC ID.  
C                                                                       
C        COMMON BLOCKS                                                  
C              MODP1C =                                                 
C              M90201 =                                                 
C                                                                       
C        SUBPROGRAMS CALLED:                                            
C            UNIQUE:  HEXID, MOSRD, RDMODL                              
C            LIBRARY:                                                   
C              W4LIB:  RDMOSV                                           
C                                                                       
C ATTRIBUTES:                                                           
C   LANGUAGE: VS FORTRAN                                                
C   MACHINE:  NAS9000                                                   
C$$$                                                                    
      DIMENSION ID(2),NID(25),FD(1),TEMP(1),CORE(1)
      COMMON/M90201/JDATE,NCYCLE,MODP1,IG,JUNPK(8,4,7)
      COMMON/MODP1C/MODP1C
      DATA KDEW/X'0000000000000021'/,MASK/X'0000000000000FFF'/
      ICND=0
      GO TO(110,140,150),NWHERE
C        PREDICTOR ON MOSMAT.                                           
 110  KTYP=ISHFT(ISHFT(ID1,52),-52)
      IF(KTYP.GT.0.AND.KTYP.LT.34) GO TO 120
      ICND=1
C        IMPROPER TYPE NUMBER.                                          
      GO TO 160
 120  CALL RDMOSV(900,ITAU,NCYCLE,FD,X,KTYP,X,ICND)
C        OBS FROM MOSMAT ARE RETURNED IN SAME ORDER AS THE STATION      
C        LIST ON MOSMAT AND MOSCONST.                                   
      GO TO 160
  140 ID(1)=ID1
      ID(2)=MODP1C-1
      CALL MOSRD(ID(1),ID(2),ITAU,TEMP,ICND)
      IF(ICND.NE.0)GO TO 161
      GO TO 160
 150  CALL HEXID(ID1,ITAU,NID,ICND)
C     WRITE(6,1)ICND,ID1                                                
C 1   FORMAT(' ICND IN GTPRED FROM HEXID = ',I4,5X,'ID1= ',Z8)          
      IF(ICND.EQ.0)GO TO 155
      IDTYPE=IAND(ID1,MASK)
C     IF((IDTYPE.NE.KDEW).OR.(MODP1.NE.7))GO TO 161                     
      IF(IDTYPE.NE.KDEW)GO TO 161
      CALL COMPDP(ID1,ITAU,FD,JJ,II,X,X,ICND,*161)
      GO TO 160
 155  CALL RDMODL(ID1,ITAU,NID,FD,JJ,II,ICND)
C     WRITE(6,2)ICND,NID                                                
C  2  FORMAT(' ICND IN GTPRED FROM RDMODL= ',I4,/' NID ',6Z10)          
 160  IF(ICND.EQ.0)RETURN
 161  RETURN 1
C        ERROR RETURN TO STATEMENT NUMBER.                              
      END
