NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hello, Consider this example Java code: Unit metersPerSecondUnit = format.parse("m/s"); Unit unit1 = format.parse("60 m / minute"); Unit unit2 = format.parse("600 m / 10 minutes"); System.out.println(unit1.getCanonicalString()); // Prints "1.0 m.s-1" System.out.println(unit2.getCanonicalString()); // Prints "3600.0 m.s"System.out.println(metersPerSecondUnit.isCompatible(unit1)); // Prints "true" System.out.println(metersPerSecondUnit.isCompatible(unit2)); // Prints "false"
System.out.println(unit1.equals(unit2)); // Prints "false"Pretty strange results, huh? Is the parse method intended to support a unit spec such as "600 m / 10 minutes"? It certainly didn't throw an exception when I tried.
udunits
archives: