UNIT8 and floating point data

I'd like to use UNIT8 variables to represent arbitrary floating point fields in
cases where total storage is more important than precision.  Looking through
the documentation, I couldn't find any obvious, standard, or semi-standard way
of associating floating point values with bytes.  Ideally, I want a table with
256 FLOAT32 elements that I can just do a lookup with.  I can do that
automatically and quickly internally to my visualization program, and I've used
it for radar data in the NEXRAD format already.

The ad-hoc strategy I'm thinking of now goes like this:

1) Look in the UNIT8 variable for an attribute called "byte_translation" which
is supposed to contain the name of another variable.  This other variable has
to be a 256-element vector of some float type.  If it is, just use this for the
translation, else

2) Figure out the minimum and maximum and assume that the range of bytes
represents a linear, point-sampled range between the minimum and maximum. 
Assign this to the range [0, 255] if there is no missing data value, [1, 255]
if the missing data value is 0, and [0, 254] if the missing data value is 255. 
If the missing data value is something else, I don't know what to do.

3) Give up and assign 0 to 0.0, 1 to 1.0, etc.

Please knock this all full of holes and suggest something infinitely better.

Eric Pepke                                     INTERNET: pepke@xxxxxxxxxxxx
Supercomputer Computations Research Institute  MFENET:   pepke@fsu
Florida State University                       SPAN:     scri::pepke
Tallahassee, FL 32306-4052                     BITNET:   pepke@fsu

Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many lawyers.


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