g2ctl doesnt set the proper undefined value
Jennifer Adams
jma at COLA.IGES.ORG
Thu Aug 13 08:51:14 EDT 2009
Undef handling in GrADS changed with Grads 2.0.a6. The undef value in
the data file (let's call it the 'input undef') is no longer the same
as the undef value in the display or in the output (the 'output
undef'). If you want them to be the same, use the 'set undef' command.
Here is the documentation on 'set undef':
set undef
This command allows the user to set the undefined data value for all
forms of GrADS output. This command controls the undefined values
printed to screen with the 'gxout stat' and the 'gxout print' output,
as well as the undefined values in fwrite, sdfwrite, and geotiff files.
The output undef value will not necessarily be the same as the native
undef value of the data set -- the default value is -9.99e8. The user
can easily change the output undef value to match the undef value of
the default file or a specific open file.
Syntax
set undef value (sets output undef value to value)
set undef file n (copies undef value from file n)
set undef dfile (copies undef value from default file)
Usage Notes
This is a new feature with GraDS version 2.0.a6, that changes the
default behavior of GrADS!
By default, the output undef value will be -9.99e8 instead of the
undef value given in the data descriptor file. You may easily revert
to the old behavior by using the 'set undef file n' option.
You can find out what the current output undef value is with the
'query undef' command.
The reinit command will return the output undef value to the default
(-9.99e8); the reset command leaves it unchanged.
If you issue the 'set undef dfile' command, the output undef value
will be copied from the default file's undef value. If you
subsequently change the default file number, the output undef value
will not change. You must issue 'set undef dfile' again if you wish
the output undef value to be the same as the new default file.
As for your specific question about grib, there is no undef value in
grib, there's a bit map. The undef record in a 'dtype grib/grib2'
descriptor file is a number to put where data are designated as
missing by the bit map -- it can be anything you want: -9.99e33, 1e
+20, -999, 9.99e20, etc. There is no standard. In the recent versions
of GrADS, this value has become almost entirely irrelevant, since the
only way it will appear in your output is if you use the command "set
undef file n".
I cannot address issues with pygrads -- but I suspect that if you use
the "set undef file n" command before you 'display', your problems
might go away. It might also be relevant to know that the 'q ctlinfo'
output will show you the undef value in the descriptor file (** see
note below), but the output from 'gxout stat' or 'set stat on' shows
you the undef value in the output. For pygrads, the better way to
check the undef value might be to 'q undef' or 'set stat on' and parse
that output instead.
--Jennifer
** N.B.: In a self-describing file (netcdf or hdf) the undef entry in
the descriptor file can have 2nd argument, the name of the attribute
that contains the missing value. In this case, the value given in the
1st argument of the undef entry is not required to match the undef
values in the file, it can be anything you want, just like grib
undefs. For recent versions of GrADS, this undef value is also almost
entirely irrelevant, just as I mentioned above. At the moment of an I/
O request, the named attribute containing the undef value is read from
the variable's attributes, the retrieved undef value is used to test
for misising data, and then discarded. The undef value in the
descriptor file is not used unless you use the "set undef file n"
command.
On Aug 12, 2009, at 9:45 PM, P.R. wrote:
> Hi,
> Im having an issue with g2ctl & how it sets the undefined value in
> the ctl
> file output.
> g2ctl.pl hard-sets the undef value at 9.99e+20, which I *believe*
> has been
> pretty much the standard undef value up until now.
>
> However, the undef value on some datasets (the GFS grib2 files, for
> example)
> is giving me a value of -9.99e+08.
> (could someone please confirm this value for undef from the GFS grib2
> files?).
>
> Normally, I don't believe that it matters if the g2ctl.pl undef value
> differs from the grib2's undef value.
> However, I ran into an issue with pygrads; pygrads reads the undef
> value
> from the ctl file, and it will improperly try to plot undefined data
> points
> due to fact that it doesn't know the correct undef value.
>
> So, my question/suggestion is:
> should g2ctl be setting the undef value based on the dataset inside
> the
> grib2 file, instead of hard-setting to a fixed value?
> Is it even possible to retrieve this value from the grib2 metadata?
>
> Thanks,
> P.Romero
--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090813/2efbf337/attachment.html
More information about the gradsusr
mailing list