加速度記録(ac)ファイルファイルの書式
acファイルは拡張子acを持つテキストファイルで、行はCRLFで区切られています。
ひとつのファイルに1台の強震計で得られた全成分の記録が含まれています。
ファイルの最初の行はファイルヘッダーで、以下の情報を含みます。
2行目は第1成分の成分ヘッダーです。
3行目以降にその成分の加速度データが続きます。
1つのデータは10桁を占め、1行に8個のデータが書かれています。
各加速度データは小数点以下3桁の精度を持つ実数値です。
FORTRANで言うところの(8F10.3)です。
その成分の加速度データが終わると次の成分の成分ヘッダー、加速度データと続き、収録されている成分数繰り返されます。
|
1993/01/15 20:06:08 3 100 15700 KSR: Kushiro Local Meteorological Observatory, JMA
063-GL -711.403 3675 0.013 3.00e-2
0.077 -0.043 0.017 0.017 0.017 -0.043 -0.013 0.017
-0.013 0.017 -0.013 -0.013 0.047 -0.013 0.017 -0.043
-0.043 -0.073 0.017 -0.013 0.047 -0.043 -0.013 -0.013
-0.043 -0.013 0.017 -0.013 0.017 -0.043 0.017 0.047
.
. (snipped)
.
1.007 0.707 0.797 1.097 0.677 -0.133 -0.403 -0.313
-0.733 -1.243 -0.943 -0.283
153-GL -637.240 3617 0.010 3.00e-2
0.020 0.020 -0.010 0.020 0.020 -0.040 -0.040 0.020
-0.010 -0.010 0.020 0.020 -0.010 -0.010 -0.010 -0.010
-0.040 -0.010 0.020 -0.010 -0.040 -0.010 -0.010 -0.040
-0.010 -0.010 -0.010 -0.010 -0.010 0.020 -0.010 -0.010
.
. (snipped)
.
-1.210 -1.690 -2.230 -2.260 -1.900 -1.480 -1.090 -0.610
-0.400 -0.490 -0.370 0.110
UP-GL 363.391 3298 -0.030 3.00e-2
0.060 0.000 0.000 -0.030 0.030 0.000 -0.030 0.060
0.030 -0.030 -0.060 0.060 0.060 0.030 0.000 -0.030
-0.060 0.000 0.030 -0.030 -0.030 0.000 0.030 0.060
0.030 -0.030 -0.060 -0.060 0.030 0.030 0.000 -0.030
.
. (snipped)
.
-0.600 -0.780 -0.420 0.450 0.960 0.600 -0.210 -0.840
-0.990 -0.810 -0.810 -0.600
|
サンプルプログラム
下記はacファイルを読むFORTRAN90のサンプルプログラムです(サンプルプログラムとサンプルデータのZIPファイル)。
|
real(4), allocatable:: peak(:), acc(:,:)
character(10), allocatable:: comp(:)
integer(4):: nfrq, nstp, nch, ich, istp, i
integer(4):: iostat
real(4):: dt, offset, calib
character(10):: date, time, code
character(128):: site, fname
!
fname='sample.ac'
open (88, file=fname, iostat=iostat)
! read file header.
read (88, '(a10,1x,a8,2i4,i6,a128)') date, time, nch, nfrq, nstp, site
! allocate arrays.
allocate (comp(nch), peak(nch), acc(nstp,nch))
! read header and acceleration of each channel.
do ich=1, nch
read (88, '(a10,f10.3)') comp(ich), peak(ich)
read (88, '(8f10.3)') (acc(i,ich), i=1,nstp)
end do
! close a file.
close (88)
! get some parameters
dt=1/real(nfrq)
i=index(site, ':')
if (i.gt.0) then
code=site(1:i-1)
site=site(i+1:)
else
code=''
endif
! output parameters.
print '(''Acceleration filename: '',a)', trim(fname)
print '('' Sitecode: '',a)', trim(code)
print '('' Sitename: '',a)', trim(site)
print '(''Trigger time and date:'',a8,1x,a10)', time, date
print '('' Number of channels:'',i6)', nch
print '('' Sampling frequency:'',i6,''Hz'')', nfrq
print '('' (Time interval:'',f6.3,''sec)'')', dt
print '('' Number of steps:'',i6)', nstp
do ich=1, nch
print '(''ch:'',i2,'' ('',a,'') peak:'',f8.2)', &
ich, trim(comp(ich)), peak(ich)
end do
! release arrays.
deallocate (peak, comp, acc)
stop
end
|
留意事項
|
April 2003 by T. Kashima
|