!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    SUBROUTINE READ_RESTRT2
!     ******************************************************************
!$$$  SUBPROGRAM DOCUMENTATION BLOCK
!                .      .    .

! SUBPROGRAM:    READ_RESTRT2 READ MULTIPLE SMALL RESTRT FILES
!   PRGRMMR: BLACK           ORG: W/NP2      DATE: 99-09-01

! ABSTRACT:
!     READ_RESTRT2 READS IN QUANTITIES FROM THE SMALL RESTRT FILES
!     WHICH WERE PREVIOUSLY WRITTEN BY INDIVIDUAL NODES

! PROGRAM HISTORY LOG:
!   99-09-01  BLACK      - REWRITTEN ROM READ_RESTRT

! USAGE: CALL READ_RESTRT2 FROM SUBROUTINE INIT
!   INPUT ARGUMENT LIST:
!     NONE

!   OUTPUT ARGUMENT LIST:
!     NONE

!   OUTPUT FILES:
!     NONE

!   SUBPROGRAMS CALLED: NONE

!     LIBRARY: NONE

!   COMMON BLOCKS: CTLBLK
!                  LOOPS
!                  MASKS
!                  DYNAM
!                  PHYS2
!                  MAPOT1
!                  VRBLS
!                  CONTIN
!                  PVRBLS
!                  BOCO
!                  ACMCLH
!                  ACMCLD
!                  ACMPRE
!                  ACMRDL
!                  ACMRDS
!                  ACMSFC
!                  CLDWTR
!                  CNVCLD
!                  SOIL
!                  INDX
!                  OUTFIL

!   ATTRIBUTES:
!     LANGUAGE: FORTRAN 90
!     MACHINE : IBM SP
!$$$
!-----------------------------------------------------------------------
!     INCLUDE/SET PARAMETERS.
!-----------------------------------------------------------------------
    INCLUDE "parmeta.f90"
    INCLUDE "parm.tbl.f90"
    INCLUDE "parmsoil.f90"
!-----------------------------------------------------------------------
    PARAMETER &
    (IMJM=IM*JM-JM/2,JMP1=JM+1,JAM=6+2*(JM-10),LB=2*IM+JM-3 &
    , LM1=LM-1,LP1=LM+1,IMT=2*IM-1)

!-----------------------------------------------------------------------

!                            DECLARE VARIABLES

!-----------------------------------------------------------------------
    LOGICAL :: RUN,RUNB,FIRST,RESTRT,SIGMA
!-----------------------------------------------------------------------
    CHARACTER &
    RESTHR*4,LABEL*32
    CHARACTER (40) :: &
    CONTRL,FILALL,FILMST,FILTMP,FILTKE,FILUNV &
    ,FILCLD,FILRAD,FILSFC
!-----------------------------------------------------------------------
    REAL :: &
    PSLP(IDIM1:IDIM2,JDIM1:JDIM2)
    REAL :: &
    TEMPSOIL(IM,JM,NSOIL)
!-----------------------------------------------------------------------
    INTEGER :: &
    IDATB(3)
!-----------------------------------------------------------------------

!     INCLUDE COMMON BLOCKS.

    INCLUDE "COMM_CTLBLK.f90"
    INCLUDE "COMM_LOOPS.f90"
    INCLUDE "COMM_MASKS.f90"
    INCLUDE "COMM_DYNAM.f90"
    INCLUDE "COMM_PHYS2.f90"
    INCLUDE "COMM_MAPOT1.f90"
    INCLUDE "COMM_VRBLS.f90"
    INCLUDE "COMM_CONTIN.f90"
    INCLUDE "COMM_PVRBLS.f90"
    INCLUDE "COMM_BOCO.f90"
    INCLUDE "COMM_ACMCLH.f90"
    INCLUDE "COMM_ACMCLD.f90"
    INCLUDE "COMM_ACMPRE.f90"
    INCLUDE "COMM_ACMRDL.f90"
    INCLUDE "COMM_ACMRDS.f90"
    INCLUDE "COMM_ACMSFC.f90"
    INCLUDE "COMM_PRFHLD.f90"
    INCLUDE "COMM_CLDWTR.f90"
    INCLUDE "COMM_CNVCLD.f90"
    INCLUDE "COMM_SOIL.f90"
    INCLUDE "COMM_INDX.f90"
    INCLUDE "COMM_OUTFIL.f90"
!-----------------------------------------------------------------------
    INCLUDE "mpif.h"
    INCLUDE "mpp.h"
