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

Re: 20010531: ncgen Error when using _FillValue



>From: address@hidden
>Subject: ncgen Error when using _FillValue
>Organization: Weather.com
>Keywords: 200105312053.f4VKrDp24081 ncdump _FillValue C++

Bill,

> The following code snippet does produce a correct CDL
> in terms of the heading...However when I dump the values
> for this field I get the default '-' instead of the
> specified value.  Am I doing something out of order?
> 
> I did see a post at http://www.unidata.ucar.edu/cgi-bin/mfs/70/2885?33#mfs
> and tried the suggestion...Still to no avail.
> 
> hourly_nc_nc->set_fill();
> NcVar* P;
> NcDim* dim;
> 
> dim = hourly_nc_nc->get_dim( "max_site_num" );
> P = hourly_nc_nc->add_var( "site_list", ncInt, dim );
> P->add_att( "_FillValue", -999 );
> P->add_att( "long_name", "forecast site list" );

It looks like you're doing everything right, which is why ncdump shows
the values of your "max_site_num" variable as "_".  That's the way
ncdump displays values that are equal to the fill value for any
variable.  I just checked the man-page documentation for ncdump (the
ncdump.1 file that comes with the distribution), and it says:

  ncdump uses `_' to represent data values that are equal to the
  `_FillValue' attribute for a variable, intended to represent data
  that has not yet been written.  If a variable has no `_FillValue'
  attribute, the default fill value for the variable type is used if
  the variable is not of byte type.

--Russ