Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

NC_BYTE and NC_CHAR (signed and unsigned 8-bit integers)

Dear netcdf people,

I'm asking your help from Italy.

I need to save has much space as possible in saving my data so I
decided to normalize data into the range 0-255 so that it can be kept
in a single byte. 
In netcdf there are 2 8-bit data types:  NC_CHAR and NC_BYTE.

I started using NC_CHAR data type and
all works fine, but many utilities (ncview, vcs...) do'nt display
CHAR data. So I'm trying to save the normalized data as NC_BYTE which 
can be plotted much easier.

BUT netcdf library returns NC_BYTE data as 8-bit signed
integers (instead of 8-bit unsigned integers)
so that NC_BYTE values go from 0 to 127 and then from -128 to -1
instead of going from 0 to 255 as wanted.

That means that MIN and MAX values are all wrong and that 
lookup tables for colors are no more monotonics from 0 to 255
but must be made of 2 separted parts: the one for numbers from 0 to 127
and the one for numbers from -128 to -1.

How can I manage it? 

I'm a FORTRAN programmer, not a C programmer unfortunately!

Any help and suggestion will be very apreciated.
Thanks from Italy,

Emanuele 

-- 
 Emanuele Lombardi
 mail:  AMB-GEM-CLIM ENEA Casaccia
        I-00060 S.M. di Galeria (RM) 
        ITALY
 mailto:lele@xxxxxxxxxxxxxxxxxxxxxxxxx
 tel    +39 6 30483366
 fax    +39 6 30483591


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690