[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #VQZ-726653]: data packing



I wrote:

> OK, I'm convinced. We'll change the Best Practices description to use
formulas for
> signed types. Thanks again for the suggestion and for being persistent.

Actually over lunch I decided there is another constraint we have to
take into account: existing packed archives.  For example, I don't
think we can reduce the packed range by one and specify the minimum
value should be used for the fill value.  Instead I believe we have to
map the whole range and respect whatever fill value is specified by
the _FillValue attribute.

I think the right way to do this is by only changing the formula for
the packed data value, leaving the formulas for add_offset and
scale_factor the same, but specifying:

  packed_value = nint((unpacked_value - add_offset) / scale_factor) - 2^(n-1)

We also need to put a test or example code in the netCDF distribution
that shows how to write packed data with a fill value and how to
correctly read it.  That way, we'll know we have the formulas right
and developers can cut and paste from the examples.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: VQZ-726653
Department: Support netCDF
Priority: Normal
Status: Closed