[GRASS-dev] GRASS7-Python: processing with external raster maps
glynn at gclements.plus.com
Sat Nov 19 18:27:30 EST 2011
Markus Neteler wrote:
> I have written attached Python script which registers a raster map
> (r.external), does some calculation (r.mapcalc), and writes immediately
> the result to a GeoTIFF file (r.external.out).
> So far so nice but the resulting map appears to be incomplete.
> I suppose that some file closing does not happen, any idea how
> to fix this script?
It mostly works for me, except that 64-bit output isn't quite right
(it appears to contain random noise). Changing 0.2 to 0.2f fixes that;
I don't know whether this is a bug in the lib/raster GDAL code or in
GDAL's handling of 64-bit floating-point TIFFs or in libtiff's
handling of 64-bit floating-point TIFFs.
Also: note that a relative directory (for r.external.out directory=)
is interpreted relative to the mapset directory, not the current
directory. An unspecified or empty directory (which will occur if you
pass a simple filename for output=) results in output files being
placed in the "gdal" subdirectory of the mapset directory.
I've attached a slightly modified version which does a better job (I
think) of handling the extension, and switches back to native output
upon completion (although that should probably be in an exit handler,
and should switch back to the prior state).
Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1751 bytes
Desc: updated script
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20111119/00323061/r.geotiff_processing.py
More information about the grass-dev