Workflow examples - geoscience-community-codes/GISMO GitHub Wiki
In this example we:
- load multiple event files (in this case, SAC files) into MATLAB as waveform objects
- extract from a waveform object to create another waveform object
- cross-correlate waveform objects
- plot our aligned waveform objects
Workflow example 2
Load events from a Seisan database into a Catalog, and add waveform objects
- Create a variable that gives the path to the Seisan REA directory and the database where the S-files are stored:
dbpath = '/raid/data/Montserrat/MontserratSeismicMastering/seisan/REA/MVOE_';
- Specify start and end dates/times (here we just load one day):
startt = datenum(1996,11,1);
endt = datenum(1996,11,2);
- Load the S-files into a Catalog object:
cobj = Catalog.retrieve('seisan','dbpath',dbpath,'startTime', startt,'endTime', endt);
Note this actually creates a Seisan_Catalog object, which can do everything a Catalog object does, but has a few extra methods too.
- See the available properties - these are the variables that are part of a Seisan_Catalog object:
properties(cobj)
This includes all the usual properties like otime (origin time), lat, lon, depth, mag, mag_type (e.g. mb), etype (event type) & numberOfEvents. In addition, ontime and offtime store the beginning and end time of the waveform file belonging to that event. sfilepath stores the path to the S-file, wavfilepath stores the path(s) to the corresponding waveform files. arrivals store phase arrivals loaded from the S-files as GISMO Arrival objects. Since there will be many arrivals per event, and there are many events per Catalog, arrivals is a cell array (one element per event) of Arrival objects (each Arrival object can store all arrivals for one event). wavfilepath is similarly a cell array (1 element per event) of cell arrays (1 element per waveform file).
- See the available methods - these are built-in functions you can apply:
methods(cobj)
There are about 30 methods in total. Here we will look at eev and addwaveforms.
- eev works in a similar way to the Seisan program of the same name. To start it, type:
cobj.eev()
or
eev(cobj)
These are functionally equivalent, but the first is in object-oriented style, the latter in the normal MATLAB style.
eev allows you to move through the list of events one at a time. Typing 'h' will show all options. 'S' will show the corresponding S-file. 'P' will plot the corresponding waveform file(s). You can jump to any time with t followed by the year, month, day, hour etc.
- addwaveforms will attach the waveform files to the Catalog. Again, there are two ways to do this:
cobj.addwaveforms()
or
addwaveforms(cobj)
Note that if you have a lot of events and/or a lot of channels, adding waveforms can be really slow.
- Now you can save the entire Catalog - including arrivals & waveforms, to MAT-files for fast loading next time:
save mycatalog.mat cobj
Note, this might be too slow or you might not have enough memory if your Catalog & set of waveform files is large, so break it up into pieces - the subset method is useful here, e.g. help Catalog/subset.