|
本帖最后由 zhangzhipeng 于 2016-2-29 22:12 编辑
FileNumber和StationNumber计算出来了,但是后面为什么崩?
[Fortran] 纯文本查看 复制代码 003 | Integer , parameter :: FileUnit = 100 |
004 | Character ( Len = * ) , Parameter :: Directer = '"' / / '..\WAV\WAVFormYiliang\yiliang\*.*' / / '"' |
005 | Integer ( kind = 4 ) , save :: i , j , k , m , n , FileNameLong |
006 | Character ( Len = 1 ) , save :: separator |
007 | Character ( Len = 4 ) , save :: Station |
008 | Integer ( kind = 4 ) , save :: StationNumber |
009 | Integer ( kind = 4 ) , save :: FileNumber |
011 | Character ( Len = 4 ) , dimension ( : ) , allocatable :: StationName |
012 | Character ( Len = 4 ) , dimension ( : , : ) , allocatable :: ComponentName |
013 | Character ( Len = 1 ) , dimension ( : , : ) , allocatable :: stringFileName |
014 | Real ( kind = 4 ) , dimension ( : , : ) , allocatable :: StationWaveformLong |
015 | Real ( kind = 4 ) , dimension ( : , : ) , allocatable :: StationMaximumAmplitude |
016 | Real ( kind = 4 ) , dimension ( : , : ) , allocatable :: StationDELTA |
019 | Real ( Kind = 4 ) , Allocatable :: DELTA ( : , : ) , DEPMIN ( : , : ) , DEPMAX ( : , : ) , SCALE ( : , : ) , ODELTA ( : , : ) , B ( : , : ) , E ( : , : ) , & |
020 | O ( : , : ) , A ( : , : ) , INTERNAL 1 ( : , : ) , T 0 ( : , : ) , T 1 ( : , : ) , T 2 ( : , : ) , T 3 ( : , : ) , T 4 ( : , : ) , T 5 ( : , : ) , T 6 ( : , : ) , T 7 ( : , : ) , T 8 ( : , : ) , T 9 ( : , : ) , F ( : , : ) , & |
021 | RESP 0 ( : , : ) , RESP 1 ( : , : ) , RESP 2 ( : , : ) , RESP 3 ( : , : ) , RESP 4 ( : , : ) , RESP 5 ( : , : ) , RESP 6 ( : , : ) , RESP 7 ( : , : ) , RESP 8 ( : , : ) , RESP 9 ( : , : ) , & |
022 | STLA ( : , : ) , STLO ( : , : ) , STEL ( : , : ) , STDP ( : , : ) , EVLA ( : , : ) , EVLO ( : , : ) , EVEL ( : , : ) , EVDP ( : , : ) , MAG ( : , : ) , & |
023 | USER 0 ( : , : ) , USER 1 ( : , : ) , USER 2 ( : , : ) , USER 3 ( : , : ) , USER 4 ( : , : ) , USER 5 ( : , : ) , USER 6 ( : , : ) , USER 7 ( : , : ) , USER 8 ( : , : ) , USER 9 ( : , : ) , & |
024 | DIST ( : , : ) , AZ ( : , : ) , BAZ ( : , : ) , GCARC ( : , : ) , INTERNAL 2 ( : , : ) , INTERNAL 3 ( : , : ) , & |
025 | DEPMEN ( : , : ) , CMPAZ ( : , : ) , CMPINC ( : , : ) , XMINIMUM ( : , : ) , XMAXIMUM ( : , : ) , YMINIMUM ( : , : ) , YMAXIMUM ( : , : ) , & |
026 | ADJTM ( : , : ) , UNUSED 1 ( : , : ) , UNUSED 2 ( : , : ) , UNUSED 3 ( : , : ) , UNUSED 4 ( : , : ) , UNUSED 5 ( : , : ) , UNUSED 6 ( : , : ) |
027 | Integer ( Kind = 4 ) , Allocatable :: NZYEAR ( : , : ) , NZJDAY ( : , : ) , NZHOUR ( : , : ) , NZMIN ( : , : ) , NZSEC ( : , : ) , NZMSEC ( : , : ) , NVHDR ( : , : ) , & |
028 | NORID ( : , : ) , NEVID ( : , : ) , NPTS ( : , : ) , NSPTS ( : , : ) , NWFID ( : , : ) , NXSIZE ( : , : ) , NYSIZE ( : , : ) , UNUSED 7 ( : , : ) , & |
029 | IFTYPE ( : , : ) , IDEP ( : , : ) , IZTYPE ( : , : ) , UNUSED 8 ( : , : ) , IINST ( : , : ) , ISTREG ( : , : ) , IEVREG ( : , : ) , IEVTYP ( : , : ) , IQUAL ( : , : ) , ISYNTH ( : , : ) , IMAGTYP ( : , : ) , IMAGSRC ( : , : ) , & |
030 | UNUSED 9 ( : , : ) , UNUSED 10 ( : , : ) , UNUSED 11 ( : , : ) , UNUSED 12 ( : , : ) , UNUSED 13 ( : , : ) , UNUSED 14 ( : , : ) , UNUSED 15 ( : , : ) , UNUSED 16 ( : , : ) , & |
031 | LEVEN ( : , : ) , LPSPOL ( : , : ) , LOVROK ( : , : ) , LCALDA ( : , : ) , UNUSED 17 ( : , : ) |
032 | Character ( Len = 16 ) , Allocatable :: KEVNM ( : , : ) |
033 | Character ( Len = 8 ) , Allocatable :: KSTNM ( : , : ) , KHOLE ( : , : ) , KO ( : , : ) , KA ( : , : ) , KT 0 ( : , : ) , KT 1 ( : , : ) , KT 2 ( : , : ) , KT 3 ( : , : ) , KT 4 ( : , : ) , KT 5 ( : , : ) , KT 6 ( : , : ) , KT 7 ( : , : ) , KT 8 ( : , : ) , KT 9 ( : , : ) , & |
034 | KF ( : , : ) , KUSER 0 ( : , : ) , KUSER 1 ( : , : ) , KUSER 2 ( : , : ) , KCMPNM ( : , : ) , KNETWK ( : , : ) , KWaveformRD ( : , : ) , KINST ( : , : ) |
036 | Integer ( kind = 4 ) , dimension ( : , : ) , Allocatable :: Header 1 |
037 | Real ( kind = 4 ) , dimension ( : , : ) , Allocatable :: Header 2 |
038 | Character ( Len = 8 ) , dimension ( : , : ) , Allocatable :: Header 3 |
039 | real ( kind = 4 ) , Allocatable :: Waveform ( : , : , : ) |
040 | Integer ( kind = 4 ) , Allocatable :: WaveformLong ( : , : ) |
042 | public FileUnit , Directer , i , j , k , m , n , FileNameLong , separator , Station , DoWithWildcard , WriteName , SplitName , EventPara , SACHeader |
045 | Subroutine DoWithWildcard ( cWildcard , CallBack , iTotal ) |
046 | Use DFLib , only : GetFileInfoQQ , GetLastErrorQQ , FILE $INFO , FILE $LAST , FILE $ERROR , FILE $FIRST , ERR $NOMEM , ERR $NOENT , FILE $DIR |
047 | type ( EventPara ) :: EVENT 1 |
048 | type ( SACHeader ) :: SACFILE 1 |
050 | Subroutine CallBack ( FileName , loop ) |
051 | Character ( * ) , Intent ( In ) :: FileName |
052 | Integer , Intent ( In ) :: loop |
053 | End Subroutine CallBack |
055 | Character * ( * ) , Intent ( In ) :: cWildcard |
056 | Integer , Intent ( Out ) :: iTotal |
057 | TYPE ( FILE $INFO ) info |
058 | INTEGER ( 4 ) :: Wildhandle , length , retInt |
059 | Wildhandle = FILE $FIRST |
062 | length = GetFileInfoQQ ( cWildCard , info , Wildhandle ) |
063 | IF ( ( Wildhandle .EQ. FILE $LAST ) .OR. ( Wildhandle .EQ. FILE $ERROR ) ) THEN |
064 | SELECT CASE ( GetLastErrorQQ ( ) ) |
075 | If ( ( info % permit .AND. FILE $DIR ) .Eq. 0 ) then |
076 | Call CallBack ( Trim ( info.Name ) , iTotal + 1 ) |
080 | End Subroutine DoWithWildcard |
082 | Subroutine WriteName ( FileName , loop ) |
083 | type ( EventPara ) :: EVENT 1 |
084 | type ( SACHeader ) :: SACFILE 1 |
085 | Character ( Len = * ) , Intent ( In ) :: FileName |
086 | Integer , Intent ( In ) :: loop |
087 | i = Index ( FileName , separator ) |
088 | If ( Station /= FileName ( 1 : i - 1 ) ) then |
089 | Station = FileName ( 1 : i - 1 ) |
092 | Write ( * , * ) loop , Station , FileName , j |
095 | End Subroutine WriteName |
097 | Subroutine SplitName ( FileName , loop ) |
098 | type ( EventPara ) :: EVENT 1 |
099 | type ( SACHeader ) :: SACFILE 1 |
100 | Character ( * ) , Intent ( In ) :: FileName |
101 | Integer , Intent ( In ) :: loop |
102 | FileNameLong = len_trim ( FileName ) |
103 | i = Index ( FileName , separator ) |
104 | j = Index ( FileName , separator , .True. ) |
105 | If ( Station /= FileName ( 1 : j - 1 ) ) then |
108 | Station = FileName ( 1 : i - 1 ) |
110 | EVENT 1 % StationName ( n ) = Station |
112 | EVENT 1 % ComponentName ( n , m ) = FileName ( j + 1 : FileNameLong ) |
114 | EVENT 1 % ComponentName ( n , m ) = FileName ( j + 1 : FileNameLong ) |
117 | End Subroutine SplitName |
118 | End module SACParameter |
123 | type ( EventPara ) :: EVENT 1 |
124 | type ( SACHeader ) :: SACFILE 1 |
133 | Call DoWithWildcard ( '..\WAV\WAVFormYiliang\yiliang\*.*' , WriteName , N ) |
135 | Write ( * , * ) '共' , FileNumber , '个文件,' , StationNumber , '个台站' |
138 | Allocate ( EVENT 1 % StationName ( StationNumber ) ) |
139 | Allocate ( EVENT 1 % ComponentName ( StationNumber , 3 ) ) |
140 | Allocate ( EVENT 1 % stringFileName ( StationNumber , 3 ) ) |
143 | Allocate ( EVENT 1 % StationDELTA ( StationNumber , 3 ) ) |
145 | Allocate ( SACFILE 1 % Header 1 ( StationNumber , 3 ) ) |
146 | Allocate ( SACFILE 1 % Header 2 ( StationNumber , 3 ) ) |
147 | Allocate ( SACFILE 1 % Header 3 ( StationNumber , 3 ) ) |
149 | Allocate ( SACFILE 1 % WaveformLong ( StationNumber , 3 ) ) |
156 | Call DoWithWildcard ( '..\WAV\WAVFormYiliang\yiliang\*.*' , SplitName , n ) |
157 | Do i = 1 , StationNumber |
158 | Write ( * , * ) EVENT 1 % StationName ( i ) |
160 | Write ( * , * ) EVENT 1 % ComponentName ( i , j ) |
|
|