Difference between revisions of "Accessing CyberShake Seismograms"

From SCECpedia
Jump to navigationJump to search
Line 38: Line 38:
 
Inside that directory you will see 1 of 2 possibilities -- we changed our file format about a year ago, so we have data in both formats.
 
Inside that directory you will see 1 of 2 possibilities -- we changed our file format about a year ago, so we have data in both formats.
  
# In the older format, the directory will contain a number (10-80) of Seismogram*.zip files.  One of these zip files has the seismogram you want, but there's no straightforward way to tell.  I recommend running the following from the command line (in bash):
+
a)In the older format, the directory will contain a number (10-80) of Seismogram*.zip files.  One of these zip files has the seismogram you want, but there's no straightforward way to tell.  I recommend running the following from the command line (in bash):
  
 
for i in `ls *_seismograms.zip`; do echo $i; unzip -l $i | grep Seismogram_<site>_<sourceID>_<ruptureID>_<ruptureVariationID>.grm; done
 
for i in `ls *_seismograms.zip`; do echo $i; unzip -l $i | grep Seismogram_<site>_<sourceID>_<ruptureID>_<ruptureVariationID>.grm; done
Line 59: Line 59:
 
unzip <zip file> <seismogram file> .
 
unzip <zip file> <seismogram file> .
  
# If the seismograms are in the newer format, then there's a different approach.  You'll know because the directory will contain several thousand Seismogram_*.grm files.  The one you want is Seismogram_<site>_<sourceID>_<ruptureID>.grm, with whatever source ID and rupture ID you are interested in seismograms for.
+
b)If the seismograms are in the newer format, then there's a different approach.  You'll know because the directory will contain several thousand Seismogram_*.grm files.  The one you want is Seismogram_<site>_<sourceID>_<ruptureID>.grm, with whatever source ID and rupture ID you are interested in seismograms for.
  
 
3) Once you have your seismogram file, the last step is to read the data.  It's velocity data, in cm/s, with dt = 0.1 seconds.
 
3) Once you have your seismogram file, the last step is to read the data.  It's velocity data, in cm/s, with dt = 0.1 seconds.

Revision as of 15:23, 23 May 2014

The seismograms are available on SCEC servers. There are three steps involved in accessing the seismograms:

1) Determine which seismograms are of interest 2) Find the seismogram file 3) Read the seismogram data

1) The first step is to figure out which seismograms are of interest. To do this, you'll need to know a) the site and run ID of the CyberShake run, and b) the source id, rupture id, and rupture variation id of the seismogram. You may have done this already. If not, you can determine the run ID by using MySQL to query the CyberShake database on focal.usc.edu. To determine a run ID, you will need to know values for a few parameters, such as the ERF, the velocity model, and the rupture variation generator version. Here's a sample query:

select R.Run_ID from CyberShake_Runs R, CyberShake_Sites S
where S.CS_Short_Name="LADT"    //Replace this with the site you want
and R.Site_ID=S.CS_Site_ID
and R.ERF_ID=35                 //35 corresponds to UCERF 2.  You'll always want to use this.
and R.SGT_Variation_ID=5        //This is the code used to generate the SGTs.  5 = Rob Graves' code.  6 = AWP-ODC.  7 = a newer, revised version of the Graves code.
and R.Rup_Var_Scenario_ID=4     //This is the code used to generated the rupture variations.  3 = Graves & Pitarka 2007.  4 = Graves & Pitarka 2010.  You'll probably want to  use 4.
and R.Velocity_Model_ID=1       //This is the velocity model.  1 = CVM-S4.  2 = CVM-H v11.2.  4 = CVM-H v11.9.
and (R.Max_Frequency=0.5 or R.Max_Frequency is null)    //This selects only deterministic (0.5 Hz) runs.  If you wanted only runs that include the stochastic high-frequency components, you would change this to "R.Max_Frequency=10.0"
and R.Status="Verified";        //This means the run completed successfully

From this you should be able to get a run ID.

