[GRASS-user] r.basin: Completes on Some Basins, Fails on Others

Rich Shepard rshepard at appl-ecosys.com
Fri Jun 8 07:57:01 PDT 2012


On Thu, 7 Jun 2012, Margherita Di Leo wrote:

> you mean something like (untested):
>
> #!/usr/bin/env python
>
> fin = open("crosspoints","r")
> fout = open("commands","w")
> linesout = (line.rstrip().split() for line in fin)
> cmd = 'r.basin map=dem prefix=bas%s easting=%s northing=%s
> threshold=10000\n'
> fout.writelines(cmd % (n, easting, northing) for n,(easting,northing) in
> enumerate(linesout))

   Works great!

   I turned the commands file to a bash script and it's now happily filling
up the directory with all the output files from 45 basins. Time to have
breakfast while it runs.

Many thanks,

Rich

-- 
Richard B. Shepard, Ph.D.          |   Integrity - Credibility - Innovation
Applied Ecosystem Services, Inc.   |    Helping Ensure Our Clients' Futures
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863



More information about the grass-user mailing list