[GRASS-dev] WARNING: No data base element files found

Paulo van Breugel p.vanbreugel at gmail.com
Tue Mar 22 04:22:35 PDT 2016

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 file
>> that doesn't exist. So generally, testing for its existence before removing
>> avoids the warning.
> Also i.colors.enhance suffers from that.
> Do we have any "best practice" example for that in an existing core script?
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', mapset=grass.gisenv()['MAPSET'])
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?

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?

> Markus

More information about the grass-dev mailing list