[GRASS-dev] r.mapcalc and g.remove --v/q issues
Sören Gebbert
soerengebbert at gmx.de
Mon Oct 9 18:28:11 EDT 2006
Hi,
i just tested g.remove (lates grass cvs version).
If i try to remove a non existent map i get this warning:
GRASS 6.3.cvs > g.remove rast=huch
WARNING: <huch> nothing removed
GRASS 6.3.cvs > g.remove rast3d=huch
WARNING: <huch> nothing removed
I think this is a wrong warning, because map "huch" does not exist.
Maybe i'm doing something wrong?
Best regards
Soeren
btw.:
You can use the grass test suite to test if g.copy, g.rename and
g.remove still work after you modified them.
http://www-pool.math.tu-berlin.de/~soeren/grass/GRASS_TestSuite/GRASS_Testsuite-0.2.0.11.tar.bz2
extract the tar.bz2,
cd in the folder GRASS_Testsuite
and start the framework with:
./StartGRASS.sh grass63
then type
./RunGRASSTestSuite.sh -g
The output should look like this:
===========================================================
Start testing general (g.*) modules
===========================================================
g.copy test: success success success success finished
g.findfile test: success finished
g.filename test: success finished
g.remove test: success success success success success success
success success finished
g.rename test: success success success success success success
success success finished
g.proj output test: success success success success success
success success finished
g.tempfile test: success finished
g.gisenv test: success success finished
g.list test: success success success success success success
success success success success success finished
g.region output test: success success success success success
success success finished
g.version test: success success success finished
===========================================================
Finished testing general (g.*) modules
===========================================================
Creating text files
Martin Landa schrieb:
> Hi all,
>
> please take a look at new behaviour of g.remove. If it is OK for you,
> I will modify in this way g.copy/g.rename modules.
>
> Best, Martin
>
>
> 2006/10/9, Martin Landa <landa.martin at gmail.com>:
>> Hi,
>>
>> thanks Glynn!, modified patch applied in CVS.
>>
>> Best regards, Martin
>>
>> 2006/10/9, Glynn Clements <glynn at gclements.plus.com>:
>> >
>> > Martin Landa wrote:
>> >
>> > > trying to cleanup g.remove module I have prepared the patch. Is it OK
>> > > for you? Any comments welcomed...
>> >
>> > Rather than hard-coding checks for specific entity types:
>> >
>> > + if (G_strcasecmp(list[n].alias, "rast") == 0 ) {
>> > + if ((mapset = G_find_cell2 (old, "")) == NULL) {
>> > + G_warning(_("Raster map <%s> not found"), old);
>> > + result = 1;
>> > + }
>> > + }
>> > +
>> > + if (G_strcasecmp(list[n].alias, "rast3d") == 0 ) {
>> > + if ((mapset = G_find_grid3 (old, "")) == NULL) {
>> > + G_warning(_("Raster 3d map <%s> not found"), old);
>> > + result = 1;
>> > + }
>> > + }
>> >
>> > I would add a flag which is initially cleared for each entity (map
>> > etc) and set when an element is actually removed. A warning would be
>> > generated if the flag is still clear when all of the elements for an
>> > entity have been processed.
>> >
>> > E.g.:
>> >
>> > + removed = 0;
>> > for (i = 0; i < list[n].nelem; i++) {
>> > switch (G_remove (list[n].element[i], old))
>> > {
>> > case -1:
>> > - G_warning (" %-*s %s", len, list[n].desc[i],_("COULD
>> NOT REMOVE"));
>> > + G_warning ("%s: %s", list[n].desc[i],_("couldn't be
>> removed"));
>> > result = 1;
>> > break;
>> > case 0:
>> > - G_message (" %-*s %s", len,
>> list[n].desc[i],_("MISSING"));
>> > + G_debug (1, "%s: %s", list[n].desc[i],_("missing"));
>> > break;
>> > case 1:
>> > - G_message (" %-*s ", len, list[n].desc[i]);
>> > + G_debug (1, "%s: %s", list[n].desc[i],_("removed"));
>> > + removed = 1;
>> > break;
>> > }
>> > }
>> > +
>> > + if (!removed)
>> > + G_warning ("%s: %s", list[n].desc[i],_("nothing
>> removed"));
>> >
>> > --
>> > Glynn Clements <glynn at gclements.plus.com>
>> >
>>
>>
>> --
>> Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
>>
>
>
More information about the grass-dev
mailing list