Geopsy: Waveform Command Line

From GeopsyWiki
Revision as of 17:18, 30 June 2009 by Marc (talk | contribs) (New page: All the scripts that can be executed in Geopsy:Waveform Console can be also processed through the command line interface. geopsy -waveform scriptfile.qs input_file.mseed For instan...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

All the scripts that can be executed in Geopsy:Waveform Console can be also processed through the command line interface.

 geopsy -waveform scriptfile.qs input_file.mseed

For instance, this command does the following tasks:

  • Import file "input_file.mseed"
  • Execute all actions listed in "scriptfile.qs"

To save the results, the script must end with an 'export command:

 [...] // Some processings come here
 exportFile("output_file.sac", "SAC");

Input and output formats for signal files are of course any of the supported file formats for input and output.

 geopsy -export-formats
 geopsy -import-formats

These two commands list the supported file formats on input and output.

"scriptfile.qs" can contain any series of command specified in Geopsy:Waveform Scripting Language.

Setting header information of ascii files

Ascii files does not refer to a particular format. It describes the encoding of each character other option can be: ASCII, UNICODE, UTF8, UTF16,... Hence, text file might have arbitrary format. This is particularly true for organizing header information where absolutely no standard exists. For the signal samples this less the case. They are usually organized in various columns or in several bunch of data separated by special characters (see Geopsy:Supported file Formats for details.

The annoying thing with these kind of files is that you cannot automatically convert or process them in a script. This can be solved by using a script for setting the basic header information upon loading the files.

 geopsy -waveform setheader.qs input_file.txt

"setheader.qs' might contain these commands for a text file with three components:

 setHeader(0, "DeltaT", 0, 0.01);
 setHeader(1, "DeltaT", 0, 0.01);
 setHeader(2, "DeltaT", 0, 0.01);
 exportFile("output_file.sac", "SAC");
 $ geopsy tmp/text_file -waveform setheader.qs
 -----INFO----- Loading ASCII Columns----
 The ASCII format without header imply that you fill in the correct information yourself in a table. Choose menu "view/new table" and change the DeltaT (inverse of the sampling frequency) to allow correct plotting in a graphic
 tmp/text_file
 File tmp/output.mseed already exists, saving to /home/mwathele/tmp/output.mseed

Once converted to miniseed, the sampling frequency is properly set and the files can be handled in a much easier way. Scripting language support loop, conditions, classes,... hence, theoretically one can build a more complex script that can adapt itself to heterogeneous conditions (e.g. varying number of input files). TODO: examples should be given in this document.