Table of Contents

Class: madCalculator3Service madCalculator3Service.py

madCalculator3Service is a class that runs the Madrigal derivation engine for an array of times and random array of points in space.

Like all my python cgi scripts, madCalculator3Service 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.

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 madCalculator3 via the web

This script differs from madCalculator2Service in that it allows multiple times to be run at once.

Input cgi arguments:

  1. year - a comma-separated list of years - (required)

  2. month - a comma-separated list of months - (required)

  3. day - a comma-separated list of days - (required)

  4. hour - a comma-separated list of hours - (required)

  5. min - a comma-separated list of minutes - (required)

  6. sec - a comma-separated list of seconds - (required)

  7. numPos - a comma-sepatated list of the number of positions for each time - (required)

  8. lats - a comma-separated list of geodetic latitudes, -90 to 90 (required). Listed for first time, then second, etc. Total must be equal to the sum of numPos.

  9. longs - a comma-separated list of longitudes (required) Listed for first time, then second, etc. Total must be equal to the sum of numPos.

  10. alts - a comma-separated list of geodetic altitudes in km (required) Listed for first time, then second, etc. Total must be equal to the sum of numPos.

  11. parms - comma delimited string of Madrigal parameters desired (required)

  12. oneD - string in form <parm>,<comma-separated values> This argument allows the user to set any number of one-D parameters to be used in the calculation. Value must be parameter name, comma, list of values as double, where length of list is equal to number of times. Example: &oneD=kinst,31.0,31.0&oneD=elm,45.0,50 (optional - 0 or more allowed)

    1. twoD=<parm>,<values> (optional - 0 or more allowed) This argument allows the user to set any number of two-D parameters to be used in the calculation. Value must be parameter name, comma, comma-separated values. Number of values must equal the sum of numPos. Order is first time values first, then second time values, etc Example: twoD=te,1000,1100,1200,1000,1100,1200 &twoD=ti,1000,1000,1000,1000,1000,1000 where numPos=3,3

Returns comma-delimited data, one line for each location. Separate times are delimited by line

Time MM-DD-YYYY HH:MM:SS

Data lines have the following fields:

  1. latitude 2. longitude 3. altitude 4. Values for each Madrigal parameter listed in argument parms, separated by whitespace

Now directly calls madrigal._Madrec methods, because of problems with calling a separate command with a long command line.

If error, returns error description

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

Methods   
__init__
createObjects
madCalculator3
setScriptState
  __init__ 
__init__ ( self )

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

Inputs: None

Returns: void

Affects: Outputs madCalculator3.py data as a service.

Exceptions: None.

  createObjects 
createObjects ( self )

  madCalculator3 
madCalculator3 ( self )

Exceptions   
ValueError, 'length of alts not equal to total positions'
ValueError, 'length of lats not equal to total positions'
ValueError, 'length of longs not equal to total positions'
ValueError, 'not all time lists have same length'
ValueError, 'number of positions list length does not match number of times'
ValueError, 'wrong number of values in %s' %( oneD )
ValueError, 'wrong number of values in %s' %( twoD )
  setScriptState 
setScriptState ( self )


Table of Contents

This document was automatically generated on Mon Aug 9 13:18:41 2010 by HappyDoc version r1_5