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.
I'll take a crack at answering some of these questions, with the knowledge that Steve will correct any errors I make. He is the real expert on Units. m huang wrote: > > Hi, > > I would like to know if the following statements about > terminologies used in VisAD unit system are correct: > > * "quantity name" is something like "length" > * "unit name" is like "meter" Yes. You can find a list of unit and quantity names for VisAD's BaseUnits at: http://www.ssec.wisc.edu/~billh/guide.html#3.3 > * for BaseUnit "unit symbol" is "unit identifier", and is like "m" > * "identifier" for derived unit is the same as the BaseUnit if > derived from one BaseUnit otherwise "null", unless assigned > explicitely > * "unit defination" is "unit identifier" for BaseUnit and > PromiscuousUnit > * "unit defination" is composed by getIdentifier() for Derived > and ScaledUnit I'll leave these to Steve. > Say if I creat a unit > foo=SI.meter.multiply(2); There is not signature in any Unit class for multiply() taking an integer argument. It takes another Unit, and returns the product of the two units: 'this' and the argument. > and another unit > > bar= DerivedUnit({SI.meter},{2}); > > Are foo and bar actually the same class objects? If yes, > why does DerivedUnit.multiply() return Unit instead of > DerivedUnit? If not, why not? In general, operations on Units that produce mathematically equal Units will not return the same instance. However, their equals() methods will tell you they are equal. This was all designed by Steve, but I agree with his decision. If there was only one instance for each mathematicly distinct Unit, that would require lots of internal book-keeping and is unnecessary as lomg as we use the equals() method instead of "==". > What should I do if I want to give foo an identifier? > Why doesn't the Unit class have a method to set identifier? I'll leave these to Steve. > More generally, I would like to know why are BaseUnit, DerivedUnit > and ScaledUnit on the same level of inheritance hierarchy? > Conceptually a BaseUnit is a DerivedUnit that has undergon > zero/no derivation, therefore can be treated "a kind > of", or "a subset of", or a subclass of what is now called > the DerivedUnit, and ScaledUnit can be also seen as a > special case of DerivedUnit. The Developers Guide (2.5 years > old) doesn't mention what is the thinking behind the DerivedUnit > and ScaledUnit. Applications don't generally need to worry about BaseUnit, DerivedUnit and ScaledUnit. They just need the lists of static BaseUnits (which they can declare as 'Unit') in SI and CommonUnit, plus the pow(), scale(), shift(), multipl() and divide() methods of Unit that can be used to create new Units. Or they can use the visad.data.netcdf.units.Parser.parse() method described in the "Using Units" section of Tom's Data Model Tutorial, to create Units from text string representations. I think Steve's Units design does an excellent job of enabling applications to express and manipulate the units of their numerical quantities. Cheers, Bill
visad
archives: