>>>>> Glynn Clements <[EMAIL PROTECTED]> writes:

 >> Since it's somewhat cumbersome to work with multiple `MASK's
 >> currently (`r.reclass', `g.copy'?),

 > Once you have a set of maps suitable for use as masks, switching
 > between them just requires using g.rename or "g.copy --o".

        Yes.  Though, in my opinion, it's hardly as convenient as,
        e. g.:

$ MASK_OVERRIDE=my_mask r.stats -c my_raster 

$ MASK_OVERRIDE=my_mask bash process-it-all-for-me.sh 

 > The r.reclass (or r.mapcalc) step still needs to be done regardless.

        The calculation of the mask needs to be done just once.  The
        point was that one may use an ``identity'' `r.reclass' to create
        `MASK' as an alias to some existing raster.

 >> I'd like to introduce `MASK_OVERRIDE' -- an environment variable
 >> analogous to `WIND_OVERRIDE'.

 > This would eliminate potential problems with running commands
 > concurrently. E.g. if you set a mask from the command line, any
 > display commands used by the GUI will also use the mask.

        Yes.

 > So, this is really more an issue of flexibility than
 > convenience. It's probably easier for the user to just use
 > g.rename/g.copy.

        Not for me, at least.

[...]

 >> +    {
 >> +   const char *override = getenv ("MASK_OVERRIDE");
 >> +   if (override != 0) strncpy (name, override, sizeof (name));

 > Use "if (override)" rather than an explicit comparison against 0.
 > Although C allows comparisons between pointers and literal 0, you may
 > get a warning, and we have enough of those cluttering up the build
 > output already. Also, NULL/non-NULL pointers are conventionally as
 > much of a logic value as zero/non-zero integers.

        ... The thing I cannot get used in C...

 > Presumably you wouldn't write "if ((x == y) != 0)" instead of "if (x
 > == y)"?

[...]

 > For this feature to be of real use, you need to allow MASK_OVERRIDE
 > to be used to disable reading a mask altogether. E.g. if
 > MASK_OVERRIDE is defined but empty, no mask should be used rather
 > than falling back to MASK. This would allow the GUI to operate
 > without a mask even when MASK has been created via the command line.

        The code doesn't ever fall back to `MASK' if `MASK_OVERRIDE' is
        defined.  If `MASK_OVERRIDE' doesn't point to a valid raster
        (e. g., if it's an empty string), the mask is ignored.

        However, I doubt if it's a reasonable behaviour.  It seems to be
        usual in the Unix world to ignore the environment variable's
        value if it's an empty string.  Using a non-existing raster
        (say, `.') is probably a better idea.

[...]

 >> if(G_is_reclass (name, mapset, rname, rmapset) > 0) {

 > Personally, I think that returning the base map in the case of a
 > reclass map is probably bogus. There may be some point to it when the
 > actual mask will always be MASK@<current mapset>, but if you can
 > configure it with a variable, the actual mask map will be more useful
 > than the base map.

 > I suggest changing G_mask_info() to print the name of the actual mask
 > map (i.e. either $MASK_OVERRIDE or "[EMAIL PROTECTED]"), as well as the
 > base map if it's a reclass map.

        I agree, but this deserves a separate entry in the SVN log.

        I'll post a revised diff later.

_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to