NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

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


  • 1998 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: