[CF-metadata] Add new integer types to CF?

Charlie Zender zender at uci.edu
Fri Sep 22 11:42:32 MDT 2017


FWIW I always imagined that "interpreted as unsigned" refers
to Chris's option (A), that the data contain no negative
values so it's completely safe to read and store into an
unsigned integer, and that the top-half of that unsigned
integer's range will go unused because it could not be
stored in the signed integer on disk. Option (B) is just...
dangerous.

On 9/22/17 09:43, Chris Barker wrote:
> Sorry to not look deeper and see if this is well specified in the docs 
> already, but...
> 
>     integer or byte variables that are to be interpreted as unsigned must
>     have the attribute _Unsigned = "true".
> 
> 
> What does "interpreted as unsigned" mean? Options off the top of my head:
> 
> A) They are used in the same way, but negative values are invalid.
> 
> B) The actual bits in the data type are actually in the unsigned form, 
> and should be cast to an unsigned type to get the right values.
> 
> The different, is, for instance, that a 1-byte truly unsigned int can 
> hold values from 0 to 255, whereas a signed byte int can hold values 
> from -127 to 127.
> 
> if (A), then it doesn't matter much, really, data readers will simply 
> read the values, and they won't hold any negative values, they really 
> don't need to do anything special when reading manipulating or 
> displaying the data.
> 
> if (B), the data readers need to be very careful to do the right thing.
> 
> -CHB

-- 
Charlie Zender, Earth System Sci. & Computer Sci.
University of California, Irvine 949-891-2429 )'(



More information about the CF-metadata mailing list