[GRASS-dev] WARNING: No data base element files found
kratochanna at gmail.com
Tue Mar 22 06:19:25 PDT 2016
On Tue, Mar 22, 2016 at 7:22 AM, Paulo van Breugel
<p.vanbreugel at gmail.com> wrote:
> On 22-03-16 10:59, Markus Neteler wrote:
>> On Mon, Mar 21, 2016 at 11:41 AM, Moritz Lennert
>> <mlennert at club.worldonline.be> wrote:
>>> On 21/03/16 11:38, Paulo van Breugel wrote:
>>>> "WARNING: No data base element files found"
>>> In my experience it comes from a g.remove call that tries to remove a
>>> that doesn't exist. So generally, testing for its existence before
>>> avoids the warning.
>> Also i.colors.enhance suffers from that.
>> Do we have any "best practice" example for that in an existing core
> Would be good to have a 'best practice' example. I have used before
> something like:
> rast = 'my_raster'
> cf = grass.find_file(name=rast, element = 'cell',
> if not cf['fullname'] == '':
> grass.run_command("g.remove", type="raster", name=rast, quiet=True)
> But I guess there are better ways to do this?
Best practice is just to not remove layers which don't exist. So don't
remove the temporary maps inside the script, but rather inside the
registered cleanup procedure which is called every time. The temporary
maps should be added to a global list as they are used, so when you
interrupt the script in the middle only the already created temporary
maps will be deleted.
> P.s. in the find_file example above, is it sufficient to use as 'element'
> 'cell', i.e., does that also find fcell and cellhd layers?
All of 'raster', 'rast', 'cell' will find raster maps (of all
types),not sure what do you mean with cellhd layer.
> grass-dev mailing list
> grass-dev at lists.osgeo.org
More information about the grass-dev