Re: truncation when reading variables from netcdf file? [message #77613] |
Thu, 15 September 2011 20:33 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ashley Berg writes:
> When reading a variable from a netcdf file in IDL, does IDL truncate
> the numbers when it saves them into an array? For example, I am
> reading in a floating array from a netcdf file, and the numbers in the
> file all go to 16 decimal places. I save the numbers into a double
> array, but even double-precision numbers only go to about 14 decimal
> places, right?
If you ask a computer to print a number to 16 or 32
or 48 decimal places, it will happily do so. Now,
whether those number MEAN anything or not, is
another question entirely.
If you have doubles in your file, and you read them
as doubles, you will have no problems. If you have
floats and read them as floats, you will also be
fine. :-)
Many IDL programmers start their journey into numbers
by starting with this article and proceeding from
there:
http://www.idlcoyote.com/math_tips/sky_is_falling.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: truncation when reading variables from netcdf file? [message #77614 is a reply to message #77613] |
Thu, 15 September 2011 19:11  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Sep 15, 10:32 pm, Ashley Berg <ashley.b...@gmail.com> wrote:
> When reading a variable from a netcdf file in IDL, does IDL truncate
> the numbers when it saves them into an array? For example, I am
> reading in a floating array from a netcdf file, and the numbers in the
> file all go to 16 decimal places. I save the numbers into a double
> array, but even double-precision numbers only go to about 14 decimal
> places, right?
Can IDL even read a datatype that is not one of the standard types?
The standard types need no conversion, since there are identical
correspondents in IDL.
|
|
|