*DK HISTIN
      SUBROUTINE N2HISTIN(LEVEL)
      INCLUDE 'n1param.h'                                                   MAIN.2
      INCLUDE 'nestcnt.h'                                                   MAIN.3
      INCLUDE 'n1array.h'                                                   MAIN.5
      INCLUDE 'start.h'                                                     MAIN.6
      INCLUDE 'n2nestg.h'
      DIMENSION W2(NNX,NVR),W1(NNX,NVR),W(NNX,NVR)
      NVRK=NVR
C     ****
C     ****     SPECIFY INITIAL VALUES OF THE NESTED GRID DOMAIN BY
C     ****     LINEAR INTERPOLATION OF THE COARSE GRID VALUES
C     ****
      RATIO=DBLE(NESTRI(NLEVEL))
      DO J=1,JNX
C      ****
C      ****     FIRST LINE IN LATITUDE
C      ****
       IF(J.EQ.1)THEN
        DO I=1,INX
         II=NESTRI(NLEVEL)*(I-1)+1
         IC=NESTI1(NLEVEL)+I-1
         JJ=NESTJ1(NLEVEL)+J-1
         IF(I.LT.INX)THEN
          DO K=1,NVRK
           W2(II,K)=G(IC,K,JJ)
           DO L=1,NESTRI(NLEVEL)-1
            IL=II+L
            W2(IL,K)=G(IC,K,JJ)+DBLE(L)*(G(IC+1,K,JJ)-G(IC,K,JJ))/RATIO
           ENDDO
          ENDDO
         ELSE
          DO K=1,NVRK
           W2(II,K)=G(IC,K,JJ)
          ENDDO
         ENDIF
        ENDDO
        WRITE(NESTIN(LEVEL))((W2(I,K),I=1,NNX),K=1,NVRK)
       ELSE
C       ****
C       ****     NEXT LINE IN LATITUDE
C       ****
        J2=NESTRI(NLEVEL)*(J-1)+1
        J1=NESTRI(NLEVEL)*(J-2)+1
        JJ=NESTJ1(NLEVEL)+J-1
        DO I=1,INX
         II=NESTRI(NLEVEL)*(I-1)+1
         IC=NESTI1(NLEVEL)+I-1
         IF(I.LT.INX)THEN
          W1(II,K)=G(IC,K,JJ)
          DO L=1,NESTRI(NLEVEL)-1
           IL=II+L
           W1(IL,K)=G(IC,K,JJ)+
     1                DBLE(L)*(G(IC+1,K,JJ)-G(IC,K,JJ))/RATIO
          ENDDO
         ELSE
          W1(II,K)=G(IC,K,JJ)
         ENDIF
        ENDDO
C       ****
C       ****     CALCULATE LATITUDINAL LINES IN BETWEEN
C       ****
        DO L=1,NESTRI(NLEVEL)-1
         DO K=1,NVRK
          DO I=1,NNX
           W(I,K)=W2(I,K)+DBLE(L)*(W1(I,K)-W2(I,K))/RATIO
          ENDDO
         ENDDO
         WRITE(NESTIN(LEVEL))((W(I,K),I=1,NNX),K=1,NVRK)
        ENDDO
        WRITE(NESTIN(LEVEL))((W1(I,K),I=1,NNX),K=1,NVRK)       
       ENDIF
       DO K=1,NVRK
        DO I=1,NNX
         W2(I,K)=W1(I,K)
        ENDDO
       ENDDO       
      ENDDO
      REWIND(NESTIN(LEVEL))
      RETURN
      END
C