[GRASS5] How to code NULL in sites lists?
Markus Neteler
neteler at geog.uni-hannover.de
Thu Oct 12 05:34:18 EDT 2000
Hi Eric, hi all,
On Wed, Oct 11, 2000 at 06:30:48PM -0700, Eric G . Miller wrote:
> On Wed, Oct 11, 2000 at 06:36:01PM +0100, Markus Neteler wrote:
> <snip>
> > Maybe we should allow two values:
> >
> > -9999 (for all data coming from ESRI world)
> > NAN (but this is a strings?!)
>
> I should clarify. NAN is used for floating point (double) variables
> while resident in memory. Then:
>
> if (isnan(my_double)) { /* It's NULL */ }
> else { /* do work */ }
>
> For strings:
> if (string[0] == '\0') { /* Empty string */ }
>
> or
> if (strlen(string) == 0) { /* Again */ }
>
> Granted, in some contexts an empty string is not the same thing as a
> NULL value, but I think it'll be easier to code around rather than
> library functions returning a NULL pointer for a string attribute. I
> don't know...
>
> As far as the ESRI sentinel value -9999, it's an integer. I don't know
> if they use such a thing for their floating point grids. I don't see
> any reason to carry this around in the site file. Import or conversion
> routines might want to look for it and do an appropriate translation.
> I'm not sure where this fits in in relation to sites...
If we can just have "nothing" for a int/float value, it would be o.k.
Then the user, if using ESRI world data, can just use a text editor
to replace the "-9999" by "". If the s.in.ascii could manage that?
But probably a parameter "nv" comparing to r.in.ascii would be better:
nv String representing NULL value data cell
default: *
Then we don't run into problems if several columns of floats with
partly missing values are there.
> I think this change in behavior should be postponed to GRASS 5.1. I
> suspect it will cause lots of code breakage (maybe I'm wrong?). It
> depends how important people think this is. It's hovering around the
> middle in my mind.
Ok. We postpone it. Bugfixing is more important at time.
Markus
----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'
More information about the grass-dev
mailing list