[Thread Prev][Thread Next][Index]

Re: [ferret_users] ASCII read issues



Hi -
I want to add to my comment in the earlier message from a week ago. I was wrong to say that Ferret reads the numbers for the coordinate range on a DEFINE AXIS in single precision.  In fact, it reads from the command line into a double-precision variable and defines the axis using that.  So there is no loss of precision from the DEFINE AXIS command.

Try it,
yes? define axis/x=0.1234567890001:1.1234567890001:0.01 xaxis
yes? let xx = 0+x[gx=xaxis]
yes? save/clobber/file=xxtest.nc xx
yes? sp ncdump -c xxtest.nc
...
 XAXIS = 0.1234567890001, 0.1334567890001, 0.1434567890001, 0.1534567890001,
    0.1634567890001, 0.1734567890001, 0.1834567890001, 0.1934567890001,
    0.2034567890001, 0.2134567890001, 0.2234567890001, 0.2334567890001,
...
    1.0834567890001, 1.0934567890001, 1.1034567890001, 1.1134567890001,
    1.1234567890001 ;
If you were to define a variable, "let xx = x[gx=xaxis]"  then that variable is in single precision and wouldn't keep the full precision of the axis coordinates.

-Ansley

On 10/21/2011 2:49 PM, Ansley Manke wrote:
Hi,
Just a picky comment here. Ned's absolutely right about using NPOINTS to define your axes, but I'd just like to clarify how it operates here. Ferret uses single precision to read in the numbers you specify in the DEFINE AXIS command.  Once it has the values, it uses double precision to store the axis coordinates, to compute with axis coordinates, and to write them out to netCDF files.

-Ansley

On 10/21/2011 1:42 PM, E. D. (Ned) Cokelet wrote:
Sam, just a couple of quick commnets:  The first thing I'd try is to NOT specify the lat and lon increments, but instead use the NPOINTS paramater in the define axis command.  That's because ferret only uses single precision to do the math in setting up the axes, and that's only good to 7 sig. figs.  So a define axis command might look like this:

define axis/X=26.375W:56.584E/npoints=9955/unit=degree xlong
define axis/Y=41.5S:38.175N/npoints=9561/unit=degree ylat

See if that helps.  Then there might be, need to be, or not to be a branch cut at the prime meridian.  If so, you'd use the /mod parameter when defining the x axis.  
------------------------------------------------------------------------------------------
Edward D. (Ned) Cokelet, Ph.D. Oceanographer
NOAA/PMEL                         off:  (206) 526-6820
7600 Sand Point Way NE     fax: (206) 526-6485
Seattle, WA 98115-6349


The contents of this message are mine personally and do not necessarily reflect any position of the Government or the National Oceanic and Atmospheric Administration.






[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement