Difference between revisions of "Accessing CyberShake Duration Data"
Line 42: | Line 42: | ||
== Reading duration data from files == | == Reading duration data from files == | ||
− | Duration files consist of the standard CyberShake header (detailed [[CyberShake_output_data_headers#Duration_header|here]]), followed by a 4-byte integer containing the number of duration records to follow. | + | Duration files consist of the standard CyberShake header (detailed [[CyberShake_output_data_headers#Duration_header|here]]), followed by a 4-byte integer containing the number of duration records to follow, followed by the individual duration records. |
Each duration record has the following structure (in C): | Each duration record has the following structure (in C): | ||
Line 53: | Line 53: | ||
}; | }; | ||
</pre> | </pre> | ||
+ | |||
+ | The 'type' is one of the following integers, as defined in C: | ||
+ | <pre> | ||
+ | #define ARIAS_INTENSITY 0 | ||
+ | #define ENERGY_INTEGRAL 1 | ||
+ | #define CAV 2 | ||
+ | #define DV 3 | ||
+ | #define DA 4 | ||
+ | </pre> | ||
+ | |||
+ | The 'type_value' is defined for types DV and DA. This takes one of the following integers from the C definition: | ||
+ | <pre> | ||
+ | #define D5_75 5 | ||
+ | #define D5_95 6 | ||
+ | #define D20_80 7 | ||
+ | </pre> | ||
+ | |||
+ | The 'component' can either by X or Y, defined as: | ||
+ | <pre> | ||
+ | #define X_COMP 0 | ||
+ | #define Y_COMP 1 | ||
+ | </pre> | ||
+ | |||
+ | Overall, then, the file format is: | ||
+ | <pre> | ||
+ | <header for 1st rupture variation> | ||
+ | <number of records R as a 4-byte integer> | ||
+ | <record 1> | ||
+ | <record 2> | ||
+ | ... | ||
+ | <record R> | ||
+ | <header for 2nd rupture variation> | ||
+ | ... | ||
+ | </pre> | ||
+ | |||
+ | Note that neither the rupture variations, nor the individual duration records, are required to be in any particular order. |
Revision as of 15:48, 24 October 2017
This page details how to access CyberShake duration data.
Duration data is a relatively new addition to the CyberShake codebase, starting with Study 15.12.
Contents
Types of duration data
In CyberShake, we calculate the following duration metrics, independently for the X and Y components:
- Energy integral (integral of the velocity squared)
- Signification durations for 5-75%, 5-95%, and 20-80% for velocity
- Arias intensity (pi/2g times the integral of the acceleration squared)
- Signification durations for 5-75%, 5-95%, and 20-80% for acceleration
- Cumulative absolute velocity (CAV) (integral of the absolute value of the acceleration).
A reference document for these formulas is available here: File:durationMetrics.docx.
Accessing database data
We have only populated the database for Study 15.12. For Study 17.3, duration data is only available on the filesystem.
For Study 15.12, the database contains duration data for the 8 metrics that users requested quick access to. For both the X and Y component:
- Significant duration, 5-75%, velocity
- Significant duration, 5-95%, velocity
- Significant duration, 5-75%, acceleration
- Significant duration, 5-95%, acceleration
Details about accessing this data are available at Accessing CyberShake Database Data.
Accessing file data
To access duration data which is not in the database, you must use the files on disk.
Using the retrieval script
The easiest option is to use the retrieval script at /home/scec-02/cybershk/utils/retrieve_duration.py . This script takes the run ID, source ID, rupture ID, rupture variation ID, output file, and a flag to include the header information in the output.
Finding files by hand
If you need to find files by hand, you should follow the same instructions as for finding seismogram files by hand, given here: Accessing_CyberShake_Seismograms#Locating_Seismogram_Files_by_Hand. For duration files, the filename convention is Duration_*.dur. All Duration files are in the 'new' format, and can be found in the /home/scec-04/tera3d/CyberShake/data/PPFiles/<site>/<runID> root.
Reading duration data from files
Duration files consist of the standard CyberShake header (detailed here), followed by a 4-byte integer containing the number of duration records to follow, followed by the individual duration records.
Each duration record has the following structure (in C):
struct duration_record { int type; int type_value; int component; float value; };
The 'type' is one of the following integers, as defined in C:
#define ARIAS_INTENSITY 0 #define ENERGY_INTEGRAL 1 #define CAV 2 #define DV 3 #define DA 4
The 'type_value' is defined for types DV and DA. This takes one of the following integers from the C definition:
#define D5_75 5 #define D5_95 6 #define D20_80 7
The 'component' can either by X or Y, defined as:
#define X_COMP 0 #define Y_COMP 1
Overall, then, the file format is:
<header for 1st rupture variation> <number of records R as a 4-byte integer> <record 1> <record 2> ... <record R> <header for 2nd rupture variation> ...
Note that neither the rupture variations, nor the individual duration records, are required to be in any particular order.