This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Jim, > UDUnits2 has the ability to handle user defined conversion strings, > which is pretty cool, but has a weird side effect. If you just enter > numbers, UDUnits2 treats them as multiplicative conversion factors so: > > If I enter numbers say from 100 and to 10 I get 1 * 100/10 = 10. It is > basically doing (entry1.value * entry2.value/entry3.value). > > Or, in other words you get a temporary unit, call it 'X'. UDUnits > interprets it as, there is some unit 'X'. The 'From' value is 100*X, > the 'To' value is 10*X. The result is 10. > > That's a little odd, but the problem is that it doesn't work with > non-multiplication operations. I can't have a conversion string @10, or > /10. UDUnits sees that as an error, so it should see the multiplicative > case as an error as well, I think. The "You have: 100"/"You want: 10" case works correctly in my view: you're converting between 100 dimensionless units and 10 dimensionless units. I'm not sure the meaning of "You have: @10" or "You have: /10" is sufficiently obvious to justify the effor to modify the code. One might mean "nothing offset to 10" and the other might mean "one tenth of nothing" -- but that's by no means certain. > Jim Regards, Steve Emmerson Ticket Details =================== Ticket ID: VLT-428101 Department: Support UDUNITS Priority: Normal Status: Closed