[GRASS-user] How effective is scripting in win-GRASS?

Hamish hamish_b at yahoo.com
Mon Apr 14 02:50:08 EDT 2008


> Daniel Victoria wrote:
> > In the email topic you asked about scripting... Well, I have a friend
> > here  that is not very computer literate but he needs to use some
> > python scripts I wrote for Grass.
> > 
> > I installed winGrass for him and I'm surprised how fast he learned!
> > Also, the python scripts works normally, after some debugging (had to
> > remove some spaces on r.mapcalc expressions). All you have to do is
> > call the python script in the command window and ask for it to run
> > from a terminal...
> > 
> > For scripting I had to install MinSys (is that the correct name) and
> > all works like a charm!

MSys or MinGW?


> > The only thing that is bugging me is that I don't know how to use
> > grass commands from the command line. We are typing the commands in
> > the command window and hit Run. Is there a way to issue grass
> > commands from the "windows terminal"?

Once in GRASS text session, try at the DOS prompt:
 g.version --help


Nikos Alexandris wrote:
> Very useful to know all that Daniel.
> 
> I tried once some commands in win-GRASS terminal and (of course)
> commands like sort, cut, etc didn't work. Without these commands I
> don't think that I would like to use GRASS under win.

fwiw, every time I use windows cmd.exe I always type "ls" et al. by
mistake. My solution is to add the common UNIX tools recompiled for
windows into the DOS PATH variable. (I used an older djgpp compile, but
MSys or MinGW should provide newer versions of those)


> I think for beginners && winGRASS users it would be nice to be able to
> select more files at once for example in r.in.gdal
> How else can a newbie load 10 raster maps at once?

if the module does not accept multiple inputs (some do, many don't), you
will have to write a small loop to do that. That could be a bash script,
a DOS batch file, in a python or Tcl GUI picker, etc.

> How about patching 8 corine tiles together at once? If I remember well,
> only in some modules is this option available (to load with ctrl
> +mouseclick) all tiles at once?
> 
> Well, maybe it is a way to "force" learning to use simple scripts
> (which is good from on side). I stopped using the GUI after 1 and 1/2
> months after starting with GRASS because of this. And I don't regret
> it. But it might be more easy for a beginner while "living" a
> transitional phase between GUIs and CLI.

for me when learning GRASS the GUI was very useful for learning what
commands existed in the hierarchical menu layout, and then cutting and
pasting the resulting GUI-constructed command line into my logbook.



Hamish




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



More information about the grass-user mailing list