disassemble_number $SMEI/ucsd/gen/python/eon_helper.py
[Previous] [Next]
 NAME:
	disassemble_number
 PURPOSE:
	Extract a floating point nuumber from a string
 CALLING SEQUENCE:
	i, f, e = disassemble_number(var, atleast=atleast, exponent=exponent)
 INPUTS:
	var                 input string or number
 OPTIONAL INPUT:
	exponent=exponent	if set then units of the output fraction
	                    are forced to 10^-exponent.
	                    Note that for string input this will lead to loss
	                    of precision if the number of digits in the 
						decimal fraction in the input is larger than the
						value of exponent
	atleast=atleast     minimum number of digits in the integer part
	                    of the number. Default: 0
 OUTPUTS:
	i,f,e               3-element tuple of integer representing
	                    the number extracted:
	                    i: integer part (before the decimal point)
	                    f: fractional part in units of 10^-e
	                    e: sets the units of the fraction f
 EXAMPLES
	>>> disassemble_number0('-4.598',atleast=1)
	(-4L, -598L, 3)
	>>> disassemble_number0('-4.598',atleast=1,exponent=2)
	(-4L, -60L, 2)
	>>> disassemble_number0('-4.598',atleast=1,exponent=5)
	(-4L, -59800L, 5)
 RESTRICTIONS:
	Integer part must have at least one digit.
 PROCEDURE:
	The string is searched for a number representing an integer
	or floating point number. If multiple numbers occur in the
	string the longest match is used to set the return value.


disassemble_timezone $SMEI/ucsd/gen/python/eon_helper.py
[Previous] [Next]
 NAME:
	disassemble_timezone
 PURPOSE:
	Translate time zone to time difference with UTC
 INPUTS:
	tzfield     implicit timezone offset as acronym, e.g. UTC, PST, PDT, etc.
	            explicit timezone: +hhmm, -hhmm, hhmm (with optional prefix UT or UTC)
 OUTPUTS:
	result      2-element tuple (hh,mm), -13 <= hh <= 13, 0<= mm < 60