* PACKAGE XMKAXIS   !" GTOOL3 軸ファイルの作成(球面非発散順圧・浅水モデル用)
*
*" [HIS]  96/11/15 (takepiro)
*******************************************************************
      PROGRAM MKAXIS  !" GTOOL3 軸ファイルの作成
*
*   [PARAM] 
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                      !" 格子点数, 波数
      INCLUDE   (GZSIZE)
#else
#include        "zcdim.F"                    !" 格子点数, 波数
#include        "gzsize.F"
#endif
*
*   [VAR]
      CHARACTER  HHLON ( NDC )*(NCC)
      REAL       ALON  ( IMAX+1 )
      CHARACTER  HHDLON( NDC )*(NCC)
      REAL       DLON  ( IMAX+1 )
      CHARACTER  HHLAT ( NDC )*(NCC)
      REAL       ALAT  ( JMAX )
      CHARACTER  HHDLAT( NDC )*(NCC)
      REAL       DLAT  ( JMAX )
*
      CHARACTER  HALON        *(NCC)
      CHARACTER  HALAT        *(NCC)
      CHARACTER  HASIG        *(NCC)
      CHARACTER  HALOC        *(NFILN)
      CHARACTER  HAWGT        *(NFILN)
*
      CHARACTER  HFLON  *(NFILN)
      CHARACTER  HFDLON *(NFILN)
      CHARACTER  HFLAT  *(NFILN)
      CHARACTER  HFDLAT *(NFILN)
*
*   [INTERNAL PARM] 
      INTEGER    JFILE
      DATA       JFILE / 50 /
      INTEGER    IT
      INTEGER    IDATE ( 6 )
      INTEGER    ISTEP
      INTEGER    ITDUR
      DATA       IT    / 0 /
      DATA       IDATE / 1990, 1, 1, 0, 0, 0 /
      DATA       ISTEP / 0 /
      DATA       ITDUR / 1 /
      CHARACTER  HDFMT *(NCC)
      DATA       HDFMT / 'UR4' /
*
*   [INTERNAL WORK] 
      INTEGER    NHL, NHW
      INTEGER    I, J, KLEVS
      REAL       PI, VMISS
*
*   [EXTERNAL FUNC] 
      INTEGER    LENC
*
      CALL GTOPEN
      CALL GTSIZE ( HHLON , IMAX+1 )
      CALL GTSIZE ( HHDLON, IMAX+1 )
      CALL GTSIZE ( HHLAT , JMAX   )
      CALL GTSIZE ( HHDLAT, JMAX   )
*
*"         < 1. 格子点設定 >
*
      CALL PCONST
*
      CALL ACRGET
     O         ( ALON  , DLON  ,
     O           ALAT  , DLAT   )
*
      PI = ATAN(1.) * 4.
      DO 1100 I = 1, IMAX
         ALON ( I ) = ALON( I )*180./PI
 1100 CONTINUE
      ALON ( IMAX+1 ) = 360.
      DLON ( IMAX+1 ) = DLON( 1 )
*
      DO 1200 J = 1, JMAX
         ALAT( J ) = ALAT( J )*180/PI
 1200 CONTINUE
*
*"         < 2. ファイル名 >
*
      CALL HQCORN 
     I         ( 'ASFC' ,
     O           HALON , HALAT , HASIG ,
     O           KLEVS                   )
*
      CALL GTCGET( 'FAXLOC1', HALOC )
***      CALL GTCGET( 'FAXLOC', HALOC )
      CALL GTCGET( 'FAXWGT1', HAWGT )
***      CALL GTCGET( 'FAXWGT', HAWGT )
*
      NHL = LENC( HALOC )
      NHW = LENC( HAWGT )
*
      HFLON  = HALOC(1:NHL)//HALON
      HFDLON = HAWGT(1:NHW)//HALON
      HFLAT  = HALOC(1:NHL)//HALAT
      HFDLAT = HAWGT(1:NHW)//HALAT
*
*"         < 3. ヘッダー設定 >
*
      CALL GZDBGT( 'MISS' , VMISS )
*
      CALL GZDBAP
     O         ( HHLON ,
     I           'CAXLOC', HALON ,
     I           'longitude'   , 'deg' , IMAX ,
     I           'UR4' ,  VMISS,
     I              0. ,  360. ,  10.  , 30.   , 1     )
*
      CALL GHCOPY ( HHLON , HHDLON )
      CALL GHCSET ( HHDLON, 'DSET', 'CAXWGT' )
*
      CALL GZDBAP
     O         ( HHLAT ,
     I           'AXLOC', HALAT ,
     I           'latitude'    , 'deg' , JMAX ,
     I           'UR4' ,  VMISS,
     I            -90. ,   90. ,  10.  , 30.   , 1     )
*
      CALL GHCOPY ( HHLAT , HHDLAT )
      CALL GHCSET ( HHDLAT, 'DSET', 'AXWGT' )
*
*"         < 4. ファイル書き込み >
*
      CALL GFWOPN( JFILE, HFLON  )
      CALL GZDBWX              !" 精度変換書き込み
     I         ( HHLON , ALON  ,
     I           IT    , IDATE , ISTEP , ITDUR ,
     I           JFILE , 1     , 0     , HDFMT   )
      CALL GFCLSE( JFILE )
*
      CALL GFWOPN( JFILE, HFDLON )
      CALL GZDBWX              !" 精度変換書き込み
     I         ( HHDLON, DLON  ,
     I           IT    , IDATE , ISTEP , ITDUR ,
     I           JFILE , 1     , 0     , HDFMT   )
      CALL GFCLSE( JFILE )
*
      CALL GFWOPN( JFILE, HFLAT  )
      CALL GZDBWX              !" 精度変換書き込み
     I         ( HHLAT , ALAT  ,
     I           IT    , IDATE , ISTEP , ITDUR ,
     I           JFILE , 1     , 0     , HDFMT   )
      CALL GFCLSE( JFILE )
*
      CALL GFWOPN( JFILE, HFDLAT )
      CALL GZDBWX              !" 精度変換書き込み
     I         ( HHDLAT, DLAT  ,
     I           IT    , IDATE , ISTEP , ITDUR ,
     I           JFILE , 1     , 0     , HDFMT   )
      CALL GFCLSE( JFILE )
*
      STOP
      END
