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

[netCDF #AEB-315486]: nf90_float too accurate...



Hi George,

> Hi there,
> 
> I was wondering if you could help me.  I have searched the mailing lists
> but can't find anything suitable.
> 
> I am using netcdf as the format for output from an atmospheric model.
> The data in the netcdf is used solely for color contour plotting using
> IDL. The problem I have is that the nf90_float data is much larger than
> it needs to be.  For instance a typical number written out from my idl
> code is:
> 
> 2.43866705894470210000e+000
> 
> There is way more accuracy in this number than needed for color
> applications - a simple:
> 
> 2.439e+00 would be perfectly adequate.
> 
> Why this is a problem is that the datafiles are very large - because
> they are large 2D arrays so the nf90_float accuracy is a problem.
> 
> What I would ideally like is something like an NF90_smallfloat or
> something.  Or is there another way of doing this ?
> 
> I am using netcdf 3.5 right now btw.

The nf90_float type is only a 32-bit float, with about 5 significant
digits of precision, as documented here:

  
http://www.unidata.ucar.edu/netcdf/old_docs/really_old/f90-html-docs/guide7.html

If you're seeing more precision than that, it may be the result of
printing the values as double-precision.  

Arrays of nf90_float values require 4 bytes of storage for each value
in a binary netCDF file.  If you want to use less storage than that,
you could pack the values into 2-byte nf90_short values, as described
here:

  
http://www.unidata.ucar.edu/netcdf/docs/BestPractices.html#Packed%20Data%20Values

using the add_offset and scale_factor attributes for the packed variable.

If you want to see the values with less precision when you print them out
with the ncdump utility, you can use the "-p float_digits[,double_digits]"
option to ncdump, as documented here:

  http://www.unidata.ucar.edu/netcdf/docs/ncdump-man-1.html

If we've misunderstood your question, please let us know.

--Russ

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



Ticket Details
===================
Ticket ID: AEB-315486
Department: Support netCDF
Priority: Normal
Status: Closed


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.