Accelaration Record (ac) FileFile Format
An ac file is a ASCII text file with an extension ".ac" and its lines are separated by CRLF.
One ac file can include more than one channel records obtained in a strong motion instrument.
The first line contains following information.
The second line is a channel header for the first channel record.
The third and following lines make a data block.
A width of an acceleration data is 10 columns and one line contains 8 values.
The format of data corresponds to (8F10.3) in FORTRAN.
A set of a channel header and a data block is repeated for every channel as shown in the following sample.
|
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
|
Sample program
The following code is a sample program in Fortran 90 to read an ac file.
This source code was tested using Compaq Visual Fortran Optimizing Compiler Version 6.6A.
Sample program and data is available as a zip file.
|
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
|
Notes
|
April 2003 by T. Kashima
|