C---------------FSub.2
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CC                                                                            CC
CC      THE PROJECTING CORRECTION FOR VECTOR MAGNETIC FIELD IN SOLOR LIMB     CC
CC                                                                            CC
CC                               Wang Tong Jiang                              CC
CC                                                                            CC
CC                                 -----July 1,1993 (From Nanjin University)  CC
CC				------Jan 27, 1996			      CC
CC                                                                            CC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC  
	Subroutine sub_prj

	real bhx(170,128),bhy(170,128),bhz(170,128)
	real bix(170,128),biy(170,128),biz(170,128)
	real aa(3,3)
	real L,L0,B,B0,P,Lc,Bc,Ll,Bb,Ll0,Bb0
	character filx*13,fily*13,filz*13,file*13,ch,str*60,crm*4,crl*4,CHT(8)*5
	REAl cp(8),cm(8),tr(6),rdat(170,128),adat(170,128)
	REAL RBT(170,128),ABT(170,128)
	character mesg*400,key
        REAl tr(6),gyo(512,512),gyh(512,512),tmp(512,512)
	integer anw

        DATA cp/40.,160.,640.,1280.,1920.,2240.,2560.,2880./
	DATA TR/0.0,1.0,0.0,0.0,0.0,1.0/
	DATA CHT/'2880.','2560.','2240.','1920.','1280.','640.','160.','40.'/

	EXTERNAL RW_FIT !$PRAGMA C (RW_FIT)
        EXTERNAL r_map  !$PRAGMA C (r_map)
        EXTERNAL s_data !$PRAGMA C (s_data)
	EXTERNAL exel   !$PRAGMA C (exel)

	Pi=3.1415926
	XSIZE=5.23    !view field of active region(5'.23 X 3'.626)
	YSIZE=3.626
	


100	write(*,*)'OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO'
	write(*,*)'OOOO    < Menu 3 for Project Correct >                  OOOO'
	write(*,*)'OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO'
	write(*,*)'OOOO    0. goto  ---->[Main Menu]                       OOOO'
	write(*,*)'OOOO    1. read the position parameters                 OOOO'
	write(*,*)'OOOO -------------------------------------------------- OOOO'
	write(*,*)'OOOO    2. read the vector field (*.bxo,*.byo,*.bzo)    OOOO'
	write(*,*)'OOOO    3. project for vector magnetic field            OOOO'
	write(*,*)'OOOO    4. display vector field after project correct   OOOO'
	write(*,*)'OOOO    5. save the results for magnetic field          OOOO'
	write(*,*)'OOOO -------------------------------------------------- OOOO'
	write(*,*)'OOOO    6. read the mono-image (s*.dat, d*.dat)         OOOO'
	write(*,*)'OOOO    7. project for mono-image (s*.dat, d*.dat)      OOOO'
	write(*,*)'OOOO    8. display mono-image after project correct     OOOO'
	write(*,*)'OOOO    9. save the results for image                   OOOO'
	write(*,*)'OOOO -------------------------------------------------- OOOO'
	write(*,*)'OOOO    10. Quit                                        OOOO'
	write(*,*)'OOOO    11. (Help)                                      OOOO'
	write(*,*)'OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO'
	write(*,*)' '
	write(*,*)'PLEASE ENTER THE SELECTED NUMBER:[No. 0--11]'
	read(*,*)anw

	IF(ANW.EQ.0) THEN
	    RETURN
	ELSE IF(ANW.EQ.1) THEN
C-----------  Input Parameters about Project correction------
            WRITE(*,*)'--- INPUT PARAMETERS===>'
	    WRITE(*,*)'latitude and longitude of Active Region Center:'
            WRITE(*,*)'### INPUT B=? L=?(Approxiate (Bc,Lc) '
            READ(*,*)Bb,Ll
	    B=Bb*2*PI/360.
	    L=Ll*2*PI/360.
            Bc=B
            Lc=L
 
            WRITE(*,*)'latitude and longitude of solor disk center:'
            WRITE(*,*)'### INPUT B0=? L0=? '
            READ(*,*)Bb0,Ll0
	    B0=Bb0*2*PI/360.
	    L0=Ll0*2*PI/360.
 
	   WRITE(*,*)'Angle between solor rotation axis and north point of disk'
           WRITE(*,*)'### INPUT P=?'
           READ(*,*)Pp
	   P=Pp*2*PI/360.
	   R=960.