#include "sp.h"
!-----------------------------------------------------------------------
    INTEGER :: ISTAT(MPI_STATUS_SIZE)

#ifdef DP_REAL
    LOGICAL*8 RUNX,FIRSTX
    INTEGER*8 :: IDATX(3),IHRSTX,NTSDX
    INTEGER*8 :: IOUTX,NSHDEX
    INTEGER*8 :: ITEMPX(IM,JM),ITEMP2X(IM,JM)
#endif

!***********************************************************************
!***********************************************************************

!     READ INITIAL CONDITIONS FROM RESTART FILES.

!-------------------------------------------------------------------
    IF(MYPE == 0)WRITE(LIST,*)'INIT:  READ RESTART FILES'
!***
!***  CREATE NAME FOR RESTART FILE
!***
! ccc ITAG=NTSD/TSPH+0.5
    TSTART=NINT(NSTART*DT/3600.)

! no longer hardwired

    IF(NSTART == 0) THEN
        ITAG=3
    ELSE
        ITAG=TSTART
    ENDIF

    if(mype == 0) write(6,*)'itag in read_restrt2 ',itag,tstart,dt, &
    nstart,ntsd

! no longer hardwired

    CALL GETENV("tmmarkb",RESTHR)

    IF(RESTHR == '    ')THEN
        WRITE(RSTFIL,50)ITAG,MYPE
        50 FORMAT('restrt',I2.2,'.',I3.3)
    ELSE
        WRITE(RSTFIL,55)ITAG,MYPE,RESTHR
        55 FORMAT('restrt',I2.2,'.',I3.3,'.',a4)
    ENDIF
!***
!***  OPEN UNIT TO RESTART FILE.
!***
    LRSTRT=8

    CLOSE(LRSTRT)
    OPEN(UNIT=LRSTRT,FILE=RSTFIL,FORM='UNFORMATTED',IOSTAT=IER)
    IF(IER /= 0)WRITE(LIST,*)' LRSTRT OPEN UNIT ERROR IER=',IER
!-------------------------------------------------------------------

#ifdef DP_REAL
    READ(LRSTRT)RUNX,IDATX,IHRSTX,NTSDX,LABEL
    RUN=RUNX
    IDAT=IDATX
    IHRST=IHRSTX
    NTSD=NTSDX
#else
    READ(LRSTRT)RUN,IDAT,IHRST,NTSD,LABEL
#endif
    NTSD=MAX(NTSD-1,0)
    READ(LRSTRT)PDOMG,RESOMG

!-------------------------------------------------------------------
    DO L=1,LM
        READ(LRSTRT)((OMGALF(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
    ENDDO
!-------------------------------------------------------------------
#ifdef DP_REAL
    READ(LRSTRT)RUNX,IDATX,IHRSTX,NTSDX,LABEL,FIRSTX,IOUTX,NSHDEX
    RUN=RUNX
    IDAT=IDATX
    IHRST=IHRSTX
    NTSD=NTSDX
    FIRST=FIRSTX
    IOUT=IOUTX
    NSHDE=NSHDEX
#else
    READ(LRSTRT)RUN,IDAT,IHRST,NTSD,LABEL,FIRST,IOUT,NSHDE
#endif

    NTSD=MAX(NTSD-1,0)
    FIRST= .TRUE. 
!-------------------------------------------------------------------
    READ(LRSTRT)((PD(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((RES(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((FIS(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
    READ(LRSTRT)
!-------------------------------------------------------------------
!***
!***  PRIMARY 3-D VARIABLES
!***
    DO L=1,LM
        READ(LRSTRT)((T(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((Q(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((U(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((V(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((Q2(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)
        READ(LRSTRT)((CWM(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((TRAIN(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((TCUCN(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
    ENDDO
!-------------------------------------------------------------------
#ifdef DP_REAL
    READ(LRSTRT)RUNX,IDATX,IHRSTX,NTSDX,LABEL &
    ,         ((RSWIN(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((RSWOUT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((TG(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((Z0(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((AKMS(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((CZEN(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
    RUN=RUNX
    IDAT=IDATX
    IHRST=IHRSTX
    NTSD=NTSDX
#else
    READ(LRSTRT)RUN,IDAT,IHRST,NTSD,LABEL &
    ,         ((RSWIN(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((RSWOUT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((TG(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((Z0(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((AKMS(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((CZEN(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
#endif
    NTSD=MAX(NTSD-1,0)

!-------------------------------------------------------------------
    READ(LRSTRT)((AKHS(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((THS(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((QS(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((TWBS(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((QWBS(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((HBOT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((CFRACL(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((THZ0(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((QZ0(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((UZ0(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((VZ0(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((USTAR(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((HTOP(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((CFRACM(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((SNO(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SI(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((CLDEFI(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((RF(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((PSLP(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((CUPPT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((CFRACH(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((SOILTB(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SFCEXC(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SMSTAV(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SMSTOT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((GRNFLX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((PCTSNO(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((RLWIN(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((RADOT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((CZMEAN(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SIGT4(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((U00(I,J),I=MYIS,MYIE),J=MYJS,MYJE)     & ! Not used in new g/s scheme
    ,             UL                                     & ! Not used in new g/s scheme
    ,           ((LC(I,J),I=MYIS,MYIE),J=MYJS,MYJE)      & ! Not used in new g/s scheme
    ,           ((SR(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
#ifdef DP_REAL
    READ(LRSTRT)RUNX,IDATX,IHRSTX,NTSDX,LABEL &
    ,         ((PREC(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((ACPREC(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((ACCLIQ(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((CUPREC(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
    RUN=RUNX
    IDAT=IDATX
    IHRST=IHRSTX
    NTSD=NTSDX
#else
    READ(LRSTRT)RUN,IDAT,IHRST,NTSD,LABEL &
    ,         ((PREC(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((ACPREC(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((ACCLIQ(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,         ((CUPREC(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
#endif
    NTSD=MAX(NTSD-1,0)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((ACFRCV(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((NCFRCV(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((ACFRST(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((NCFRST(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((ACSNOW(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((ACSNOM(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SSROFF(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((BGROFF(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((SFCSHX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SFCLHX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SUBSHX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SNOPCX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SFCUVX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((SFCEVP(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((POTEVP(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((ASWIN(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((ASWOUT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((ASWTOA(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((ALWIN(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((ALWOUT(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((ALWTOA(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)ARDSW,ARDLW,ASRFC,AVRAIN,AVCNVC
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((TH10(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((Q10(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((U10(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((V10(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((TSHLTR(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((QSHLTR(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((PSHLTR(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &

! SM v100m
    ,           ((TH100(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((Q100(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((U100(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
    ,           ((V100(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
! SM v100m

!-------------------------------------------------------------------
!***
    READ(LRSTRT)(((SMC(I,J,N),I=MYIS,MYIE),J=MYJS,MYJE),N=1,NSOIL)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)((CMC(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)(((STC(I,J,N),I=MYIS,MYIE),J=MYJS,MYJE),N=1,NSOIL)
!-------------------------------------------------------------------
!***
    READ(LRSTRT)(((SH2O(I,J,N),I=MYIS,MYIE),J=MYJS,MYJE),N=1,NSOIL)
!-----------------------------------------------------------------------
!***
    READ(LRSTRT)((ALBEDO(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
!-------------------------------------------------------------------
!***
!***  IF FORECAST IS NOT BEGINNING AT TIME 0
!***  THEN WE MUST READ ADDITIONAL INFORMATION
!***
    IF(NINT(TSTART) /= 0)THEN
        READ(LRSTRT)((POTFLX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
        ,             (( TLMIN(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
        ,             (( TLMAX(I,J),I=MYIS,MYIE),J=MYJS,MYJE) &
        ,              ACUTIM,ARATIM,APHTIM
    
        DO L=1,LM
            READ(LRSTRT)((RSWTT(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
            READ(LRSTRT)((RLWTT(I,J,L),I=MYIS,MYIE),J=MYJS,MYJE)
        ENDDO
        READ(LRSTRT)((CNVBOT(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((CNVTOP(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((RSWTOA(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
        READ(LRSTRT)((RLWTOA(I,J),I=MYIS,MYIE),J=MYJS,MYJE)
    ENDIF
!-------------------------------------------------------------------
!***  CALL RADIATION TO OBTAIN THE SHORT AND LONGWAVE
!***  TEMPERATURE TENDENCIES

!     CALL RADTN

!     DONE READING RESTART FILES.

!     END OF SUBROUTINE READ_RESTRT2

    IF(MYPE == 0)THEN
        WRITE(LIST,*)'INIT:  EXIT READ_RESTRT2'
        WRITE(LIST,*)' '
    ENDIF

    RETURN
    END SUBROUTINE READ_RESTRT2
