Re: [netcdfgroup] Potential inconsistency in NUG Attribute Conventions

On Thu, 2008-12-04 at 09:30 +1100, Timothy Hume wrote:
> Is there any reason why you need to use unsigned bytes or short
> integers to store your data?

Because original data (IRIS raw product) is already scaled into unsigned
int (uint8_t aor uint16_t).

>  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.

The tool our customers are using can deal with the following metadata:

        byte Z(radial, Z_bin) ;
                Z:long_name = "Reflectivity" ;
                Z:units = "dBZ" ;
                Z:valid_range = 2b, -2b ;
                Z:below_threshold = 0b ;
                Z:range_ambiguous = 1b ;
                Z:_FillValue = -1b ;

The scale is undefined, but if I add  "add_offset" and "scale_factor"
ncview refuses to display converted file.

> 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: