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

[netCDF #CSO-595483]: Attribute _FillValue question

Hi Mike,

Sorry to have taken so long to respond to your question.
> It is me again from GSFC. I have a question about attribute "_FillValue".
> I have a program that would allow me to create a classic netCDF3 or a netCDF4 
> classic, based on an input option. While I have no problem creating a classic 
> netCDF file adding "_FillValue" attribute for each variable, I am having a 
> difficulty creating the netCDF4 classic file with the same attribute.  I am 
> getting an error of "NetCDF: Invalid argument". This is the statement that 
> throws the error:
> nc_status = nc_put_att_text(ncid, varId, attrName, strlen(tt2000String), 
> tt2000String);
> where attrName is "_FillValue",
> tt2000String is "9999-12-31T23:59:59.999999999"
> The variable is defined as NC_CHAR.
> Once that error occurs, nothing else is written to the file.
> I understand that "_FillValue" is a special in netCDF. But, I don't know if 
> there is any difference between NetCDF 4 and 3 while handling it. I try and 
> succeed in creating a netCDF4 file by using "FillValue", instead of 
> "_FillValue". The ncdump will show the file as "netCDF-4 classic model". I 
> run nccmp to do the file comparison between these classic and netCDF4 classic 
> files. Except for this "DIFFER : FILE FORMATS : NC_FORMAT_NETCDF4_CLASSIC <> 
> NC_FORMAT_CLASSIC", the differences are all related to "_FillValue" vs 
> "FillValue" attribute. (The netCDF4 classic appears to be better organized as 
> it only has about 98M in size, while the classic has 130M.)
> I have netcdf 4.3.0 and HDF5  1.8.11.
> Any suggestion on what I should do to resolve the problem is much appreciated.

Are you trying to use nc_put_att_text() to change an existing _FillValue
attribute on the variable?  That is specifically not permitted in a netCDF-4
file, as it would require changing data values equal to the old _FillValue
to the new _FillValue, and in netCDF-4, attribute functions are not allowed
to change data values as a side effect.  This is more rigid than netCDF-3
rules, I think designed to obey the HDF5 rules on fill values.

I may be wrong about that, since I didn't write that part of the netCDF-4
library.  If you believe this is a bug, you may be right.  If so, could
you provide us with a small example program that demonstrates the error?
If that's not convenient, we'll eventually get around to trying to 
reproduce the problem here, but we may not be able to duplicate what you're



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

Ticket Details
Ticket ID: CSO-595483
Department: Support netCDF
Priority: High
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.