[GRASS-user] get modified date for raster layer

Jamie Adams jaadfoo at gmail.com
Tue Sep 2 20:49:22 EDT 2008


Hello all,

I've got over 14k rasters in several mapsets that I need to store modified
date in a db for tracking purposes.  I've got the storage and retrieval
worked out, but I don't see an clean (easy) way to get the modified date via
a python script.

So far I've come up with:
 - parse it out of r.info
 - get the modified date in the cellhd folder using os.stat

The problems with these approaches:

r.info - requires parsing, and I need to reformat the date in a way that's
easily comparable.  I'd prefer not to rely on parsing anyway.  Would be nice
to have "shell script" output option.

os.stat (python) - has a nice date integer format, but it requires that I
have the full path to the cellhd folder.  Database and location are easy via
g.gisenv, but getting the mapset on an individual layer basis isn't
completely straightforward.  I can use use "g.mlist -m rast
pattern=<filename>", but that essentially greps it out of a full list.

Is there a more efficient way of getting the modified date of a raster
layer?  If not, getting the full path instead?

Thanks,

Jamie Adams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20080902/cf3658b7/attachment.html


More information about the grass-user mailing list