[GRASS-user] profile tool csv export

Moritz Lennert mlennert at club.worldonline.be
Fri Aug 19 07:29:32 EDT 2011


On 19/08/11 12:17, Hamish wrote:
> Rebecca wrote:
>> I'd like to use the CSV export from the profile analysis tool to
>> quickly compare profile data for a number of rasters, however
>> when I export the profile the z data are always integer (rather
>> than the float data of the original raster).
>> Is there a way to change the output to CSV to float?
>
> Hi,
>
> I see the same thing with spearfish's elevation.10m FP raster
> with GRASS 6.4.1. A quick look at the profile tool's python shows
> it as treating the array elements as float, I'm not sure where it
> is losing the precision.

--- profile.py	2011-08-19 13:28:17.000000000 +0200
+++ profile_new.py	2011-08-19 13:28:43.000000000 +0200
@@ -598,7 +598,7 @@
                                    caption=_("Error"), style=wx.OK | 
wx.ICON_ERROR | wx.CENTRE)
                      return False
                  for datapair in r['datalist']:
-                    file.write('%d,%d\n' % 
(float(datapair[0]),float(datapair[1])))
+                    file.write('%f,%f\n' % 
(float(datapair[0]),float(datapair[1])))

                  file.close()

Moritz


More information about the grass-user mailing list