C--- Transformation Matrix of Vector Field from Image-Coord. to Herli-Coord.
           AA(1,1)=-SIN(B0)*SIN(P)*SIN(L-L0)+COS(P)*COS(L-L0)
           AA(1,2)=+SIN(B0)*COS(P)*SIN(L-L0)+SIN(P)*COS(L-L0)
           AA(1,3)=-COS(B0)*SIN(L-L0)
             T1=-SIN(B)*(SIN(B0)*SIN(P)*COS(L-L0)+COS(P)*SIN(L-L0))
             T2=-COS(B)*(COS(B0)*SIN(P))
           AA(2,1)=T1+T2
             T1=+SIN(B)*(SIN(B0)*COS(P)*COS(L-L0)-SIN(P)*SIN(L-L0))
             T2=+COS(B)*(COS(B0)*COS(P))
           AA(2,2)=T1+T2
           AA(2,3)=-COS(B0)*SIN(B)*COS(L-L0)+SIN(B0)*COS(B)
             T1=+COS(B)*(SIN(B0)*SIN(P)*COS(L-L0)+COS(P)*SIN(L-L0))
             T2=-SIN(B)*(COS(B0)*SIN(P))
           AA(3,1)=T1+T2
             T1=-COS(B)*(SIN(B0)*COS(P)*COS(L-L0)+SIN(P)*SIN(L-L0))
             T2=+SIN(B)*(COS(B0)*COS(P))
           AA(3,2)=T1+T2
           AA(3,3)=+COS(B)*COS(B0)*COS(L-L0)+SIN(B)*SIN(B0)

C--------project correct for vector magnetic
	ELSE IF(ANW.EQ.2) THEN
C------------ Read Three Components of Vector Magnetic Field ---------
              WRITE(*,*)'INPUT MAGNETIC VECTOR :[*.BXO]'
              READ(*,*)FILX
              CALL RW_FIT(filx,bix,mesg,'r')
              CALL FMAXMIN(bix,170,128,bxmax,bxmin)
              WRITE(*,*)'INPUT MAGNETIC VECTOR :[*.BYO]'
              READ(*,*)FILY
              CALL RW_FIT(fily,biy,mesg,'r')
              CALL FMAXMIN(biy,170,128,bymax,bymin)
              do i=1,128
              do j=1,170
                  rdat(j,i)=sqrt(bix(j,i)**2+biy(j,i)**2)
                  adat(j,i)=atan2d(biy(j,i),bix(j,i))
              end do
              end do
              call fmaxmin(rdat,170,128,rmax,rmin)
              dqu=1.2*rmax
 
              WRITE(*,*)'INPUT MAGNETIC VECTOR :[*.BZO]'
              READ(*,*)FILZ
              CALL RW_FIT(filz,biz,mesg,'r')
 
C-------Seeing Correction 
11            CALL FMAXMIN(biz,170,128,bzmax,bzmin)
	      WRITE(*,*)'Require Correction of Vector Field as Seeing?<Y/N> '
              READ(*,*)KEY
              IF(key.eq.'y') THEN
                 write(*,*)'Please Input Correct Factor==>[1.0]'
                 read(*,*)cail
                 do i=1,128
                 do j=1,170
                     biz(j,i)=cail*biz(j,i)
                     bix(j,i)=cail*bix(j,i)
                     biy(j,i)=cail*biy(j,i)
                 end do
                 end do
                 go to 11
	      ENDIF

	ELSE IF(ANW.EQ.3) THEN
           CSIMAX=-1.0E6
           CSIMIN=1.0E6
           YITMAX=-1.0E6
           YITMIN=1.0E6
           XV0=0.0
           YV0=0.0
           XSCL=XSIZE*60./170.
           YSCL=YSIZE*60/128.
	   WRITE(*,*)'Give the  ORIGINAL POINT OF HERLI-COORD. FRAME (X0,Y0):'
           WRITE(*,*)'(X0,Y0)==>[85.,64.]'
           READ(*,*)XV0,YV0
           WRITE(*,*)'SCALE-X:[1.]==? SCALE-Y:[1.]==?'
           READ(*,*)CVX,CVY
 
             LL=Lc
             BB=Bc
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSIc=(S1*COS(P)-S2*SIN(P))/XSCL
             YITc=(S1*SIN(P)+S2*COS(P))/YSCL
 
          DO I=1,128
          DO J=1,170
             X=XSCL*(FLOAT(J)*cvx-xv0)
             Y=YSCL*(FLOAT(I)*cvy-yv0)
             DL=ASIN(X/R)
             DB=ASIN(Y/R)
             LL=Lc+DL
             BB=Bc+DB
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSI=XV0+(S1*COS(P)-S2*SIN(P))/XSCL-CSIc
             YIT=YV0+(S1*SIN(P)+S2*COS(P))/YSCL-YITc
 
             IF(CSIMAX.LT.CSI) CSIMAX=CSI
             IF(CSIMIN.GT.CSI) CSIMIN=CSI
             IF(YITMAX.LT.YIT) YITMAX=YIT
             IF(YITMIN.GT.YIT) YITMIN=YIT
 
	     BHX(J,I)=0.0
	     BHY(J,I)=0.0
	     BHZ(J,I)=0.0
	     IF(CSI.LT.170.AND.CSI.GT.1.AND.YIT.LT.128.AND.YIT.GT.1) THEN
               CALL INSERT4(BIX,CSI,YIT,BIXX,170,128)
               CALL INSERT4(BIY,CSI,YIT,BIYY,170,128)
               CALL INSERT4(BIZ,CSI,YIT,BIZZ,170,128)
               BHX(J,I)=AA(1,1)*BIXX+AA(1,2)*BIYY+AA(1,3)*BIZZ
               BHY(J,I)=AA(2,1)*BIXX+AA(2,2)*BIYY+AA(2,3)*BIZZ
               BHZ(J,I)=AA(3,1)*BIXX+AA(3,2)*BIYY+AA(3,3)*BIZZ
             END IF
          END DO
          END DO
          WRITE(*,31)CSIMAX,CSIMIN
          WRITE(*,32)YITMAX,YITMIN
31        FORMAT('XSIMAX= ',F6.2,' XSIMIN= ',F6.2)
32        FORMAT('YITMAX= ',F6.2,' YITMIN= ',F6.2)

C ------ Display the Position of Selected Herli-Coord. Grid in Image-Coord.-----
          CALL PGBEGIN(0,'?',1,1)
          call pgvsize(1.,1.4*5.28+1.,0.3,1.4*3.627+0.3)
C  ----view field of active region(5'.23 X 3'.626)
C------ 35".0/2.08cm   box field(18.70cm, 12.92cm)
C------- the new data come from observation June 1995 by Zhang H.
          call pgwindow(1.,170.,1.,128.)
          call pgbox('bcns',0.0,0,'bcns',0.0,0)
          DO I=1,131,10
          DO J=1,170
             X=XSCL*(FLOAT(J)*cvx-xv0)
             Y=YSCL*(FLOAT(I)*cvy-yv0)
             DL=ASIN(X/R)
             DB=ASIN(Y/R)
             LL=Lc+DL
             BB=Bc+DB
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSI=XV0+(S1*COS(P)-S2*SIN(P))/XSCL-CSIc
             YIT=YV0+(S1*SIN(P)+S2*COS(P))/YSCL-YITc
             CALL PGPOINT(1,CSI,YIT,-1)
          END DO
          END DO
          DO I=1,128
          DO J=1,171,10
             X=XSCL*(FLOAT(J)*cvx-xv0)
             Y=YSCL*(FLOAT(I)*cvy-yv0)
             DL=ASIN(X/R)
             DB=ASIN(Y/R)
             LL=Lc+DL
             BB=Bc+DB
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSI=XV0+(S1*COS(P)-S2*SIN(P))/XSCL-CSIc
             YIT=YV0+(S1*SIN(P)+S2*COS(P))/YSCL-YITc
             CALL PGPOINT(1,CSI,YIT,-1)
          END DO
          END DO
 
