Observatories and Research Facilities for EUropean Seismology
Volume 1, no 3 October 1999 Orfeus Newsletter


Java for the Seismologist

Anthony Lomax
UMR Geosciences Azur, 250 Rue Albert Einstein, bat 4, 06560 Valbonne, France

Introduction - Advantages - Drawbacks - Perspectives - Getting started

Introduction

Java is an object-oriented, platform-independent, internet-ready programming language. What does this provide for a seismologist?

Object-oriented software is strictly modularised, this simplifies and speeds up the development, maintenance, updating and re-use of code. In Java and other object based languages this modularity is implemented through the class - a collection of data structures and operations on this data. A class usually represents a real or conceptual entity, such as a seismogram, a time pick or an earthquake location. Within a software package, a realisation of a class is an object. The object is accessed through a limited, well defined set of functions and variables, the details of the data storage and inner workings of the object are not visible. An object is thus a sealed "black-box" with only certain "wires", "buttons" and "displays" accessible. This encapsulation allows the rapid and easy use or re-use of the object in new code, and allows the inner workings and capabilities of the class to be modified or extended without the need for updating existing code that uses the objet.

For seismology the object-oriented Java language allows the definition, implementation and distribution of, for example, a standard set of "seismological" classes and collections of classes. There is also a multitude of ready to use Java classes freely available on the internet for a wide and rapidly growing number of computational, mathematical and visualisation tasks (see the ORFEUS Java software page for links). A seismologist could use these software modules to rapidly create new programs, and can easily re-use and exchange parts or all of any Java software that incorporates these classes. An effort to define seismological classes is included in the ongoing FISSURES initiative of the IRIS Data Management System, which is described in a companion article.

Java is platform-independent and portable because its class source files are compiled only to unique, machine independent byte-code. When run on a specific machine, the byte-code for required classes are further compiled to the corresponding machine code. Because it is platform-independent and portable, Java software can be run on almost any hardware and operating systems - UNIX, Linux, Windows, Sun, PC, Macintosh, ... And this platform independence includes an extensive, easy to use set of graphical user interface and visualisation classes. Thus seismologists can develop and use Java software on their available or preferred systems, and can distribute the compiled Java byte-code for use on any other system. This makes valuable research and teaching software available to the whole seismological community for immediate use, without the complications and time required to obtain, modify and recompile source code for each system. Platform independent Java software currently available includes the TauP Toolkit a seismic travel time calculator from the University of South Carolina, RayGUI Interactive Ray-Tracing from the USGS, and JPitsa from the Synapse Science Center, Moscow. More Java programs can be found on the ORFEUS Java software page.

Java is internet-ready because it incorporates the functionality and security to allow file access, data exchange, distributed computing, and many other operations over the internet. Java also supports the use of "applets" - Java programs which reside on a server but which are transferred over the internet to run through a web browser on a local system. These capabilities will greatly improve the ease, speed and flexibility of distributing and obtaining seismological data, even in near real-time and from remote stations. But the internet features of Java also allow new possibilities for more active and comprehensive use of seismological information in research, teaching and public information. For example, digital seismograms can be interactively selected, viewed and processed with a few clicks of the mouse from a web site, without the need, time or complications of downloading the data, converting data formats and of obtaining, installing and maintaining compatible analysis software. Such Java applet based seismogram analysis is already available through the Seismo Cam of the USGS/CIT Southern California Seismographic Network, the Seismogram Viewer used under the ORFEUS WILBER interface for accessing SPYDER® data, or Seismic View from the Institute of Geophysics, Ukraine. Other seismological applets include a seismic alarm and seismicity display from the USGS. Existing educational applets include those at the Geophysics Department TU Clausthal Learning with JAVA Applets site and the Digital Seismology Tutor from the University of Potsdam, Institute of Earth Sciences. More Java applets can be found on the ORFEUS Java software page.

What are other advantages of Java?

Java is now one of the major computing languages. It is used for an immense range of tasks in the computing, commercial, teaching and research worlds.

The Java language development toolkit (standard classes, documentation, compiler and other utilities) and advanced class packages are avalaible free from Sun. Many other classes, programs and development tools are available free or commerically over the web.

The comprehensive set of classes available with Java and from third parities make it a powerful and easy to use language for many tasks, including visualisation, image processing, educational and interactive projects, data and database manipulation, and general utility programs.

What are the drawbacks of Java for seismologists?

At the moment Java is not as fast as native compiled FORTRAN, C or C++ for repeated, low level operations or for number crunching. Thus it may not be a good choice for high performance visualisation or for mathematically intensive codes. But this may change in the next few years as the Java interpreter-compilers on specific machines become more sophisticated in the use of hardware capabilities and in on-the-fly code optimisation. And already Java can make calls to native functions written in C, though this option looses platform independence. It is possible that Java will soon only be a poor choice for extremely CPU intensive number crunching.

There is also a very large conceptual difference between procedural languages like FORTRAN and C and object-oriented languages like Java and C++. Java is an elegant, relatively simple and well thought out language, and can be learned rapidly. However, designing and producing truly object-oriented software is very difficult from working with "procedural" languages like FORTRAN and C. Learning Java will be relatively easy and enjoyable for those with formal training in object-oriented design and programming techniques. But it is also accessible to those without object-oriented experience because of the widespread use of Java and easy access to documentation.

Where might we go with Java software?

After an earthquake occurs, Java software could actively locate and access trace, event, and macroseismic data over the internet in near real-time from regional and global data centres, seismic networks or individual stations. Filter-interfacing objects would transparently handle the conversion of the data from a heterogeneous set of formats to a set of standard seismological objects. This data could be immediately displayed, processed and analysed, interactively or automatically. Further filter object could present different displays and possible actions on the data to support the needs of different users - station networks (for quality control, event location), seismologists (for preliminary analysis of data from multiple sources and rapid assessment of seismic hazard), and other interested parties with basic or limited seismological knowledge (emergency management specialists, schools, public).

For a researcher, the use of Java, standard seismological classes and the internet opens up completely new ways of working. For example, while reading an article which contains a methodology or algorithm of interest, a researcher could obtain the relevant software over the Internet, and then apply it to their own data set - all within a few minutes, and independently of the type of computing systems and local data formats used by the author of the article or the researcher. Two or more researchers in different laboratories could simultaneously examine, interact with and discuss a sophisticated visualisation of the results of some calculation.

How can a seismologist get started with Java?

Read the What is Java and the Java Tutorial web pages from Sun. Look at the other pages under java.sun.com, or at other Java general information sources on the ORFEUS Java software page.

Try the Java applets and programs listed above or others on the ORFEUS Java software page, and make contact with the authors. (If Java is not already installed on your system, you can download and install the Java SDK from Sun. This is the Java Software Development Ket which allows you run exsiting stand alone Java applications, and to write your own Java applets and applications. If you want to write applets, it may be best to use JDK 1.1 as most browsers do not yet support Java 2 SDK. If you only want to run applets though a browser, you do not need to install Java.)

Choose a basic, seismological processing, visualisation or teaching task that interests you and for which you do not have useful software, and try writing a Java program or have another interested colleague write such a program. For your first Java program, it is a good idea to modify an existing Java program that has similar functionality; for this, the demo programs distributed with the Java SDK are a good choice.

Participate in Java and other sofware discussions at seismological meetings, and participate in the proposed ORFEUS Java workshop in Spring, 2000.

page 24
Copyright © 1999. Orfeus. All rights reserved.