Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: quanta.getformat - Function Up: quanta - Tool Previous: quanta.gui - Function


quanta.setformat - Function



Package general
Module quanta
Tool quanta


set format for output of numbers


Synopsis
setformat(t, v)


Arguments

t in type
    Allowed: coded string indicating which format parameter to set
    Default: ''
v in format parameter value
    Allowed: numeric or coded string, depending on format type to be set
    Default: F


Returns
bool


Description
setformat allows to define output format parameters for a variety of value types. The type is indicated by the first parameter, and coded (see following list). The actual format parameter set depends on the value parameter v given. If this value is specified as the '...' string, the value will be asked interactively from the user. The formats specified (or the defaults) are used in the form functions. The formatting that can be specified:
prec
set the output precision for general numbers. If the value given is an integer less than one, the precision will be set to 6.
aprec
set the output prescion for angles. If the value given is an integer less than one, the precision will be set to 6. A value of 6 will output up to the seconds field, with decimal places if larger than 6.
tprec
set the output prescion for times. If the value given is an integer less than one, the precision will be set to 6. A value of 6 will output up to the seconds field, with decimal places if larger than 6.
long
longitude display. Valid formats: 'hms', 'dms', 'deg', 'rad', 'd', '+deg'.
lat
latitude display. Valid formats: 'hms', 'dms', 'deg', 'rad', 'd'.
len
length display. Valid format: any length dimension
dtime
time type display: 'local', 'utc', 'last' or 'solar'
elev
elevation limit rise/set: angle quantity
auto
auto frame update interval: time quantity
vel
velocity: velocity unit
freq
wave characteristics: frequency, length, time, angle/time, /length, energy, impulse units
dop
doppler type display: 'radio', 'opt', 'true'
unit
default units: any valid unit



Example
- 1.234567890123456		# note that quanta set precision to 9
1.23456789			# (as compared to default Glish 6)
- a:=dq.quantity(1.2345678901234567, 'km/s')
- dq.form.vel(a)                # display as velocity in default units
1.23456789 km/s 
- dq.setformat('vel', 'yd/a')   # try another unit
T 
- dq.form.vel(a)
4.26071737e+10 yd/a 
- dq.setformat('prec',12)       # or another precision
T 
- dq.form.vel(a)          
42607173719.8 yd/a 
- dq.setformat('unit', 'm/s')   # set generic units
T 
- dq.form.unit(a)               # and see what it looks like
1234.56789012 m/s 
- b:=dq.quantity('5d2m3')       # an angle
- dq.form.long(b)               # as longitude gives it in hms
00:20:08.200 
- dq.setformat('long', 'deg')   # display longitude in degrees
                                # (rather than default hms)
T
- dq.form.long(b)               # and show it   
5.03416667 deg 
- dq.form.lat(b)                # as a latitude it is default dms
+005.02.03.000 
-





next up previous contents index
Next: quanta.getformat - Function Up: quanta - Tool Previous: quanta.gui - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01