C-------Display Vector Magnetic Field Before Projecting Correction and
C------- the Selected Area
          CALL ARROW(RDAT,ADAT,1,170,1,128,dqu)
          DO K=1,8
             CM(K)=-CP(K)
          END DO
          WRITE(*,*)'----Display Longitude Magnetic Field?<Y/N>'
          READ(*,*)KEY
          IF(key.eq.'y') then
            CALL GSLS(2)
            call pgsci(2)
            CALL PGSLW(1)
            CALL PGCONT(biz,170,128,1,170,1,128,CM,-8,TR)
            call pgsls(1)
            call pgsci(7)
            CALL PGSLW(1)
            CALL PGCONT(biz,170,128,1,170,1,128,CP,-8,TR)
          END IF
          CALL PGEND

	ELSE IF(ANW.EQ.4) THEN
C-------Display Vector Magnetic Field in Selected Area after Correction
            do i=1,128
            do j=1,170
              rbt(j,i)=sqrt(bhx(j,i)**2+bhy(j,i)**2)
              abt(j,i)=atan2d(bhy(j,i),bhx(j,i))
            end do
            end do
            call fmaxmin(rdat,170,128,bmax,bmin)
            dbt=1.2*bmax
 
            CALL PGBEGIN(0,'?',1,1)
            call pgvsize(1.,1.4*5.28+1.,0.3,1.4*3.627+0.3)
C  ----view field of active region(5'.23 X 3'.626)
C------ 35".0/2.08cm   box field(18.70cm, 12.92cm)
C------- the new data come from observation June 1995 by Zhang H.
            call pgwindow(1.,170.,1.,128.)
            call pgbox('bcns',0.0,0,'bcns',0.0,0)
            CALL ARROW(RBT,ABT,1,170,1,128,dbt)
            CALL GSLS(2)
            call pgsci(2)
            CALL PGSLW(1)
            CALL PGCONT(bhz,170,128,1,170,1,128,CM,-8,TR)
            call pgsls(1)
            call pgsci(7)
            CALL PGSLW(1)
            CALL PGCONT(bhz,170,128,1,170,1,128,CP,-8,TR)

	ELSE IF(ANW.EQ.5) THEN
          write(*,*)'Give Last Character of Filename[*.**h]:'
          read(*,*)ch
          filx=filx(1:11)//ch//' '
          fily=fily(1:11)//ch//' '
          filz=filz(1:11)//ch//' '
          call rw_fit(filx,bhx,mesg,'w')
          call rw_fit(fily,bhy,mesg,'w')
          call rw_fit(filz,bhz,mesg,'w')

	ELSE IF(ANW.EQ.6) THEN
