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

[netCDFJava #NBT-844482]: problems with add_offset, scale



Heather,

If you're using FileWriter, that only works for netCDF 3. You need to use 
FileWriter2 to get netCDF4:

https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/javadoc/index.html

When you use FileWriter2, you'll also need to pass it 
NetcdfFileWriter.Version.netcdf4 to enable netCDF 4 output with the unsigned 
data types.

For more information about writing files, see this tutorial: 
https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/tutorial/NetcdfWriting.html
Specifically, the last section should be useful.

Ryan

> My default is netcdf 4.  I even had our IT guy go in and make sure that's
> the default for me.  I logged out and back in again to make sure something
> wasn't reset previously, but I still get negative values in the RhoHV
> field.  Do you have any other thoughts on what is going on?
> 
> address@hidden> wrote:
> 
> > Heather,
> >
> > Now that I think about it, the raw data in a Level 2 file are unsigned
> > bytes, so you shouldn't even be able to get a value of -24.
> > If I convert -24 to its unsigned byte equivalent, 232, then the scale and
> > offset give me 0.975.
> >
> > What are you using to read the data back in? Are you converting to a
> > netCDF version 3 file or a version 4 file? The version matters, because
> > netCDF 3 doesn't support unsigned data, so we set an attribute _Unsigned
> > to indicate that the data are unsigned; the data type netcdf variable
> > itself is byte. For netcdf version 4, the data are written as unsigned
> > bytes.
> >
> > Writing out netcdf version 4 files from netcdf-java requires having the
> > netcdf-C library installed and configured, so I'm going to guess you're
> > writing
> > netcdf version 3 files.

Ticket Details
===================
Ticket ID: NBT-844482
Department: Support netCDF Java
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.