[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #CUF-626439]: Ncdump data loss...



Hi Robert,

First I want to apologize profusely that your question was not answered in a 
timely manner.  It apparently "fell through the cracks" of our procedures 
adapting to a new support system.  I just noticed it and also noticed that it's 
been over a month since you submitted it.

What is the external type of the variable "dateYYYYMMDD"?  That is when you 
display the variable declarations with ncdump, is it declared float, double, or 
int?

If it is declared float, then I think that is the problem.  A 32-bit float 
doesn't have enough precision to represent the floating point value "20030701" 
exactly, because 32-bit floats only have 23 bits of significance in the 
fraction, along with 1 sign bit and 8 exponent bits.  Even 24 bits can only 
exactly represent integers up to about 16777216.  So it wouldn't help to 
display such values with more precision, floats are just an inappropriate type 
for exactly representing dates as 8-digin integers, becasue they are only good 
for about 7 significant digits.

If the variable is declared double, then there is enough precision, but 
ncdump's default of displaying 15 significant digits for doubles should have 
displayed the dates correctly.

Incidentally, your command

  ncdump -p 10[,8] 20030701C1.CDF > 20030701C1.CDF.test.txt

would not work, because the value of the -p precision option is not specified 
correctly.  the "[, double-digits]" syntax in the reference documentation means 
that part of the value is optional.  So for example, to specify that only 8 
significant digits should be displayed for doubles (and 10 for floats), I think 
what you want is

  ncdump -p 10,8 20030701C1.CDF > 20030701C1.CDF.test.txt

I hope this helps, and that we can provide a much more timely answer to your 
next question.

--Russ


Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: CUF-626439
Department: Support netCDF
Priority: Critical
Status: Open