NRAO Home > CASA > CASA Toolkit Reference Manual
quanta.convert - Function

1.5.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’}  
#  
"""  
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright © 2016 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