| Class: traceMagneticFieldService | traceMagneticFieldService.py | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
traceMagneticFieldService is web service that allows access to the madrigal._Madrec.pyTraceMagneticField method.Like all my python cgi scripts, traceMagneticFieldService 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 getInstruments via the web Input cgi arguments:
year
month
day
hour
min
sec
inputType (0 for geodetic, 1 for GSM)
outputType (0 for geodetic, 1 for GSM)
The following parameter depend on inputType:
in1 - a comma-separated list of geodetic altitudes or ZGSMs of starting point
in2 - a comma-separated list of geodetic latitudes or XGSMs of starting point
in3 - a comma-separated list of longitude or YGSM of starting point
Length of all three lists must be the same
model - 0 for Tsyganenko, 1 for IGRF
qualifier - 0 for conjugate, 1 for north_alt, 2 for south_alt, 3 for apex, 4 for GSM XY plane
stopAlt - altitude in km to stop trace at, if qualifier is north_alt or south_alt.
If other qualifier, this parameter is not required.
Returns comma-delimited data, one line for point in in lists:
If error, returns error description Change history: Written by Bill Rideout Dec. 10, 2004
|