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

[netCDF #IIN-151372]: NC_USHORT = 65535 problem

> Hi Charlie,

The bug you reported is now fixed in the snapshot release, with a test
run to verify the fix.  The bug was a range test against the maximum
short rather than the maximum unsigned short, so the renge error was
actually returned for all unsigned short values greater than 2**15-1,
not 2**16-1, as was intended.

Thanks again for reporting the problem!


> > At some point in the past year or so, two very separate sets of code
> > I maintain started producing errors when asked to write a netCDF4
> > variable of type unsigned short (NC_USHORT) with value = 65535.
> >
> > nco_err_exit(): ERROR netCDF library returned error code -60
> > nco_err_exit(): ERROR nco_put_var<unsigned short> failed with variable
> > ushort_var
> > NetCDF: Numeric conversion not representable
> >
> > Is it possible that such a problem has crept into the netCDF4 daily
> > builds? I am using
> >
> > Linked to netCDF library version 4.1.2-beta1-snapshot2010080820,
> > compiled Aug 9 2010 22:13:02
> >
> > The rest of the max/min tests seem to work well, i.e., for INT64,
> > UINT64. Only USHORT behaves oddly.
> I was able to reproduce this bug with the current snapshot, using the
> function nc_put_var1_int() to convert and then write the integer 65535 to
> an unsigned short variable, which produced the same message you are
> seeing.
> The bug was also in the 4.1.1 release and the 4.0.1 release, but I
> don't have a 4.0 release built to check whether it was OK for that
> version.
> We'll try to fix it before the next beta release and let you know when
> a fixed snapshot is available.
> A workaround for now would be to write 65535 as an unsigned short
> value, rather than converting to unsigned short from another type,
> because I just checked that just using nc_put_var1() works fine when
> the data is the unsigned int 65535.
> --Russ
> Russ Rew                                         UCAR Unidata Program
> address@hidden                      http://www.unidata.ucar.edu

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

Ticket Details
Ticket ID: IIN-151372
Department: Support netCDF
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.