nraonrao
 
NRAO Home > CASA > CasaRef
quanta.convert - Function

1.4.1 convert a quantity to another unit
Description

convert converts a quantity to another unit. If no output unit given, conversion is to canonical units

Arguments





Inputs

v

quantity to convert

allowed:

variant

Default:

outunit

unit to convert to

allowed:

variant

Default:

Returns
record

Example

"""  
#  
print "\t----\t convert Ex 1 \t----"  
tu = qa.quantity(’5Mm/s’) # specify a quantity  
print tu  
#{’value’: 5.0, ’unit’: ’Mm/s’}  
print qa.convert(tu, ’pc/a’) # convert it to parsec per year  
#{’value’: 0.0051135608266237404, ’unit’: ’pc/a’}  
print qa.convert(tu) # convert to canonical units  
#{’value’: 5000000.0, ’unit’: ’m.s-1’}  
#  
"""

Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu

Copyright © 2008 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search

Updated daily during alpha development.