Table of Contents

Class: getExperimentsService getExperimentsService.py

getExperimentsService is the class that allows remote access to the getExperiments.py script.

Like all my python cgi scripts, getExperimentsService has the following structure: the entire cgi is contained in one class, with a main function at the end which serves simply to call the __init__ function of the class. This __init__ function is responsible for calling all other class methods. It is made up of a single try block, with the purpose of reporting all exceptions in well-formatted text to both the user and the administrator. The __init__ function first makes sure the pythonlib can be found. It then calls setScriptState to validate the the cgi arguments, which are simply the arguments for the isprint command.

If any uncaught exception is thrown, its caught by the __init__ try block. If its an MadrigalError, additional information is available. The catch blocks attempt to display the error message on the screen by backing out of of large number of possible tags, which might prevent its display (in any case, the error message will always be available in the page source. The formatted error message is also sent to the email address given in the siteTab.txt metadata file.

This script is not meant to be used directly by a user, and thus is named Service. It is meant to be used by scripting languages such as Matlab that want to call getExperiments via the web

Input cgi arguments:

  1. code - int representing instrument code. Special value of 0 selects all instruments. More than one allowed.

  2. startyear - int

  3. startmonth - int

  4. startday - int

  5. starthour - int

  6. startmin - int

  7. startsec - int

  8. endyear - int

  9. endmonth - int

  10. endday - int

  11. endhour - int

  12. endmin - int

  13. endsec - int

  14. local - 1 if local experiments only, 0 if all experiments

Returns comma-delimited data, one line for each experiment, with the following fields:

  1. experiment.id (int) Example: 10000111

  2. experiment.url (string) Example: http://www.haystack.mit.edu/cgi-bin/madtoc/1997/mlh/03dec97

  3. experiment.name (string) Example: Wide Latitude Substorm Study

  4. experiment.siteid (int) Example: 1

  5. experiment.sitename (string) Example: Millstone Hill Observatory

  6. experiment.instcode (int) Code of instrument. Example: 30

  7. experiment.instname (string) Instrument name. Example: Millstone Hill Incoherent Scatter Radar

  8. experiment.start year (int) year of experiment start

  9. experiment.start month (int) month of experiment start

  10. experiment.start day (int) day of experiment start

  11. experiment.start hour (int) hour of experiment start

  12. experiment.start minute (int) min of experiment start

  13. experiment.start second (int) sec of experiment start

  14. experiment.end year (int) year of experiment end

  15. experiment.end month (int) month of experiment end

  16. experiment.end day (int) day of experiment end

  17. experiment.end hour (int) hour of experiment end

  18. experiment.end minute (int) min of experiment end

  19. experiment.end second (int) sec of experiment end

  20. experiment.isLocal (int) 1 if local, 0 if not

Call script getExperiments.py.

If error, returns error description

Change history:

Written by Bill Rideout Dec. 11, 2003

$Id: getExperimentsService_getExperimentsService.py.html 3304 2011-01-17 15:25:59Z brideout $

Methods   
__init__
createObjects
getExperiments
setScriptState
  __init__ 
__init__ ( self )

__init__ run the entire getExperimentsService script. All other functions are private and called by __init__.

Inputs: None

Returns: void

Affects: Ouputs getInstrument data as a service.

Exceptions: None.

  createObjects 
createObjects ( self )

  getExperiments 
getExperiments ( self )

  setScriptState 
setScriptState ( self )


Table of Contents

This document was automatically generated on Thu Jan 19 13:26:16 2006 by HappyDoc version r1_5