*"表題 第２次元の平均を引く GTOOL3(GPYEDY)
*
*"履歴 90/09/06 沼口  敦
*
*
*********************************************************************
*"         << 第２次元の平均を引く >>
*********************************************************************
      SUBROUTINE GPYEDY
     I         ( HHEAD , GDATA ,
     I           HEDIT , HETTL ,
     O           HHEADO, GDATAO )
*
      CHARACTER  HHEAD  ( * )*(*)        !" ヘッダー(入力)
      REAL       GDATA  ( * )            !" データ(入力)
      CHARACTER  HEDIT       *(*)        !" 編集略記号
      CHARACTER  HETTL       *(*)        !" 編集タイトル
      CHARACTER  HHEADO ( * )*(*)        !" ヘッダー(出力)
      REAL       GDATAO ( * )            !" データ(出力)
*
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                !" NCC, NDC
#else
#include         "gzsize.F"              !" NCC, NDC
#endif
      CHARACTER  HAXIS         *(NCC)
      CHARACTER  HETTLD        *(NCC)
*
#ifdef SYS_IBMS
      INCLUDE   (GZIWRK)                     !" NW: 軸ワークの大きさ
#else
#include        "gziwrk.F"                   !" NW: 軸ワークの大きさ
#endif
      CHARACTER  HHEADY ( NDC )*(NCC)
      REAL       AWGTY  ( NW )
      REAL       WW     ( NW )
      LOGICAL    OSUBCK
*
*"         < 1. 大きさの取得 >
*
      CALL GUSMIS ( HHEAD )
*
      CALL GUQSIZ
     I         ( HHEAD ,
     O           IXSTR , IXEND , IXDIM ,
     O           IYSTR , IYEND , IYDIM ,
     O           IZSTR , IZEND , IZDIM  )
*
      CALL GUSZCK ( HHEADO, IXDIM*IZDIM )
*
*"         < 2. Δｙの取得 >
*
      CALL GTPGET ( 'SUBCHK', OSUBCK )
      CALL GTSIZE ( HHEADY  ,  NW     )
      CALL GHPSET ( HHEADY, 'SIZE', NW    )
      CALL GUQAXV
     I            ( HHEAD , 2     , 'WGT'  ,
     O              HHEADY, AWGTY , IEOD     )
      CALL GTPSET ( 'SUBCHK', OSUBCK )
*
*"         < 3. データ平均( 重みつき ) >
*
      CALL GUSZCZ ( NW    , IXDIM  )
*
      DO 3100 IZ = 1, IZDIM
*
         CALL GUVINT( GDATAO( IXDIM*(IZ-1)+1 ), WW, IXDIM )
         DO 3110 IY = 1, IYDIM
            CALL GUVDIN( GDATAO( IXDIM*(IZ-1)+1 ), WW, IXDIM, 1 ,
     &                   GDATA ( IXDIM*(IY-1)+IXDIM*IYDIM*(IZ-1)+1 ),
     &                   AWGTY ( IY )                                 )
 3110    CONTINUE
         CALL GUVOUT( GDATAO( IXDIM*(IZ-1)+1 ), WW, IXDIM )
*
         CALL VRSET0( GDATAO( IXDIM*(IZ-1)+1 ), WW, IXDIM, 1, 1 )
         DO 3120 IY = 1, IYDIM
            CALL VRSUB ( GDATA ( IXDIM*(IY-1)+IXDIM*IYDIM*(IZ-1)+1 ),
     &                   WW,
     &                   GDATAO( IXDIM*(IY-1)+IXDIM*IYDIM*(IZ-1)+1 ),
     &                   IXDIM, 1, 1, 1                              )
 3120    CONTINUE
*
 3100 CONTINUE
*
*"         < 4. ヘッダー変更 >
*
      CALL GHCOPY ( HHEAD, HHEADO )
*
      IF ( IYSTR .EQ. IYEND )                  RETURN
*
      IF      ( HEDIT .EQ. ' ' ) THEN
         CALL GHCGET( HHEAD, 'AITM2', HAXIS )
         NH = LENC( HAXIS )
         HETTLD = HAXIS(1:NH)//'-eddy'
         CALL GHEADD ( HHEADO, 'YE' , HETTLD )
*
      ELSE IF ( HEDIT .NE. 'NUL' ) THEN
         CALL GHEADD ( HHEADO, HEDIT, HETTL  )
      ENDIF
*
      RETURN
      END
*********************************************************************
*"         << 第２次元の平均を引く >>
*********************************************************************
      SUBROUTINE GMYEDY
     M         ( HHEAD , GDATA ,
     I           HEDIT , HETTL  )
*
      CHARACTER  HHEAD  ( * )*(*)        !" ヘッダー(入力)
      REAL       GDATA  ( * )            !" データ(入力)
      CHARACTER  HEDIT       *(*)        !" 編集略記号
      CHARACTER  HETTL       *(*)        !" 編集タイトル
*
      COMMON     /GMWORK/ GDATAW
      REAL       GDATAW ( 1 )            !" データ(ワーク)
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                !" NCC, NDC
#else
#include         "gzsize.F"              !" NCC, NDC
#endif
      CHARACTER  HHEADW ( NDC )*(NCC)    !" ヘッダー(ワーク)
*
      CALL       GMCSIZ ( HHEADW )
      CALL       GPYEDY
     I         ( HHEAD , GDATA ,
     I           HEDIT , HETTL ,
     O           HHEADW, GDATAW  )
*
      CALL       GPFSET
     I         ( HHEADW, GDATAW,
     I           ' '   , ' '   ,
     O           HHEAD , GDATA   )
*
      RETURN
      END
