Re: [netcdfgroup] Potential inconsistency in NUG Attribute Conventions

  • To: undisclosed-recipients:;
  • Subject: Re: [netcdfgroup] Potential inconsistency in NUG Attribute Conventions
  • From: "Timothy Hume" <T.Hume@xxxxxxxxxx>
  • Date: Wed, 3 Dec 2008 15:31:50 -0700 (MST)
Conventions [SEC=UNCLASSIFIED]
Thread-Index: AclVCpJz6nz90KDMQSuyJSuiEiojagAixPsg
From: "Timothy Hume" <T.Hume@xxxxxxxxxx>
To: "Sergey Panov" <sergey.panov@xxxxxxxxxxx>,
        <netcdfgroup@xxxxxxxxxxxxxxxx>
X-OriginalArrivalTime: 03 Dec 2008 22:30:51.0092 (UTC)
FILETIME=[CBE3A940:01C95596]
X-Loop:  netcdfgroup@xxxxxxxxxxxxxxxx

Hi Sergey,

Is there any reason why you need to use unsigned bytes or short integers to 
store your data? I think the packing scheme which uses add_offset and 
scale_factor will work fine with signed types. If you have a look at netcdf.h 
you'll see the types NC_BYTE and NC_SHORT are guaranteed to be signed 1 byte 
and 2 byte integers respectively. If you design your packing to take advantage 
of the full range of a signed byte/short, you don't need to worry about using 
the valid_min and valid_max attributes to indicate the signedness of the 
integer.

Tim Hume
Centre for Australian Weather and Climate Research
Melbourne
Australia 

-----Original Message-----
From: netcdfgroup-bounces@xxxxxxxxxxxxxxxx 
[mailto:netcdfgroup-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Sergey Panov
Sent: Wednesday, 3 December 2008 16:46
To: netcdfgroup@xxxxxxxxxxxxxxxx
Subject: [netcdfgroup] Potential inconsistency in NUG Attribute Conventions

I want to be able to use unsigned byte and/or unsigned short integers to
store "compressed" data. Under "compressed" I mean floating point values
mapped into integer values via the 'scale_factor' and 'add_offset'
attributes.

The description of the deprecated 'signedness' attribute states:
"Deprecated attribute, originally designed to indicate whether byte
values should be treated as signed or unsigned. The attributes
'valid_min' and 'valid_max' may be used for this purpose. For example,
if you intend that a byte variable store only nonnegative values, you
can use 'valid_min' = 0 and 'valid_max' = 255. This attribute is ignored
by the netCDF library."

How that scheme is supposed to work with 'scale_factor' != 1 and
'add_offset' != 0 ? It would have been simple if 'valid_range' was
referring to the stored, not yet unpacked(unscaled) variables, but it
does not seems to be the case.


Regards,
         Sergey Panov



_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/ 



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