[GRASS-user] Speeding up bash script

MS mseibel at gmail.com
Thu Aug 28 21:35:00 EDT 2008


I highly recommend trying the r.in.xyz module.   It has max value  
extraction options.  It is quite remarkable.

Mark


On Aug 28, 2008, at 7:00 PM, "andrew haywood" <ahaywood3 at gmail.com>  
wrote:

> Hi Wesley,
>
> I have recently analysed some lidar data in GRASS and have used  
> Hamish's r.in.xyz module. Its a pretty useful tool to bin up lidar  
> data.
> cheers
>
> Andy
>
>
> On 8/28/08, Maciej Sieczka <tutey at o2.pl> wrote:
> Wesley Roberts pisze:
>
> I have written a bash script to extract the maximum LiDAR height
> value within a predefined sample site (Vector with 314 sample
> locations each 10m squared). The script is below. Essentially I use
> v.extract to select one of my 314 sample sites (Flight_sample2). This
> temporary vector is then used to select all LiDAR points falling
> within its boundaries using v.select. Following this I use v.univar
> to calculate summary statistics of the points selected which is then
> written to temp_file. sed and awk are then used to extract the
> maximum height value which is then used to update (v.db.update) the
> original flight sample file.
>
> Wesley,
>
> Each db.execute call is expensive (v.db.update is a wrapper for  
> db.execute).
>
> Remove v.db.update from the loop. Replace it with a command that
> will create corresponding SQL statements, and store them in a text  
> file.
>
> Outside the loop pipe the file into db.execute. This will do the whole
> update in one run. Should save plenty of time. There's an example in
> db.execute manual.
>
> You can also use "v.univar -g" - shell script output style. It is  
> easier
> to parse. Thus instead:
>
>  v.univar map=b_sam_$x type=point column=dbl_5 layer=1 > temp_file
>  a=`sed -n '5p' temp_file | awk '{print $2}'
>
> you can put:
>
>  eval `v.univar -g map=b_sam_$x type=point column=dbl_5 layer=1`
>
> and then variable 'max' automagically stores your maximum value.
>
> Maciek
>
> -- 
> Maciej Sieczka
> www.sieczka.org
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20080828/be7cb80c/attachment.html


More information about the grass-user mailing list