C------------ Read Mono-image file d*.dat or s*.dat ---------
              WRITE(*,*)'INPUT  MONO-IMAGE FILE:[*.dat]'
              READ(*,*)FILE
              CALL  R_MAP(FILE,TMP)
              DO I=1,512
              DO J=1,512
                 GYO(J,I)=TMP(J,513-I)
              ENDDO
              ENDDO
              CALL FMAXMIN(gyo,512,512,gymax,gymin)
	ELSE IF(ANW.EQ.7) THEN
          CSIMAX=-1.0E6
          CSIMIN=1.0E6
          YITMAX=-1.0E6
          YITMIN=1.0E6
          XM0=0.0
          YM0=0.0
           XSCL=XSIZE*60./512.
           YSCL=YSIZE*60/512.

	  WRITE(*,*)'Give the ORIGINAL POINT OF HERLI-COORD. FRAME (X0,Y0):'
          WRITE(*,*)'(X0,Y0)==>[256. 256.]'
          READ(*,*)XM0,YM0
          WRITE(*,*)'SCALE-X:[1.]==? SCALE-Y:[1.]==?'
          READ(*,*)CMX,CMY
 
             LL=Lc
             BB=Bc
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSIc=(S1*COS(P)-S2*SIN(P))/XSCL
             YITc=(S1*SIN(P)+S2*COS(P))/YSCL
 
          DO I=1,512
          DO J=1,512
             X=XSCL*(FLOAT(J)*cmx-xm0)
             Y=YSCL*(FLOAT(I)*cmy-ym0)
             DL=ASIN(X/R)
             DB=ASIN(Y/R)
             LL=Lc+DL
             BB=Bc+DB
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSI=XM0+(S1*COS(P)-S2*SIN(P))/XSCL-CSIc
             YIT=YM0+(S1*SIN(P)+S2*COS(P))/YSCL-YITc
 
             IF(CSIMAX.LT.CSI) CSIMAX=CSI
             IF(CSIMIN.GT.CSI) CSIMIN=CSI
             IF(YITMAX.LT.YIT) YITMAX=YIT
             IF(YITMIN.GT.YIT) YITMIN=YIT
	     
	     gyh(j,i)=0.0 
	     IF(CSI.LT.512.AND.CSI.GT.1.AND.YIT.LT.512.AND.YIT.GT.1) THEN
               CALL INSERT4(gyo,CSI,YIT,gyhh,512,512)
               gyh(j,i)=gyhh
             END IF
          END DO
          END DO
          WRITE(*,41)CSIMAX,CSIMIN
          WRITE(*,42)YITMAX,YITMIN
41        FORMAT('XSIMAX= ',F6.2,' XSIMIN= ',F6.2)
42        FORMAT('YITMAX= ',F6.2,' YITMIN= ',F6.2)
C ------ Display the Position of Selected Herli-Coord. Grid in Image-Coord.-----
          white=255.
          black=0.
          CALL PGBEGIN(0,'?',1,1)
          call pgvsize(1.,1.4*5.28+1.,0.3,1.4*3.627+0.3)
C  ----view field of active region(5'.23 X 3'.626)
C------ 35".0/2.08cm   box field(18.70cm, 12.92cm)
C------- the new data come from observation June 1995 by Zhang H.
          call pgwindow(1.,512.,1.,512.)
          call pgbox('bcns',0.0,0,'bcns',0.0,0)
          call pggray(gyo,512,512,1,512,1,512,white,black,tr)
          call pgsci(2)
          DO I=1,521,26
          DO J=1,512
             X=XSCL*(FLOAT(J)*cmx-xm0)
             Y=YSCL*(FLOAT(I)*cmy-ym0)
             DL=ASIN(X/R)
             DB=ASIN(Y/R)
             LL=Lc+DL
             BB=Bc+DB
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSI=XM0+(S1*COS(P)-S2*SIN(P))/XSCL-CSIc
             YIT=YM0+(S1*SIN(P)+S2*COS(P))/YSCL-YITc
             CALL PGPOINT(1,CSI,YIT,-1)
          END DO
          END DO
          DO I=1,512
          DO J=1,521,26
             X=XSCL*(FLOAT(J)*cmx-xm0)
             Y=YSCL*(FLOAT(I)*cmy-ym0)
             DL=ASIN(X/R)
             DB=ASIN(Y/R)
             LL=Lc+DL
             BB=Bc+DB
             S1=R*COS(BB)*SIN(LL-L0)
             S2=R*(COS(B0)*SIN(BB)-SIN(B0)*COS(BB)*COS(LL-L0))
             CSI=XM0+(S1*COS(P)-S2*SIN(P))/XSCL-CSIc
             YIT=YM0+(S1*SIN(P)+S2*COS(P))/YSCL-YITc
             CALL PGPOINT(1,CSI,YIT,-1)
          END DO
          END DO
          CALL PGEND

	ELSE IF(ANW.EQ.8) THEN
C-------   Display mono image in Selected Area after Correction
            CALL PGBEGIN(0,'?',1,1)
            call pgvsize(1.,1.4*5.28+1.,0.3,1.4*3.627+0.3)
C  ----view field of active region(5'.23 X 3'.626)
C------ 35".0/2.08cm   box field(18.70cm, 12.92cm)
C------- the new data come from observation June 1995 by Zhang H.
            call pgwindow(1.,512.,1.,512.)
            call pgbox('bcns',0.0,0,'bcns',0.0,0)
            call pgsci(1)
           call pggray(gyh,512,512,1,512,1,512,white,black,tr)

	ELSE IF(ANW.EQ.9) THEN
          write(*,*)'Give Last Character of Filename[*.**h]:'
          read(*,*)ch
          file=file(1:11)//ch//' '
          DO I=1,512
          DO J=1,512
             tmp(J,I)=gyh(J,513-I)
          ENDDO
          ENDDO
          call s_data(file,tmp)
	ELSE IF(ANW.EQ.10) THEN
	   GOTO 999
	ELSE IF(ANW.EQ.11) THEN
	   CALL exel
	ENDIF

	IF(ANW.EQ.4.OR.ANW.EQ.8) THEN
            call pgsci(7)
            call pgwnad(0.,105.,0.,100.)
            call pgvsize(0.05,10.5+0.05,0.05,10.0+0.05)
            call pgscf(2)
            call pgsch(2.)
	    call pgtext(10.,73.,'The Projecting Correction for Vector Field ')
            call pgsch(0.8)
         
	write(*,*)'Bc,Lc',Bb,Ll
	write(*,*)'B0,L0',Bb0,Ll0
	write(*,*)'p',pp


            str='Image Center Coord.(Bc,Lc): -'
            call string(Ll*10,crl)
            if(crl(1:1).eq.'0') then
               crl(1:1)=' '
               if(crl(2:2).eq.'0') crl(2:2)=' '
            end if
            if(Bb.lt.0.0) then
              call string(-Bb*10,crm)
              str=str(1:29)//crm(1:3)//'.'//crm(4:4)//'    '
     1            //crl(1:3)//'.'//crl(4:4)
            else
              call string(Bb*10,crm)
              str(29:29)=' '
              str=str(1:29)//crm(1:3)//'.'//crm(4:4)//'    '
     1            //crl(1:3)//'.'//crl(4:4)
            end if
            if(str(30:30).eq.'0') then
               str(30:30)=' '
               if(str(31:31).eq.'0') str(31:31)=' '
            end if
            call pgtext(15.,69.,str)
            str='Solor Center Coord.(B0,L0): -'
            call string(Ll0*10,crl)
            if(Bb0.lt.0.0) then
               call string(-Bb0*10,crm)
               str=str(1:29)//crm(1:3)//'.'//crm(4:4)//'    '
     1            //crl(1:3)//'.'//crl(4:4)
            else
              call string(Bb0*10,crm)
              str(29:29)=' '
              str=str(1:29)//crm(1:3)//'.'//crm(4:4)//'    '
     1            //crl(1:3)//'.'//crl(4:4)
            end if
            if(str(30:30).eq.'0') then
               str(30:30)=' '
               if(str(31:31).eq.'0') str(31:31)=' '
            end if
            call pgtext(15.,67.,str)
 
            str='Solor N-Pole Position (P): -'
            if(Pp.lt.0.0) then
               call string(-Pp*10,crm)
               str=str(1:29)//crm(1:3)//'.'//crm(4:4)
            else
              call string(Pp*10,crm)
              str=str(1:29)//crm(1:3)//'.'//crm(4:4)
            end if
            if(str(30:30).eq.'0') then
               str(30:30)=' '
               if(str(31:31).eq.'0') str(31:31)=' '
            end if
            call pgtext(15.,65.,str)
 
            str=filx(1:12)//'  '//fily(1:12)//'  '//filz(1:12)
            call pgtext(15.,63.,str)
 
            call pgtext(xx2,yy2-10.,'S : ------')
            call pgtext(xx2,yy2-12.,'Lev. : Gauss')
            do i=1,8
               call pgtext(xx2+2.,yy2-14.-2.6*i,cht(i))
            end do 
            CALL PGEND
	ENDIF

	GOTO 100	

999	WRITE(*,*)'----- O.K.  Thank You For Using ! -------'
	STOP
	END


