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

[netCDF #NJB-310977]: binary larger than text file



Hello Ben,

Thank you for providing the example cdl file; I've looked at it, and with input 
from one of our other developers (Russ Rew), we have determined that there are 
a couple of issues which would cause a larger size. However, the dominant 
factor is as follows:

The 'string' data type is meant primarily for variable length strings, not 
individual characters.  As currently constructed, every character (A, T, O, M, 
" ", etc) is being stored as an individual variable-length string.  This is 
vastly inflating the size of the file.

You *could* change the dimensions so that you have a 1D array of strings; this 
will give you a smaller file, but we can do better.  If you change the record 
variable type from 'string' to 'char', and then replace the double-quotes 
(denoting a string) with single quotes (denoting a character),  you will see 
the binary file size drop to 24K, far smaller than the original cdl file.  

I've attached an example of this to this message.  Let me know if this works 
for you, or if you have any additional questions!

Have a great day,

-Ward


> Dear netcdf users,
> 
> I have data I want to convert to nc format.
> This data is integers, floating point numbers and text.
> 
> I created a dummy nc file containing text and I realize the binary file is
> larger that the text file.
> How come ?
> 
> See by yourself: convert the joint file to binary using
> ncgen -b foo.nc.txt
> 
> Thank you in advance for your help.
> Ben
> 
> 
> _______________________________________________
> netcdfgroup mailing list
> address@hidden
> For list information or to unsubscribe,  visit:
> http://www.unidata.ucar.edu/mailing_lists/
> 
> 


Ticket Details
===================
Ticket ID: NJB-310977
Department: Support netCDF
Priority: Normal
Status: Closed

Attachment: 2foo.cdl
Description: Binary data