Data format conversion programs for the PC and SUN computer

A program has been written to convert from a format used to collect data on the PC computer to a popular data format used for earthquake recording on the SUN workstation. The program takes as input an event file generated on the PC and produce as output a file in a format compatible with the SUN computer. The conversion of formats makes possible the use of an analysis program on the SUN. Another program converts a PC data file to a text file. INTRODUCTION The phase-out of analog recording of seismic data in favor of digital event recording has offered the possibility of easier data exchange between researchers. This exchange was never convenient with the older analog systems due to technical difficulties of copying and playing back analog tapes. Unfortunately the switch to digital event data has introduced a new set of problems which still limit the interchange of data. Although copying or transmitting data is now very simple, the data itself is often encrypted in poorly documented formats usually unique to the computer system of the original recording. The result is that data recorded on one computer cannot be analyzed on a different computer. Eventually a seismic data format recording standard will probably emerge, but in the interim there will be a need to convert from one format to another. In Alaskan seismology this situation has already arisen since part of the recording is done in the Lamont "AH" (adhoc) format while another part is done in the PC (Lee, 1989) format. By converting the PC data to the AH format, data can be merged and then analyzed using a single analysis program on the SUN computer. CONVERTING PC FILES The Microsoft C language program "PC2SUN" converts event files generated on the PC to the AH format. Figures 1 and 2 show a graphical representations of the two formats. One fundamental difference in formats is that the PC format uses one file per event where as the AH format uses one file per channel for each event. Although all of the data files are binary and use common data types (integer, floating point etc.) the data is stored differently on the PC and SUN computers. For 16-bit integers (called short throughout), the two 8-bit bytes must be swapped before the data can be used. For 32-bit long and float types the two 16-bit words must be swapped as well as the two 8-bit bytes of each word. Character data does not need to be converted. This conversion is performed by the three functions intswp, Ingswp and fltswp with each returning the converted value. If it were not for this difference in representation, format conversion would amount to changing the order of the data in a file. The PC2SUN program first reads the PC header and stores the converted values (using the three routines described above) in the AH header structure for each channel data file. Since the PC data is multiplexed in 512-byte chunks, data for each channel is written to the appropriate AH channel file as many times as there are buffers in the PC header. Thus, if a PC event is 13 buffers long, each AH data file created will be written to 13 times with waveform data, once for each buffer.