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.

Re: [netcdfgroup] [netcdf-java] Writing unsigned data to attributes



On 7/2/2013 5:52 PM, Alex Fraser wrote:
Hi John,

Thanks for the detailed explanation.

----- Original Message -----
From: "John Caron" <caron@xxxxxxxxxxxxxxxx>
[...]
3) a valid range is applied to the underlying data, before anything
else happens. [...]

Is the same true for _FillValue? In that case I think I can use the following 
rules for unsigned variables:

  - When specifying a fill value, use the same data type
    as the variable and allow it to be written signed;
    nc4 IOSP demands this.
  - When specifying a valid range, promote the data type
    (e.g. byte -> short).

For example, the following should be equivalent:

byte Band1(y, x);
    Band1:_Unsigned = "true";
    Band1:_FillValue = -1b; // byte

byte Band2(y, x);
    Band2:_Unsigned = "true";
    Band2:valid_range = 0s, 254s; // short

Is that right?

Cheers,
Alex


Hi Alex:

Yes, that should work.

We may need to describe this in the user manual, so other libraries implementing scale/offset/missing values will do the same thing.

If anyone on these lists have further opinions, they would be welcome before we standardize on it.

John



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