Scale factor and offset problem
John Caron
caron at unidata.ucar.edu
Wed Jun 20 08:41:07 MDT 2007
Perhaps you should open it twice, once with enhance, the other without?
Didier Earith wrote:
> Hi John
>
>
> Thanks for you answer.
>
> In some cases, I need to unpack and repack data, because I need to
> extract data according to user's crtiteria, among others, data value (
> ie temperature between 10 and 30).
>
> I use NetcdfDataset.acquireDataset() for performance as described in
> documentation.
>
> I also could use NetcdfDataset.openDataset() with "enhance" parameter
> set to false, but I need to add Coordinate Systems, that's also why I
> use the "enhance" flag to true (acquireDataset() or openDataset()).
>
> Didier
>
>
>
> At 18:05 19/06/2007, John Caron wrote:
>> Hi Didier:
>>
>> Is there some reason to unpack and repack?
>>
>> If you open with NetcdfDataset.openFile() it will not get unpacked -
>> you will have the original variable and data.
>>
>> John
>>
>> Didier Earith wrote:
>>> Hi all,
>>> I have a problem with scale factor and offset when I use th netcdf
>>> java API (v2.2.20).
>>> I have to extract netcdf variables with scale_factor and offset
>>> attributes and write the results as another netcdf file.
>>> The NetcdfDataset class automatically deals with scale_factor and
>>> offset attributes when it opens dataset, and that's right (but it
>>> removed scale_factor and add_offset attributes)
>>> But when I want to write variables into another netcdf file, I need
>>> to have the data type, the scale factor and offset values of the
>>> original variables to packed data again.
>>> The VariableDS class provides a public getOriginalDatatype API,
>>> that's OK.
>>> But scale factor and offset attribute of the VariableDS class are
>>> private and there is no API get them.
>>> I saw the getOriginalVariable in the VariableDS class which return
>>> the original variable with the scale_factor and add_offset
>>> attributes. But unfortunately, this API is not visible (private) :
>>> ucar.nc2.Variable getOriginalVariable() {
>>> *return* orgVar; // proxy.getOriginalVariable();
>>> }
>>> So, how can I get the scale factor and offset values with netcdf java
>>> API to pack again the variables.
>>> Didier.
>>>
>>>
>>
>>
>> Cliquez sur l'url suivante
>> https://www.mailcontrol.com/sr/8!q3CiRmgtQvlGuCKKYE0NjoltADyPBlRy3JPOjpssZhyReyAo6au7C!kks57+B1buxs1PiJPWRh90cAXi4VZoXd5s8WQXStsBQcnHsTGa1AYWNtNXzipbO9vW8zU2JYc6LAtKacDpEhSGvppppmJUynrsDwiiQ09ZQZFPA55AdtsrCGZe+PlFOmZV7AVlr5jYqyKPEgQJ9WlXfwQkELAaC8nK3p6uY3
>>
>> si ce message est indésirable (pourriel).
>
==============================================================================
To unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================
More information about the Netcdf-java
mailing list