enthought/scimath — pull request #3 by timdiller (2012-05-17 16:36:08+00:00)
Title: patch from user John Lund

Hello,

I'm working on an oil well simulation project using Traits and we discovered an issue with scimath.units.

Short version: *All* units must support the 'offset' attribute currently available only via OffsetUnit.

Why?

Here's one example:

Gauge Pressure, psig.

Currently defined as:
psig = psi

Should be:
psig = psi + 14.7

Even if you re-define psig using OffsetUnit, conversions to/from psi will fail. Using the 'just use OffsetUnit' approach for one unit spec and you'd have to re-define *every* other unit spec that it might interact with, and that's just a mess.

The more general approach is to use the 'offet' attribute and logic from OffsetUnit and plug it into the base class 'unit'. OffsetUnit could then be deprecated.

In the attached patch, I left OffsetUnit in tact for backwards compatibility.

I would be most grateful if this patch could make it into the next ETS release so I don't have to re-patch my ETS repo on the next release!

The attached patch was based on commit "798859... BUG: fix imports" submitted by Robert Kern.

Of course, it's up to you to decide whether you can or should squeeze it in. It doesn't hurt me any to ask, and I'd really appreciate it if it can make it in.

Thank you,

John Lund