# DMelt:Units/1 Unit conversions

Limitted access. First login to DataMelt if you are a full DataMelt member. Then login to HandWiki as a user.

# Unit conversion

DataMelt 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 DataMelt 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: