-
Notifications
You must be signed in to change notification settings - Fork 179
Unexpected result when scaling var with odd attributes #1161
Comments
Good catch; this is a bug. Luckily the fix is simple. In EnhanceScaleMissingUnsignedImpl.rank(),
However, thinking about it in terms of the size of the data type (e.g. 4 bytes for float, 8 bytes for long) is wrong. With the above change, we're ordering based on the range of the data type. The range of |
@cwardgar, If it looks that easy, any hope of a commit in the next week or so? |
rather than rank types based on bit size, rank on the numeric range that the type can hold. fixes Unidata#1161
I just made a PR and am running it against our full test suite. If all goes well, we'll have a new artifact for in a few hours. Thanks @cwardgar ! |
rather than rank types based on bit size, rank on the numeric range that the type can hold. fixes Unidata#1161
Let's see if that does it - just published new artifacts. |
Thanks, @lesserwhirls. I'll check whether this solves the sample (i.e., complaint) case Monday afternoon. |
@lesserwhirls, Looks like this fixes the examples I was dealing with. Thanks. |
In the changes this summer in how NJ 5.0 handles scaling and adding offsets, there's also been a change in the result of reporting values from oddly defined variables. A user queried me about a dataset that has a variable defined by
Note that the scaling factor and offset would, at first glance, suggest that the float values of BC would not be altered. However, it turns out the values are being cast to long ints to match the attribute types. Since the actual data values are quite small (in the vicinity of 1e-10), the result is that any "good" values in the variable array are being reported as equaling 0L.
So I'm not sure if this counts as a bug in the NJ library code, or a bug in the user's dataset. Thoughts?
The text was updated successfully, but these errors were encountered: