Re: [visad] Possible bug in LogCoordinateSystem/FaltField

Am 17.10.2012 16:27, schrieb Tom Rink:
Hi Tom,
Hi Stefan,

Stefan Below wrote:

i tried the example from Don Murray for Logarithmic Axis ( and i think i found the bug why auto scaling is not working.

First, in LogCoordinateSystem.toReference(vales):
there is no validation if log value can be calculated (no "0" checking, so log(0) results in -INFINITE). I changed the line
         logValues[i][j] = Math.log(values[i][j])/Math.log(base);
logValues[i][j] =(values[i][j]==0)?0: Math.log(values[i][j])/Math.log(base);

I'm not sure this a bug. The logarithm of '0' is not '0'. What happens in your
test if you make log(0) -> Float.NaN combined with your change below?
I think we need to handle this correctly in the scaling logic, rather than make
this change in the coord sys code.

if i set log(0) -> Float.Nan, the "0" value is ignored in the range calculation (min Val is set to 2.4). So it depends what should be displayed. If it should work like the example above, i need to set log(0)->0. If we say we ignore "0" values, than Float.NaN should work.

The next possible bug is in FlatField.computeRanges(ShadowType type, DataShadow shadow) line 54318. If i comment out the range component mapping, ( if (!any_mapped) return shadow), line 5322) it works (Log Axis with auto scaling). The problem is, that the rangeComponent has the RealType "Values", not "LogValues", so the Display Indices is set to -1;

I have no idea if the modification has some side effects (I could not find any unit test), but for my use case it works.

Side effect are certainly possible with changes at this level of the code base. I'll take a look what you've done here more closely to try and figure out what's
going on.  Thanks for  digging into this!

Thanks for picking this up.