PSN Type 4 Format

Created: 6/17/00  Last Updated: 02/14/2017

The PSN Type 3 format is documented here: www.seismicnet.com/info/format.txt 


General Layout of the Event File:

The event file is broken up into 4 sections. They are:

 Structures used to hold data:

Volume Files:

Volume files contain two or more event files.

Utility Files:

The file StaLta.zip contains source code in "C" to read the new PSN Type 4 format. Readme file.


Fixed Header:

Structure Length: 154 bytes

Field  Name

Type / Length

Explanation

File ID and Version

8 byte

Contains the following characters: "PSNTYPE4".

Variable Header Length

long 

Length in bytes of the variable length section of the header.

 Start Time

DateTime

Start time of the event file. See below for the format of DateTime structure.

Start Time Offset 

double

Offset in seconds between the Start Time above and the first sample point. Start time = Start Time + Offset

Sample Rate 

double

Sampling rate in samples per second.
Sample Count long Number of data points in the sample data section.
Flags long General purpose flags: 1 = NO_CRC16, 2 = NO_MINMAX
Timing Ref. Type 3 byte Timing reference used; GPS = GPS, WWV=WWV, WVB=WWVB, DCF=DCF77,NTP=NTP Server
Timing Ref. Status 1 byte Timing reference status: 0 = Unknown, 'L' = Locked, '?' = Was locked within last 24 hours
Sample Data Type 1 byte Specifies the sample data format (0=16 bit integer , 1=32 integer, 2=float, 3=double)
Sample Compression 1 byte 0=None, 1=????
Component Incident double Sensor's incidence angle in degrees with respect to the vertical. Set to -12345.0 if unknown.
Component Azimuth  double Sensor's azimuth angle in degrees with respect to the north through east. Set to -12345.0 if unknown.
Component Orientation 1 byte Origination character: Z, N or E. Set to 0 if unknown.
Sensor Type  1 byte 0 = Unknown, 1=Acceleration (cm/s/s), 2=Velocity (cm/s), 3=Displacement (cm) See Note 1.
Sensor Latitude double Sensor's latitude, in decimal degrees.
Sensor Longitude double Sensor's longitude, in decimal degrees.
Sensor Elevation double Sensor's elevation in meters above or below sea level. Set to -12345.0 if unknown.
Sensor Name 6 bytes Sensor's 3 to 6 letter designation.
Channel Identifier 4 bytes Sensor's channel identifier. e.g. BHZ, LHZ
Sensor Network 6 bytes Sensor's network affiliation.
Sensitivity double Sensitivity of the sensor. See Note 1.
Magnitude Correction double WinQuake magnitude correction number.
A/D Bit Resolution  short Number of A/D converter bits e.g. 8, 12, 16 etc...
Sample Minimum  double Minimum amplitude of the sample data. See Note 2.
Sample Maximum double Maximum amplitude of the sample data. See Note 2.
Sample Mean  double Mean amplitude of the sample data. See Note 2.

Notes:

  1. The sensitivity field number depends on the Sensor Type field. If the sensor output is acceleration sensitivity is in cm/sec/sec per A/D bit, if the output is velocity cm/sec per bit and if the output is displacement in cm per bit. This web page can be used to calculate the sensitivity field number. 
  2. If these fields are not calculated the NO_MINMAX flag should be set in the Flags field above.

Variable Length Header Section:

This section would contain variable length header fields. It can also be used to add new fields not supported in the fixed section of the header. The last field would have a descriptor and data length of 0 (zero) indicating end of header. The length of this section is located in the fixed section field "Variable Header Length".

Each field would have the following format:

Name

Length

Explanation

Descriptor Check 1 byte Set to 0x55 hex (85 decimal); Used to verify beginning of descriptor.  
Descriptor ID 1 byte Field descriptor ID number; See table below.
Field Length long Field data length in bytes.
Field Data variable Data for the field.

 

Descriptor ID

Field Type

0 End record mark. Last variable length header record. Data length must be 0.
1 Sensor location string (NULL terminated).
2 Sensor information string; e.g. Lehman, 4.5 hz geophone etc (NULL terminated). 
3 Comment string  (null terminated).
4 Event information stored in a EventInfo structure. More then one event can be stored in the header by saving multiple type 4 blocks.
5 Phase pick stored in a PhasePick structure; See below for the format of PhasePick.
6 Sample filtering and integration operations. Used to hold what operations have been done to the original data. 
7 Datalogger ID string. Used to hold information about the hardware and software used to collect data.
8
International Sensor Location String stored in International Text structure. Used to support different languages, can be used multiple times within the same event. If no match is found in all existing language tags or multiple languages are not supported by your application, use default string provided in ID 1.
9
International Sensor Information String stored in International Text structure. Used to support different languages, can be used multiple times within the same event. If no match is found in all existing language tags or multiple languages are not supported by your application, use default string provided in ID 2.
10
International Comment String stored in International Text structure. Used to support different languages, can be used multiple times within the same event. If no match is found in all existing language tags or multiple languages are not supported by your application, use default string provided in ID 3.
11
Sensor Output Voltage, Amplifier Gain and A/D Input Voltage information. Data is stored in a SensorAmpAtoD structure. 
12
Poles and Zeros information.  Poles and Zeros information is stored in a PolesAndZeros structure. This information describes the frequency response of the channel. 
13 SEED and MINISEED Information. Used to store the Network and Location information from WinSDR, SEED and MINISEED files. Data is stored in a SeedInfo structure.
... Other data fields..... 

