* PACKAGE IMONI  
*
*"  [HIS]  90/11/02(numaguti)
*******************************************************************
      SUBROUTINE  HMONIT          
     I          ( HHEAD , GDATA ,
     I            IT    , IDATE , ISTEP , ITDUR  )
*





* PACKAGE  ZXT10L32 !" 格子点数，波数 X-Z
*
      INTEGER     IMAX           !" 経度格子数
      INTEGER     JMAX           !" 緯度格子数
      INTEGER     IDIM           !" 経度配列サイズ
      INTEGER     JDIM           !" 緯度配列サイズ
      INTEGER     MMAX           !" 最大東西波数
      INTEGER     LMAX           !" 最大南北波数
      INTEGER     NMAX           !" 最大全波数
      INTEGER     MINT           !" 東西波数間隔
      INTEGER     KMAX           !" 鉛直層数
      INTEGER     KDIM           !" 鉛直配列サイズ
      INTEGER     NMDIM          !" 水平波数成分数
      INTEGER     JMXHF          !" JMAX/2+1
      INTEGER     NWORK          !" ワーク領域大きさ
*
      PARAMETER ( IMAX  = 32,     JMAX =  1,
     &            IDIM  = IMAX+1, JDIM = JMAX,
     &            MMAX  = 10,     LMAX =  0,    NMAX = MMAX, MINT = 1,
     &            KMAX  = 32,     KDIM = KMAX,
     &            NMDIM = (MMAX/MINT+1)*(2*(NMAX+1)-MMAX)
     &                  - (NMAX-LMAX)/MINT*(NMAX-LMAX+1),
     &            JMXHF = JMAX/2+1,
     &            NWORK = IDIM*JDIM*KMAX*12                       )

* PACKAGE ZHDIM  !" 文字列文字数 
*
*"  [HIS]  90/08/31(numaguti)
*
      INTEGER     NCC
      INTEGER     NDC
      INTEGER     NFILN
*
      PARAMETER ( NCC   = 16, NDC   = 64 ,
     &            NFILN = 38              )

*
*   [INPUT]       
      CHARACTER  HHEAD ( * ) *(*)
      ReaL*8       GDATA ( * )
      INTEGER    IT
      INTEGER    IDATE ( 6 )
      INTEGER    ISTEP
      INTEGER    ITDUR
*
*   [INTERNAL SAVE]
      INTEGER    ITOLD
      DATA       ITOLD / -1 /
*
*   [INTERNAL PARM] 
      INTEGER    IWDFL
      DATA       IWDFL / 21 /
      INTEGER    KMAXP1
      PARAMETER  ( KMAXP1=KMAX+1 )
      INTEGER    ISTR , IEND, IINT
      INTEGER    JSTR , JEND, JINT
      INTEGER    KSTR , KEND, KINT
      DATA       ISTR , IEND, IINT / 1, IMAX, 10 /
      DATA       JSTR , JEND, JINT / 1, JMAX, 10 /
      DATA       KSTR , KEND, KINT / 1, KMAXP1,1 /
      CHARACTER  FILE  *(NFILN)
      DATA       FILE  / 'CON' /
      INTEGER    NCOLS
      DATA       NCOLS / 133 /
*
      NAMELIST  /NMMONI/
     &           ISTR , IEND, IINT,
     &           JSTR , JEND, JINT,
     &           KSTR , KEND, KINT,
     &           FILE , NCOLS
*
      LOGICAL    OFIRST
      DATA       OFIRST / .TRUE. /
      SAVE
*
*   [INTERNAL WORK] 
      CHARACTER  HITEM *(NCC)
      CHARACTER  HAVRG *(NCC)
      CHARACTER  HDFMT *(NCC)
      CHARACTER  HNUM  *30
      INTEGER    IFPAR, JFPAR, JFM, IERR
      INTEGER    IXEND, IYEND, K
*
*   [ONCE] 
      IF ( OFIRST ) THEN
         OFIRST = .FALSE.
         CALL   REWNML ( IFPAR , JFPAR )
         READ   ( IFPAR, NMMONI, END=190 )
  190    WRITE  ( JFPAR, NMMONI )
*
         CALL IFLOPN
     O         ( JFM   , IERR  ,
     I           FILE  , IWDFL , 'WRITE', 'FORMATTED'  )
      ENDIF
*
*"         < 1. 時刻を印刷 >
*
      IF ( IT .NE. ITOLD ) THEN
         WRITE ( JFM, * ) '******************[ TIME = ', IT,
     &                    ']******************'
         ITOLD = IT
      ENDIF
*
*"         < 2. データを印刷 >
*
      CALL GHCGET ( HHEAD, 'ITEM' , HITEM )
      CALL GHCGET ( HHEAD, 'EDIT1', HAVRG )
      CALL GHPGET ( HHEAD, 'AEND1', IXEND )
      CALL GHPGET ( HHEAD, 'AEND2', IYEND )
      CALL GHCGET ( HHEAD, 'DFMT' , HDFMT )
*
      IF      ( HAVRG .EQ. 'X-AVG' ) THEN
*
         WRITE ( JFM, * ) '============< ', HITEM, HAVRG,
     &                    '>============='
         DO 1100 K = MIN(KSTR,IYEND), MIN(KEND,IYEND), KINT
            CALL PRINTD
     I         ( JFM  , HDFMT , GDATA  ,
     I           JSTR , MIN(JEND,IXEND), JINT  , K    ,
     I           IXEND, IYEND , NCOLS                  )
 1100    CONTINUE
*
      ELSE IF ( HAVRG .EQ. 'XZ-AVG' ) THEN
*
        WRITE ( JFM, * ) '============< ', HITEM, HAVRG,
     &                    '>============='
         CALL PRINTD
     I         ( JFM  , HDFMT , GDATA ,
     I           JSTR , MIN(JEND,IXEND), JINT  , 1    ,
     I           IXEND, IYEND , NCOLS                   )
*
      ELSE IF ( HAVRG .EQ. 'XYZ-AVG' ) THEN
*
         WRITE ( HNUM , HDFMT ) GDATA(1)
         WRITE ( JFM  , '(1X,A16,4X,A)' ) HITEM, HNUM
*
      ENDIF
*
      RETURN
      END
