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

[netCDF #WAH-567826]: NC_UINT functions fail with error (-45)



> Full Name: Tori Fae
> Organization: Berkeley Space Sciences Laboratory
> Package Version: 4.3.3.1

Hi Tori,

> I have downloaded the CENTOS variants of HDF5, compiled the NetCDF libraries 
> with success and am linking to the objects for NetCDF, HDF5, ZLIB, SZLIB and 
> so forth.
> 
> Everything seems to work fine. I can create NetCDF files with data that seems 
> correct.
> 
> However, when I use the data type NC_UINT (as I desire a 4 byte unsigned 
> value) or any of the related functions (nc_put_var_uint, etc) an error 
> results.
> 
> Changing it to nc_put_var_int or long makes everything work correctly (aside 
> from the data type being not as I desire).
> 
> The error code is -45 which translates with nc_strerr to:
> 
> "NetCDF: Not a valid data type or _FillValue type mismatch".
> 
> 
> Please let me know what I might be doing wrong or if there is a bug out 
> there. I looked through the forum and archive. I saw an issue in September of 
> 2014 for 64 bit unsigned... but nothing for 32 bit unsigned.

I suspect you are trying to write to a netCDF classic format, but unsigned 
types are only supported for netCDF-4 format files. The netCDF classic
model only supports the six primitive types char, byte, short, int, float, and
double, but the netCDF enhanced data model added the unsigned types
ubyte, ushort, uint, uint64 as well as int64 and string.  To use the NC_UINT
type, you'll have to create your files to use the netCDF-4 format, with 
something like

   nc_create("foo.nc", NC_NETCDF4, &ncid);

If that's not the problem, please provide a small example program that fails.

Thanks.

--Russ

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



Ticket Details
===================
Ticket ID: WAH-567826
Department: Support netCDF
Priority: Normal
Status: Closed