wiki:DevDocs

Development Documentation

Structural Overview

SEATREE is an object-oriented platform for teaching and research applications in solid Earth geophysics. The design objectives are to provide a user friendly way of conducting computations and visualizing those while providing clearly structured, open, and transparent access to the computational modules themselves. In this way, code can be reusable for all kinds of different applications, from GUI-driven one-off tests, to script-driven large-scale computations.

At the lowest level, the modules are implemented as C or FORTRAN code that needs to be compiled. On top of that, we use Python scripts to allow for a more flexible command line access, including the creation of visualizations using Generic Mapping Tools (GMT). On top of the command line access, we use PyGTK to create a graphical user interface (GUI). Each module uses pygtk to create a widget which which is automatically loaded into the left panel of the main SEATREE window. Modules can then, through the SEATREE API, display plots in the plot view panel.

For an example of how this is implemented, see the HC python wrapper implementation

Creating Modules for the SEATREE GUI

A modules is simply a python class which extends the Module class (located in python/seatree/modules/module.py).

To create your own module, first look at the simple example module (located in python/seatree/modules/example/exampleModule.py). You can also look at the code of the existing modules.

Each module should also contain a plotter, which extends the Plotter class. The currently available plotters are:

Installing Your Modules

Using the SEATREE Installer (preferred)

To install your module you need to create a configuration file inside the python/conf/install directory. For the ExampleModule, the configuration file should look like this:

<SEATREEConfiguration>
  <modules>
    <module>
      <importName>exampleModule</importName>
      <className>ExampleModule</className>
      <directory>example</directory>
      <installImportName>exampleInstaller</installImportName>
      <installClassName>ExampleInstaller</installClassName>
    </module>
  </modules>
</SEATREEConfiguration>

The <importName> tag is the filename of the your module's main class, so for exampleModule.py it is simply exampleModule. If the module is within the SEATREE package structure, you could enter something like: seatree.modules.example.exampleModule .

The <className> tag is the name of the class that extends Module, ExampleModule in this case.

The <directory> tag is the name of the directory within seatree.modules where your module resides.

The <installImportName> and <installClassName> tags are the same as <importName> and <className> except that they correspond to the installer. If no installer is necessary, just omit these values.

An example installer can be found in python/seatree/modules/example/exampleInstaller.py.

Manual Installation

To manually install a module (useful for development, before the installer has been created) you need to manually edit your SEATREE conf.xml file which is located in the python/conf folder.

If you want the change to only affect your user or don't have write privileges to the SEATREE directory, you can copy the conf.xml file to the .seatree folder created in your home directory (ex: 'cp python/conf/conf.xml ~/.seatree/'). SEATREE will load 1 configuration file, first looking in your home directory, and then defaulting to the main conf.xml file in python/conf if ~/.seatree/conf.xml doesn't exist.

The SEATREE configuration file for an installation with only ExampleModule installed would look like this:

<?xml version='1.0' encoding='UTF-8'?>
<SEATREEConfiguration>
  <modules>
    <module>
      <importName>exampleModule</importName>
      <className>ExampleModule</className>
      <directory>/path/to/seatree/python/modules/example</directory>
    </module>
  </modules>
  <gmtPath/>
</SEATREEConfiguration>

The <importName> tag is the filename of the your module's main class, so for exampleModule.py it is simply exampleModule. If the module is within the SEATREE package structure, you could enter something like: seatree.modules.example.exampleModule.

The <className> tag is the name of the class that extends Module, ExampleModule in this case.

The <directory> tag is the path to the directory containing your module.

SEATREE follows the following procedure to import a module based on this configuration file:

  • Import <importName>
    • If that fails, add <directory> to your python path and try again
  • Create a new instance of <importName>.<className>

Bug reports, feedback, and release history

Last modified 10 years ago Last modified on 08/19/08 14:26:17