-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPOINTS for dynamic axes, to specify exact number of points #1157
Comments
Comment by @AndrewWittenberg on 25 Sep 2011 19:37 UTC
|
Comment by @AnsleyManke on 27 Sep 2011 17:47 UTC Dynamic axes are regularly spaced, but if we had the correct npoints, they wouldn't be any different from other regularly-spaced axes. The start, end, and delta (computed in double precision) are stored in double precision and the interior coordinate values are computed not by successive addition but by double-precision multiplication. This means that the dynamic axis x[gx=0:10::7] would behave like DEFINE AXIS/x=0:10/npoints=7 and the coordinate values would be (from an ncdump of a variable saved on the axis), XAXIS = 0, 1.66666666666667, 3.33333333333333, 5, 6.66666666666667, |
Comment by @AnsleyManke on 16 Jun 2015 19:18 UTC
|
Reported by @AndrewWittenberg on 25 Sep 2011 19:01 UTC
For static axis definitions, we have the NPOINTS qualifer to specify an exact number of points. It'd be nice to have the same ability for dynamic axis definitions, to prevent things like this:
I presume that the delta in the dynamic axis definition is being truncated to machine precision. And when that truncated value is used as a regular spacing, the accumulated sum then builds up an error such that the last coordinate no longer fits inside the desired range (0:1).
I'd suggest adding an optional fourth argument to the dynamic axis definition, e.g.
Then
would specify that we want 7 points from 0 to 100, inclusive. If both DELTA and NPOINTS are given, Ferret could raise an error, or do what DEFINE AXIS does and just silently ignore DELTA and use NPOINTS.
Can dynamic axes have irregular spacing? If so, then the above dynamic definition should work just like the static one. If not, and if precision issues don't permit NPOINTS points to be spaced evenly over the interval, then perhaps expand the endpoint as needed until we do actually have NPOINTS points.
Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/1885
The text was updated successfully, but these errors were encountered: