Re: Scale factor and offset problem

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.



==============================================================================
To unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================