From an SRF file, you already have the source ID and run ID. The difference between rupture variations is the hypocenter locations and the slip distributions. The hypocenter locations are in the database, so you can look at them with a query like:

select Rup_Var_ID, Hypocenter_Lat, Hypocenter_Lon, Hypocenter_Depth from Rupture_Variations
where ERF_ID=35
and Source_ID=0
and Rupture_ID=0;

To understand the different slips, the easiest thing to do is to plot them.

2) Once you have a run ID and a specific seismogram, the next step is to find the file on disk. There are a couple of places to check.

There is a directory on the SCEC servers which corresponds to the specific run ID. It will be in one of:

/home/scec-04/tera3d/CyberShake/data/PPFiles/<site>/<runID>
/home/scec-04/tera3d/CyberShake/data/from_scec-02/PPFiles/<site>/<runID>
/home/scec-02/tera3d/CyberShake2007/data/PPFiles/<site>/<runID>

Inside that directory you will see 1 of 2 possibilities -- we changed our file format about a year ago, so we have data in both formats.

a)In the older format, the directory will contain a number (10-80) of Seismogram*.zip files. One of these zip files has the seismogram you want, but there's no straightforward way to tell. I recommend running the following from the command line (in bash):

for i in `ls *_seismograms.zip`; do echo $i; unzip -l $i | grep Seismogram_<site>_<sourceID>_<ruptureID>_<ruptureVariationID>.grm; done

When you run it, you'll get output like:

CyberShake_LADT_749_3_seismograms.zip
CyberShake_LADT_749_40_seismograms.zip
CyberShake_LADT_749_41_seismograms.zip
CyberShake_LADT_749_42_seismograms.zip
24000  02-11-2011 19:34   Seismogram_LADT_128_1100_0.grm
CyberShake_LADT_749_43_seismograms.zip
CyberShake_LADT_749_44_seismograms.zip
CyberShake_LADT_749_45_seismograms.zip

So that would tell you that file Seismogram_LADT_128_1100_0.grm is in CyberShake_LADT_749_42_seismograms.zip.

Once you've IDed the zip file, you can extract the seismogram you want by:

unzip <zip file> <seismogram file> .

b)If the seismograms are in the newer format, then there's a different approach. You'll know because the directory will contain several thousand Seismogram_*.grm files. The one you want is Seismogram_<site>_<sourceID>_<ruptureID>.grm, with whatever source ID and rupture ID you are interested in seismograms for.

3) Once you have your seismogram file, the last step is to read the data. It's velocity data, in cm/s, with dt = 0.1 seconds.

If the file is in the older format (you can tell because the filename is Seismogram_<site>_<sourceID>_<ruptureID>_<ruptureVariationID>.grm), the data is stored in binary format as:

<3000 4-byte floats - X component seismogram>
<3000 4-byte floats - Y component seismogram>

If you run "od -f <seismogram file> | more" you can see the values. I'm not sure what your plans are ultimately for the seismogram data, but you may wish to write a small C or Python code to read the data out of the file so that you can process it.

If the file is in the newer format (filename Seismogram_<site>_<sourceID>_<ruptureID>.grm), all the rupture variations for a single rupture are in the same file. The format is (binary, again):

<Rupture Variation 1 header>
<Rupture Variation 1, X component - 3000 4-byte floats>
<Rupture Variation 1, Y component - 3000 4-byte floats>
<Rupture Variation 2 header>
<Rupture Variation 2, X component - 3000 4-byte floats>
<Rupture Variation 2, Y component - 3000 4-byte floats>
...
<Rupture Variation n header>
<Rupture Variation n, X component - 3000 4-byte floats>
<Rupture Variation n, Y component - 3000 4-byte floats>

Where this gets tricky is that the rupture variations are not necessarily in order in the file. So you will have to read the header data to find the rupture variations you are interested in.

The format of the headers is outlined here (access with your SCEC computing login). I recommend writing a simple C code to read and parse the headers, and I can point you to some examples if that would be helpful. Once you've found the rupture variation you're interested in, you can then read in the data and do some processing.