ucar.units.package.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of netcdf Show documentation
Show all versions of netcdf Show documentation
The NetCDF-Java Library is a Java interface to NetCDF files,
as well as to many other types of scientific data formats.
Provides support for parsing and formatting string unit specification,
converting numerical values between compatible units, and performing arithmetic
on units (such as dividing one unit by another).
Examples of Intended Use
The following code will print the string "5 knots is 2.57222 m/s":
UnitFormat format = UnitFormatManager.instance();
Unit meter = format.parse("meter");
Unit second = format.parse("second");
Unit meterPerSecondUnit = meter.divideBy(second);
Unit knot = format.parse("knot");
if (meterPerSecondUnit.isCompatible(knot) {
System.out.println("5 knots is " +
knot.convertTo(5, meterPerSecondUnit)
+
' ' + format.format(meterPerSecondUnit));
}