* PACKAGE IHEAD   
*
**********************************************************************
      SUBROUTINE HSTHED       
     O         ( HHEAD , ISIZE ,
     I           HCORD , HAVTYP,
     I           HITEM , HTITL , HUNIT ,
     I           HDFMT , VMISS ,
     I           DMIN  , DMAX  , DIVS  , DIVL  , ISTYP  )
*
*   [OUTPUT] 
*     CHARACTER  HHEAD ( * )*(*)             
      INTEGER    ISIZE                       
*
*   [INPUT] 
      CHARACTER  HCORD  *(*)                 
      CHARACTER  HAVTYP *(*)                 
      CHARACTER  HITEM  *(*)                 
      CHARACTER  HTITL  *(*)                 
      CHARACTER  HUNIT  *(*)                 
      CHARACTER  HDFMT  *(*)                 
      ReaL*8       VMISS                       
      ReaL*8       DMIN                        
      ReaL*8       DMAX                        
      ReaL*8       DIVS                        
      ReaL*8       DIVL                        
      INTEGER    ISTYP                       
*
*   [INTERNAL PARM]





* 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              )

      CHARACTER  HHEAD (NDC)*(NCC)           
*   [INTERNAL WORK] 
      CHARACTER  HAITMX *(NCC)               
      CHARACTER  HAITMY *(NCC)               
      CHARACTER  HAITMZ *(NCC)               
      CHARACTER  HUTIM  *(NCC)               
      CHARACTER  HEDIT  *(NCC)               
      CHARACTER  HETTL  *(NCC)               
*
      INTEGER    IXDIM, IYDIM, IZDIM, KLEVS
      INTEGER    NAVR
*
*   [EXTERNAL FUNC]
      INTEGER    LENC
*
*"         < 1. 軸名称，大きさ >
*
      CALL HQCORN
     I     ( HCORD ,
     O       HAITMX, HAITMY, HAITMZ,
     O       KLEVS                   )
*
      IF      ( HAVTYP .EQ. 'X' ) THEN
         HAITMX = HAITMY
         HAITMY = HAITMZ
         HAITMZ = ' '
         IXDIM  = JMAX
         IYDIM  = KLEVS
         IZDIM  = 1
      ELSE IF ( HAVTYP .EQ. 'Z' ) THEN
         HAITMZ = ' '
         IXDIM  = IMAX
         IYDIM  = JMAX
         IZDIM  = 1
      ELSE IF ( HAVTYP .EQ. 'XZ' ) THEN
         HAITMX = HAITMY
         HAITMY = ' '
         HAITMZ = ' '
         IXDIM  = JMAX
         IYDIM  = 1
         IZDIM  = 1
      ELSE IF ( HAVTYP .EQ. 'XY' ) THEN
         HAITMX = HAITMZ
         HAITMY = ' '
         HAITMZ = ' '
         IXDIM  = KLEVS
         IYDIM  = 1
         IZDIM  = 1
      ELSE IF ( HAVTYP .EQ. 'XYZ' ) THEN
         HAITMX = ' '
         HAITMY = ' '
         HAITMZ = ' '
         IXDIM  = 1
         IYDIM  = 1
         IZDIM  = 1
      ELSE
         IXDIM  = IMAX
         IYDIM  = JMAX
         IZDIM  = KLEVS
      ENDIF
      ISIZE = IXDIM * IYDIM * IZDIM
*
*"         < 2. ヘッダーのパック >
*
      CALL AQUTIM ( HUTIM )
*
      CALL GZDBHP                    
     O         ( HHEAD ,
     I           ' '   , HITEM , 1     , 1     ,
     I           HTITL , HUNIT ,
     I           0     , ' '   , HUTIM , 1     ,
     I           HAITMX, 1     , IXDIM ,
     I           HAITMY, 1     , IYDIM ,
     I           HAITMZ, 1     , IZDIM ,
     I           HDFMT , VMISS ,
     I           DMIN  , DMAX  , DIVS  , DIVL  ,
     I           ISTYP ,
     I           ' '   , ' '                             )
*
      IF ( HAVTYP .NE. ' ' ) THEN
         NAVR  = LENC( HAVTYP )
         HEDIT = HAVTYP(1:NAVR)//'-AVG'
         HETTL = HAVTYP(1:NAVR)//'-average'
         CALL GHEADD ( HHEAD, HEDIT, HETTL )
      ENDIF
*
      RETURN
      END
