msmasnadi / OPGEEv4

OPGEE v4
Other
10 stars 4 forks source link

Units in Smart Defaults #9

Open rjplevin opened 2 months ago

rjplevin commented 2 months ago

The implementation of smart defaults in v4 is based on Excel formulas form v3. As implemented currently, the magnitude of values with units (using pint) is taken without verifying the units. This will lead to errors if the units defined for attributes were to change.

Recommendation: ensure that values with units are in the expected units (those assumed in OPGEEv3) before taking their magnitude. This way, if attribute units change, the calculations will still use the units the original equations were based on.

For example, instead of

0.5 * depth.m * 0.43

we would do

0.5 * depth.to('feet').m * 0.43

Note: someone (@wennanlong) more familiar than I am with the innards of v3 should determine these units.