You are a guest. Restricted access. Read more.
SCaVis manual

Unit conversion

SCaVis can be used to easily convert between different units of measurement. You can use it in a GUI mode or as a Java classes, which can be accessed via any scripting language supported by the program.

A GUI mode

Simply start SCaVis IDE and select [Tools]→[Unit conversion]. You will see a GUI windows where you can sent different conversion units. The program is based on the JConvert program. This window is shown below:

Conversions in Java/Jython

Alternatively, you can do conversions inside Java/Jython code. Use the UConverter class.

Here is an example:

from jhplot import *
u=UConverter()                    # initialize converter
print u.toString()                # check measure types
c=u.getConversionType("Distance") # conversion type
print c.getAllFromUnits()         # check all units for this measure
print "1 mile = ", c.convert(1.0, "mile", "meter") , " meters"
print "1 mile = " + c.convertFraction("1", "mile", "meter"), " meters";

The code, among other things, will print the correct answer:

1 mile =  1609.344  meters
1 mile = 1609 43/125  meters

The conversion tables are rather complete. In total, there are 24 measures, such as Flow, Volume, Power etc. and more than 3,000 possible conversion combinations.

Let us consider more sophisticated example with some more explanation:

Unregistered users have a limited access to this section. You can unlock this page after becoming a full member. Or one can read the book "Scientific data analysis using Jython scripting and Java.

man/meas/unit_convert.txt · Last modified: 2014/03/29 08:41 by admin
CC Attribution-Share Alike 3.0 Unported
Powered by PHP Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Valid HTML5