wip This documentation is very incomplete...


A namespace (from gaia.js) containing some basic GAIA variables and functions:

gaia.arrayIntersect((a, b, func)
test if two arrays (a and b) intersect, that is, if any of the contents are equal. An optional comparison function can be given, otherwise the normal comparison operator is used ("=="). Returns a boolean value.
convert an array to any object.
Deep-clone an object or array.
a boolean value of the state of the debug mode, used by debuglog(). Can be set from the JavaScript console to enable/disable debugging mode. If the query parameter debug is set to a true value in the URL then debug mode is also enabled.
if debugging mode is enabled certain debugging information is printed to the JavaScript console using gaia.log().
send error messages to the JavaScript console if window.console.error() exists. $ getAbsoluteElementOffset():
$ getStyle():
test if an object is an array.
send information messages to the JavaScript console if window.console.log() exists. $ gaia.rot13(): $ gaia.unique(): $ gaia.unwrapCookies():
send warning messages to the JavaScript console if window.console.warn() exists.


The GAIA web services namespace (from gaia.js) is responsible for downloading metadata using the GAIA web services and making it available to GAIA JavaScript functions. It contains a number of classes


A class holding the details of a GAIA data channel. It has the following public accessor functions:

  • getAttribution()
  • getChannelType()
  • getDataRequestUrls()
  • getDbid()
  • getEndTime()
  • getKeogramDataLocations()
  • getKeogramUrl()
  • getLabel()
  • getPalette()
  • getProject()
  • getProjectDbid()
  • getStartTime()
  • getStation()
  • getStationDbid()
  • getSummaryDataLocations()
  • getSummaryDataUrl()
  • getThumbnailDataLocations()
  • getThumbnailUrl()
  • getUrls()
  • hasKeograms()
  • hasSummaryData()
  • hasThumbnails()
  • toString()
  • wasOperating()

Most of these functions are self-explanatory. URLs are strftime() format strings.










A class holding the details of a location, as used by the gaiaWS.Node and gaiaWS.Station classes. It has the following public accessor functions:

* getCountry()
* getLatLon()
* getLatitude()
* getLongitude()
* getPlacename()
* getState()
* toString()

State is also used for provinces (e.g, for locations in Canada).





A class holding the details of a GAIA project. A project has one of more stations, represented by the class gaiaWS.Channel, from where data is recorded. It has the following public accessor functions:


A class holding the details of a GAIA station, each station belongs to one GAIA project, represented by the class gaiaWS.Project. Within a given project stations and their abbreviations are unique, however stations belonging to different projects may have the same abbreviation and even identical coordinates. Each station has one or more data channels, represented by the class gaiaWS.Channel. It has the following public accessor functions:

  • getAbbreviation()
  • getChannels()
  • getDbid()
  • getLatLon()
  • getLatitude()
  • getLocation()
  • getLongitude()
  • getProject()
  • getProjectDbid()
  • isStaticLocation()
  • toString()


The gaiaViewer namespace (from gaia_viewer.js) is responsible for providing access to the functionality of the main viewer program. (Do not confuse it with the viewer,js script which is responsible for initialising the viewer window.) The gaiaViewer namespace contains a number of important variables relating to the viewer:

An object holding the current state of the viewer and its tool windows. Functions may read this object but must not change it directly, use gaiaViewer.updateState() instead. The object contains a number of properties which are described in more detail below:
an object of the class gaiaWS.ChannelOrder, indicating how the selected channels are ordered.
an array of objects of the class gaiaWS.Channel. The array is ordered according to channelOrder. Used in situations where multiple channels are displayed (e.g., when the main viewer window is in overview mode).
A string indicating the display mode of the main viewer window. Valid modes are: overview and detailedView.
an object of the class gaiaWS.Orientation, indicating how images and keograms are to be displayed.
an object of the class gaiaWS.Palette, indicating the colour palette used for greyscale images. See also SummaryPlotRequirements#Colour_palettes
an object of the class gaiaWS.Channel. Used in situations where only one channel is displayed (e.g., when the main viewer window is in detailed view mode). selectedChannel must be in the channels array.
the time for which images are displayed. In overview mode keograms are displayed from the entire day, in detailed view mode thumbnail images are displayed for the selected time.
An object holding the previous state of the GAIA viewer, see gaiaViewer.state for more information about the object properties.
A reference to the toolbox window. The reference may be null if the window has not be opened, otherwise it may refer to a window which has since been closed, use the closed property to check.

The namespace also contains some important functions for interacting with the viewer:

This function should not be called directly by user programs. It is responsible for executing the callback functions in response to state changes.
Open the toolbox window. Usually called in response to GUI events.
gaiaViewer.registerCallback(window, cbFunc, states, cbFuncName)
Register a callback function to be executed whenever selected state properties change. The function takes the following arguments:
reference to the window in which the callback should operate. If window is closed the callback function is automatically unregistered.
reference to the callback function. The function should accept a single argument, an object whose property names are the state properties which changed, and the property values are the new values for those properties.
an array listing the state properties to be monitored for changes. See gaiaViewer.state for a description of the properties. In addition, date may be specified to monitor only changes to time which result in a change of date.
the name of the callback function. For anonymous callback functions pass a descriptive name. Used for debugging purposes.
Function to modify the current state. Its single argument is an object holding the state properties to be modified, where the object property names are the viewer state properties which should be altered and the object property values are the new values for those viewer properties. When calling gaiaViewer.updateState() do not include unchanged state properties.
Topic revision: r1 - 2010-02-05 - 12:43:36 - SteveMarple
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback