This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
=============================================================================== Robb Kambic Unidata Program Center Software Engineer III Univ. Corp for Atmospheric Research address@hidden WWW: http://www.unidata.ucar.edu/ =============================================================================== ---------- Forwarded message ---------- Date: Thu, 08 Apr 1999 14:39:53 -0600 From: Russ Rew <address@hidden> To: Jason Burks <address@hidden> Subject: Re: Fill Value (fwd) >From: Jason Burks <address@hidden> >To: address@hidden >Subject: Fill Value Hi Jason, > I am decoding the NOAA Experimental Wave Model (Ocean Waves) from grib > to netcdf. This model has missing values over land for obvious > reasons. If the variable in the cdl file FillValue and the value in > gbds.h define FILL_VAL are the same then the missing values get filled > in with a _ rather than the fill value. This would be ok except when > AWIPS sees this _ it tries to put the fill value in there and then > displays it. So what I need to know is there a way to modify the > gribtonc decoder to actually use the FillValue rather than put in the > underscore? > I would not normally care but I need to have in the data file that the > fillvalue is -99999. and the missing data also has to show up as > -99999. The "_" appearing for fill values is just the way the ncdump utility shows a fill value. The value stored in the netCDF file is still the numeric value -99999. in your case, as you can verify by calling the appropriate nc_get_var() C function or NF_GET_VAR()Fortran function. If you want the ncdump utility to show the numeric value instead of the "_" abbreviation for fill values, you would need to modify ncdump/vardata.c and rebuild ncdump, by deleting some lines. >From the printbval, printsval, and printival functions, delete if (varp->has_fillval) { double fillval = varp->fillval; if(fillval == val) { (void) sprintf(sout, FILL_STRING); return; } } >From the printfval function, delete if(varp->has_fillval) { double fillval = varp->fillval; if((val > 0) == (fillval > 0) && /* prevents potential overflow */ (absval(val - fillval) <= absval(float_eps * fillval))) { (void) sprintf(sout, FILL_STRING); return; } } And from the printdval function, delete if(varp->has_fillval) { double fillval = varp->fillval; if((val > 0) == (fillval > 0) && /* prevents potential overflow */ (absval(val - fillval) <= absval(double_eps * fillval))) { (void) sprintf(sout, FILL_STRING); return; } } There probably should be a command line option on ncdump to not print "_" for fill values so you wouldn't have to modify the code and recompile, but no one ever requested such a feature. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu