Re: Fill Value (fwd)

NOTE: The decoders mailing list is no longer active. The list archives are made available for historical reasons.



==============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
rkambic@xxxxxxxxxxxxxxxx                   WWW: http://www.unidata.ucar.edu/
==============================================================================

---------- Forwarded message ----------
Date: Thu, 08 Apr 1999 14:39:53 -0600
From: Russ Rew <russ@xxxxxxxxxxxxxxxx>
To: Jason Burks <Jason.Burks@xxxxxxxx>
Subject: Re: Fill Value (fwd)
From: Jason Burks <Jason.Burks@xxxxxxxx>
To: rkambic@xxxxxxxxxxxxxxxx
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
russ@xxxxxxxxxxxxxxxx                     http://www.unidata.ucar.edu


  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the decoders archives: