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

Re: packing netcdf dataset - offset & scaling factor utilization



Kazungu Maitaria <address@hidden> writes:

> Ed Hartnett
> Unidata/UCAR
>
>
> Greetings Ed!

Howdy!

> I did give a glimpse at my new data using ncdump and it looks just
> fine. However, when I try displaying it in GrADS, I get truly weird
> results (values are outrageously big values that are closely
> equal!).

Sorry, can you give me a little background? Is this part of a previous
support question?

Are you using netCDF-3? Or netCDF-4?

Or is this part of the ESMF project? 

As you can see I need some context! ;-)

>
> First, I suspected 'byteswapping' anomaly. When I discussed this with
> our computer specialist, it was confirmed that that is  not the case.
> I have confirmed that my problem lies with the declaration of offset
> and scale_factor in the header but not making use of it when writing
> data into the netcdf dataset file.

Hmmm?

Actually I don't believe netCDF-3 is supposed to automatically pack
your data. Rather, you pack it and unpack it, and just use the
attributes to store the numbers you need to do that.

>
> I worked at NCAR, foothills over summer last year. I got to know
> about you!

Oh oh! Well, maybe you'll like me anyway! ;-)

>
> Please give me a clue on how to include the aforementioned parameters
> in my nf90_put_var command so that my data will be 'packed'. I would
> like to look at the data with ncdump and see a bunch of large negative
> integers. This way I can invoke GrADS wherein the data will be
> 'unzipped - unpacked' and displayed correctly.

Looking here:

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Attribute-Conventions.html#Attribute-Conventions

I see:

scale_factor
    If present for a variable, the data are to be multiplied by this
    factor after the data are read by the application that accesses
    the data. 


In other words, it's up to the reading or writing application to do
this, not the netCDF library.

>
> This is my first attempt to use netCDF utilities by converting
> spectral data into gridded data.

Good luck, I hope you enjoy it!

Actually automatic packing/unpacking is something we are considering
for a future netCDF version. Are you trying to use this feature in a
netCDF-4 alpha version?

Thanks,

Ed

-- 
Ed Hartnett  -- address@hidden