[GRASS-dev] GRASS7-Python: processing with external raster maps
neteler at osgeo.org
Mon Nov 21 17:16:18 EST 2011
On Sun, Nov 20, 2011 at 12:27 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> 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.
Good question - I have just updated to GDAL 1.8.1.
It looks fine.
> 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.
Ah good point, added to manual.
> 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).
Thanks, appreciated. Now the script works fine.
More information about the grass-dev