PSN Event File Format Updated: 05/28/00 The seismic data file is saved in BASIC BSAVE format. The BSAVE statement creates an unencoded, binary file, which is an exact image of memory contents. Seven bytes of control information are written at the beginning of the file, and these bytes are followed by the data bytes copied from memory. The file length shown in the DOS directory entry will be the BSAVE-specified length plus 7, rounded up to a multiple of the BASIC buffer size. The format of the file is as follows: Offset Length Contents 0 1 X'FD' (Constant BSAVE file format identifier) 1* 2 BASIC DS segment value at BSAVE execution time 3* 2 Offset in the DS segment specified in the BSAVE statement 5 2 Data length specifed in the BSAVE statement * Starting with WinQuake version 2.3 and SDR version 1.8 Offsets 1 and 3 are used to store the data count of the event file if the number of samples is above 65000. Offsets 1 and 3 are used as a LONG (32 bit value). See Note 1 for more information. The segment value, offset, and length values are all stored in Intel low-high-order format. If a BLOAD statement is executed with an offset term, then that offset value and the BASIC DS segment value in effect at BLOAD execution time will be used to place the loaded data; if a BLOAD statement is executed without an offset term, then the stored segment and offset values will be used. In both cases, the stored length value determines the amount of data loaded. The memory image data portion of the file is described below. These 2-byte integer fields are also stored in Intel low-high-order format. Offsets as listed should be used as shown to index into the array after it has been BLOAD'ed into memory, i.e. ARRAY%(1) contains the year of the start of data collection. This assumes you have not changed the BASIC default array origin of zero. The file format is shown below: OFFSET NAME CONTENTS 0 Format Flag describing format of data A flag value of 2 means that the following file format is being used A flag value of 3 means COMMENT field starts 30 positions past where it used to (packed two per offset). Initial 30 positions now have more info about data collection equipment, and room to add info later (via QUAKEVU, WinQuake, etc.) about actual magnitude, location, depth etc.) 1 SYEAR Year of start of data collection 2 SMON Start month of data collection 3 SDAY Day of start of data collection 4 SHOUR Hour of start of data collection 5 SMIN Minute of start of data collection 6 SSEC Second of start of data collection 7 STENTH Tenths of second at start 8 FHOUR Hour of finish of data collection 9 FMIN Minute of finish of data collection 10 FSEC Second of finish of data collection 11 FTENTH Tenths of seconds at finish 12 COUNT Count of valid elements in the file including the 100 2-byte header. See Note 1 13 BASE BASELINE value used for this file 14 MIN Min. sampled value in this file 15 MAX Max. sampled value in this file 16 ORIENTATION CHARACTER N = North-South, E = East-West, Z = Vertical 17 LATINT Station latitude N of equator (neg for S) Integer portion only 18 LATDEC Decimal portion of latitude multiplied by 100 and rounded to nearest integer Also negative if South Latitude 19 LONGINT Longitude E of Greenwich (neg. for W) Integer portion only 20 LONGDEC Decimal portion of longitude multiplied by 100 and rounded to nearest integer Also negative if West Longitude 21 N/A Nat. Earthquake Info. Center calculated origin time of quake. This value is set to -1 by this program, modified by the user via the COMMENT program later after checking with the NEIC 22 N/A NEIC minute of quake origin 23 N/A NEIC second of quake origin 24 N/A NEIC tenths of second of origin 25-39 LOCATION Name of recording location (15 chars) from EMON.OPT. 2 If FORMAT = 2 THEN the following is valid 2 40-99 COMMENT Description of quake. Added to quake file 2 with the COMMENT program at a later time. 2 END FORMAT = 2 description. 3 If FORMAT = 3 THEN the following is valid. 3 3 EMON will fill in the next section based on EMON.OPT input values 3 or values in effect at the time of saving data file. 3 3 40 ADCTYPE Type of A/D converter. See EMON.OPT file. 3 41 ADCNULL Value returned by A/D at zero volts input. 3 42 ADCMIN Value returned by A/D at min volts input. 3 43 ADCMAX Value returned by A/D at max volts input. 3 44 NUMCONV Number of A/D conversions averaged per samp. 3 (from value in effect at end of interval) 3 45 Integer portion of MagCorr 3 46 Decimal portion of MagCorr * 10000 3 47 Extended NEIC Time info if low byte is set 3 to 55 Hex. High byte is Hour of event. 3 48 Extended NEIC Time info. Low byte is Day and 3 the high byte is the month of the event. 3 49 Unused. 3 3 QUAKEVU, COMMENT or WinQuake will fill in the next section: 3 3 50-51 Rsvd for 4 packed characters describing 3 method USGS used to calc magnitude (ML, etc.) 3 52 Rsvd for USGS Magnitude value * 10 (6.6 = 66) 3 53 Rsvd for USGS Depth (in kilometers) 3 54 Rsvd for integer portion of quake latitude 3 55 Rsvd for 1000 * decimal portion of quake lat 3 56 Rsvd for integer portion of quake longitude 3 57 Rsvd for 1000 * decimal portion of quake long 3 58 P Pick time offset from start time in 0.1 sec. 3 59 S Pick time offset from start time in 0.1 sec. 3 60 Y Screen Location for P and S picks. Low byte 3 is P location and the high byte is the S 3 location. 1 = bottom to 255 = top of screen. 3 61 Table info used for picks. If high order bit 3 is on bits 0-11 contain the table depth used 3 (in km). If bit 14 is on Regional travel time 3 tables used. If off Teleseismic where used. 3 62-69 Reserved for additional information. See the 3 newFmt structure below for new fields used 3 by SDR and WinQuake. 3 3 70-99 COMMENT Description of quake. Added to quake file 3 with another program at a later time. 3 Characters are packed two per two-byte- 3 integer value, padded with blanks. 3 End FORMAT = 3 section. 100-25099 Two-byte-integer digitized seismometer * output values. * WinQuake was written in C++ so I don't use the first 7 bytes of the event file except if the sample count is above 65000 (See Note 1). The program reads in the first 7 bytes in the file, then reads in the next 200 bytes in to a structure, I get the samples count in COUNT (offset 12), subtract 100, then read in that many samples. Here's the C structures and some defines used by WinQuake and SDR: #define GOODTIME 0x55 (See Note 2) #define GOODTBL 0x8000 #define REGIONAL_TABLE 0x4000 #define DEPTH_MASK 0x0fff typedef struct { short comment[60]; } oldFmt; typedef struct { short adcType, adcNull, adcMin, adcMax; short numConv; short magCorrInt, magCorrDec; // new NEIC extended time info see Note 2 char goodTime, neicHour, neicDay, neicMonth; short spare[1]; short magType[2]; short magnitude; short depth; short quakeLatInt, quakeLatDec; short quakeLongInt, quakeLongDec; WORD pPickTime, sPickTime; // new P and S pick info BYTE pYLocation, sYLocation; // location on the screen for P & S WORD pickTableInfo; BYTE lockChr; // lockChr can be "L" or "?" BYTE bspare; short spare1[7]; short comment[30]; } newFmt; // Quake file header info for format 2 and 3 starting 7 bytes in // from the beginning of the file typedef struct { short format, sYear, sMonth, sDay, sHour, sMin, sSec, sTenth, fHour, fMin, fSec, fTenth; WORD dataCount; // samples in file short atodBase, dataMin, dataMax, orientation, latInt, latDec, longInt, longDec, neicFlag, neicMin, neicSec, neicTenth, location[15]; union { oldFmt oldfmt; newFmt newfmt; } u; } EqHeader; char = signed 8 bits BYTE = unsigned 8 bits short = signed 16 bits WORD = unsigned 16 bits Notes: 1) Starting with WinQuake version 2.3 and SDR version 1.8 event files can be greater then 65000 samples. If the dataCount field in the header (Offset 12) is set to all ones (65535 or 0xffff) then the actual data count is stored in the first 7 bytes (BSAVE information). Offsets 1 and 3 are used as a LONG (32 bits) to hold the data count. 2) WinQuake will write/read the extened NEIC information. If the byte goodTime (see structure newFmt) is set to GOODTIME (0x55) then the following fields are valid: neicHour, neicDay, neicMonth. If anyone has any questions about this format or WinQuake feel free to e-mail me at: cochrane@.............. Larry Cochrane