Sample Data Section:

Sample data begins after the fixed and variable sections of the header. Data can be 16 bit integer, 32 bit integer, floating point or double. Data will be stored in PC (Intel) byte order.   


CRC-16:

The last two bytes of the event file contain the CRC-16 (Cyclic Redundancy Check). This can be used to verify the integrity of the headers and data. If the NO_CRC flag is set in the Flags section of the fixed header the last two bytes of the file should be set to 0 (zero).


Data Structures

DateTime Structure:

Structure Length: 12 bytes

Field Name Type / Length Explanation
Year word Year e.g. 2000.
Month 1 byte Month, Jan=1, Dec=12. 
Day 1 byte Day of the month, 1 to 31.
Hour 1 byte Hour of the day, between 0 and 23.
Minute 1 byte Minute of the hour, between 0 and 59.
Seconds 1 byte Second of the minute, between 0 and 59.
Unused 1 byte Used to align to even byte boundary.
Nanosecond long Nanosecond of the second, between 0 and 999,999,999.

 

EventInfo Structure:

Structure Length: 62 bytes

Field Name Type / Length Explanation
Event Time DateTime Absolute time of origin of the event.
Event Latitude double Event latitude.
Event Longitude double Event longitude.
Event Depth  double Event depth in km.
Event Magnitude - Ms short Event Ms magnitude; magnitude = data field / 100
Event Magnitude - Mb short Event Mb magnitude; magnitude = data field / 100
Event Magnitude - Mw short Event Mw magnitude; magnitude = data field / 100
Event Magnitude - Ml short Event Ml magnitude; magnitude = data field / 100
Event Magnitude - Md short Event Md magnitude; magnitude = data field / 100
Event Magnitude - Other short Magnitude other then above; magnitude = data field / 100
Other Magnitude Type 4 bytes  Magnitude type if Event Magnitude - Other is used. 
Event Type Code 1 byte Event Types: 0 = unknown, 1 = earthquake, 2 = nuclear explosion, 3 = quarry blast, 4 = other explosion 
Event Location Quality 1 byte Location quality.
Flags word General purpose flags: 1 = Auto generated information.
Reporting Agency 6 bytes Reporting agency code. 

PhasePick Structure:

Structure Length: 42 bytes 

Field Name Type / Length Explanation
Start Time DateTime Absolute time of the phase pick.
Phase Name 8 bytes Phase name e.g. P, S, Pp etc.
Flags word Flags: 1 = Regional Table, 2 = Teleseismic Table, 4 =  IASP91 Table 
Display Y Location short Used to position the marker on the screen.
Travel Time File Name 16 bytes Table used for phase travel time calculation.
Table Depth short Depth used for phase travel time calculation; in km.

International Text Structure:

Structure Length: Variable 

Field Name Type / Length Explanation
Language ID 17 bytes Language Identifier according to RFC 1766 (ISO 639/ISO 3166) e.g. EN-US, EN, DE-AT, unused characters padded with NULL (0)
String bytes Text (Null terminated)

SensorAmpAtoD Structure:

Structure Length: 24 bytes 

Field Name Type / Length Explanation
Sensor Output Voltage double Output voltage of the sensor in volts per cm. 
Amplifier Gain double Gain of the amplifier between the sensor and the A/D converter.
A/D Input Voltage double Analog to Digital converter input voltage.

PolesAndZeros Structure:

Structure Length: Variable 

Field Name Type / Length Explanation
Number of Zeros word Number of Zeros Real and Imaginary pairs.
Number of Poles word Number of Poles Real and Imaginary pairs.
The following are repeated Number of Zeros times
Zeros - Real Number double Zero Real Number.
Zeros - Imaginary Number double Zero Imaginary Number.
The following are repeated Number of Poles times
Poles - Real Number double Poles Real Number.
Poles - Imaginary Number double Poles Imaginary Number.

SeedInfo Structure:

Structure Length: 8 bytes

Field Name Type / Length Explanation
Network 4 bytes  2 character NULL terminated string. Byte 4 should be NULL.
Location 4 bytes  2 character NULL terminated string. Byte 4 should be NULL.

Volume File:

A volume file would contain one or more PSN Type 4 event records. 

Field Name Type / Length Explanation
Volume ID and Version 10 bytes Contains the following characters: "PSNVOLUME1".
Number Event Records word Number of event records in the volume file.
Event records....  Variable   One or more event records follow the 12 byte header. 

Structure Types Lengths:

Type Length Explanation
byte 8 bits Unsigned 8 bit integer or ASCII character.
short 2 bytes Signed 16 bit integer in PC (Intel) byte order.
word 2 bytes Unsigned 16 bit integer in PC (Intel) byte order.
long 4 bytes Signed 32 bit integer in PC (Intel) byte order.
float 4 bytes IEEE format floating point number in PC (Intel) byte order.
double 8 bytes IEEE format double in PC (Intel) byte order.

Update History:


Larry Cochrane, Redwood City, PSN