Forestry and Grass

Hello (again)

I'm wondering if anybody of the grass-community has used Grass combined
with forestry --> modelling and planning etc.

sincerely Kjell-Olav

Kjell-Olav

'm wondering if anybody of the grass-community has used Grass combined
with forestry --> modelling and planning etc.

  I've been involved in Forestry in England but any questions I've
raised about the use of Grass and forestry are not answered :frowning: It
might be that I could move in the direction of pinning someone up
against a wall then something might happen.

  My own interests are to do with archaeology, geology and chemistry:-
)

Thanks

Richard
Sheffield UK

Hello

Colleagues of mine have been using GRASS for several years to model red and
grey squirrel populations under different forest management regimes, and
various control measures for grey squirrels. Grass is ideal for this type
of work, especially since you can integrate your own process-based
population models (we write ours in C) into the Grass environment.

Roy

At 04:32 pm 26/10/99 +0200, you wrote:

Hello (again)

I'm wondering if anybody of the grass-community has used Grass combined
with forestry --> modelling and planning etc.

sincerely Kjell-Olav

----------------------------------------------------------------------------
Roy Sanderson
Centre for Land Use and Water Resources Research
Porter Building
University of Newcastle
Newcastle upon Tyne
NE1 7RU
United Kingdom

Tel: +44 191 222 7789
Fax: +44 191 222 6563
r.a.sanderson@newcastle.ac.uk
URL: http://www.cluwrr.ncl.ac.uk
----------------------------------------------------------------------------

Well, I would not say that is "ideal", it is possible.
Actually, writing (i.e. population or metapopulation) models
in C (or C++) is far from ideal, as writing the code tends to
imply too much time devoted to "low level" (not a fair term, but an
usual one) programming and the resulting code uses to be
too obscure for others to read (often it's easier to
write your own program in C than reading it afterwards).

A closer-to-ideal situation would be having an script language, from
which you can call grass programs. I wrote a model
for gap dynamics in a neotropical forest using the c-shell
and calling grass functions. It was better (easier and faster) than
using C, but the code was almost as cryptic. Another problem
was the very limited power of the c-shell to manage
arrays (only 1-D) and to make computations (only integers), which
had to solve by using awk sometimes.

Now there are other script languages than could be better, i.e.,
like perl, does anybody have experience at integrating grass
commands within a perl script?

Finally, I explored the possibility of using Splus (R is now a
free alternative and mostly compatible) programs, as Splus (or R)
can issue OS commands. Therefore, it is possible, from within an
Splus program, run i.e. r.stats and read in the result into
an S array and make computations. But the communication is
through files.

In any case, I think that the (near) future of Grass should contemplate
the use of an scripting language for modeling. Is anybody at Baylor
working in this direction?

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo@ija.csic.es
http://pangea.ija.csic.es/alobo

On Tue, 26 Oct 1999, Roy Sanderson wrote:

Hello

Colleagues of mine have been using GRASS for several years to model red and
grey squirrel populations under different forest management regimes, and
various control measures for grey squirrels. Grass is ideal for this type
of work, especially since you can integrate your own process-based
population models (we write ours in C) into the Grass environment.

Roy

At 04:32 pm 26/10/99 +0200, you wrote:
>Hello (again)
>
>I'm wondering if anybody of the grass-community has used Grass combined
>with forestry --> modelling and planning etc.
>
>
>
>sincerely Kjell-Olav
>
>
>

----------------------------------------------------------------------------
Roy Sanderson
Centre for Land Use and Water Resources Research
Porter Building
University of Newcastle
Newcastle upon Tyne
NE1 7RU
United Kingdom

Tel: +44 191 222 7789
Fax: +44 191 222 6563
r.a.sanderson@newcastle.ac.uk
URL: http://www.cluwrr.ncl.ac.uk
----------------------------------------------------------------------------

Just let me comment on the programming technology part of your post.

On Tue, Oct 26, 1999 at 06:49:50PM +0100, Agustin Lobo wrote:

Actually, writing (i.e. population or metapopulation) models
in C (or C++) is far from ideal, as writing the code tends to
imply too much time devoted to "low level"

This is pretty much a question of style. Good C programs a very readble.
(C++ is more difficult.)

A closer-to-ideal situation would be having an script language, from
which you can call grass programs.

Any scripting language will do that. The shell does it.
I would recomment python. (www.python.org)
But you also mean GRASS functions.

Now there are other script languages than could be better, i.e.,
like perl, does anybody have experience at integrating grass
commands within a perl script?

Perl generally is a greater mess than "C". It is much harder to write
good structured programs in perl.

In any case, I think that the (near) future of Grass should contemplate
the use of an scripting language for modeling. Is anybody at Baylor
working in this direction?

Well the GRASS programs are pretty modular already.
If you talk GRASS c-functions, any modern "glue" language can integrate
and access c-functions. Look at http://www.swig.org/ for the
general wrapping technology.

python
  http://www.python.org
scheme (in the guile variant)
  http://www.gnu.org/software/guile/guile.html

are the most interesting ones. (And also used by very sucessful
software, like the gimp.(Perl is used too, by gimp but perl was
more popular for other reasons.))

(If somebody comes up with the money, my company would be happy to
do major work on GRASS in this area.)
  Bernhard

--
Research Assistant, Geog Dept UM-Milwaukee, USA. (www.uwm.edu/~bernhard)
Free Software Projects and Consulting (www.intevation.de)
Association for a Free Informational Infrastructure (ffii.org)

Agustin,

You bring up an interesting point for modeling applications.
At the present time, there is so much going on with respect that
we are not working on developing a new framework for modeling
in GRASS. What we have been very successful in is using grass
as a kind of "front-end" processor to develop/analyze/display data
for use in complex stand-alone models. In our experience this is
the best of both worlds. It is not really time-consuming to write
either scripts or C programs for this type of data development.
In this way, a user can use whatever model they are comfortable
with, using grass for data development and display.

For example, we use grass to develop input data into the SWAT
watershed hydrology model. SWAT is a very large and complex
model, but using grass we significantly cut down the time to develop
inputs and analyze results spatially. Other good examples of this
type of approach are answers and agnps. This also allows us to
use standard and accepted models to get results. It also does away
with having to learn what would undoubtedly be a very large and
complex system in order to handle any sort of modeling. (I still use
mapcalc and binfer for these types of things.)

If you have any ideas/suggestions/comments, feel free to let us know.

Thanks!

Bruce

Agustin Lobo wrote:

Well, I would not say that is "ideal", it is possible.
Actually, writing (i.e. population or metapopulation) models
in C (or C++) is far from ideal, as writing the code tends to
imply too much time devoted to "low level" (not a fair term, but an
usual one) programming and the resulting code uses to be
too obscure for others to read (often it's easier to
write your own program in C than reading it afterwards).

A closer-to-ideal situation would be having an script language, from
which you can call grass programs. I wrote a model
for gap dynamics in a neotropical forest using the c-shell
and calling grass functions. It was better (easier and faster) than
using C, but the code was almost as cryptic. Another problem
was the very limited power of the c-shell to manage
arrays (only 1-D) and to make computations (only integers), which
had to solve by using awk sometimes.

Now there are other script languages than could be better, i.e.,
like perl, does anybody have experience at integrating grass
commands within a perl script?

Finally, I explored the possibility of using Splus (R is now a
free alternative and mostly compatible) programs, as Splus (or R)
can issue OS commands. Therefore, it is possible, from within an
Splus program, run i.e. r.stats and read in the result into
an S array and make computations. But the communication is
through files.

In any case, I think that the (near) future of Grass should contemplate
the use of an scripting language for modeling. Is anybody at Baylor
working in this direction?

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo@ija.csic.es
http://pangea.ija.csic.es/alobo

On Tue, 26 Oct 1999, Roy Sanderson wrote:

> Hello
>
> Colleagues of mine have been using GRASS for several years to model red and
> grey squirrel populations under different forest management regimes, and
> various control measures for grey squirrels. Grass is ideal for this type
> of work, especially since you can integrate your own process-based
> population models (we write ours in C) into the Grass environment.
>
> Roy
>
> At 04:32 pm 26/10/99 +0200, you wrote:
> >Hello (again)
> >
> >I'm wondering if anybody of the grass-community has used Grass combined
> >with forestry --> modelling and planning etc.
> >
> >
> >
> >sincerely Kjell-Olav
> >
> >
> >
>
> ----------------------------------------------------------------------------
> Roy Sanderson
> Centre for Land Use and Water Resources Research
> Porter Building
> University of Newcastle
> Newcastle upon Tyne
> NE1 7RU
> United Kingdom
>
> Tel: +44 191 222 7789
> Fax: +44 191 222 6563
> r.a.sanderson@newcastle.ac.uk
> URL: http://www.cluwrr.ncl.ac.uk
> ----------------------------------------------------------------------------
>

Kjell-Olav,

We use grass in connection with more RS-oriented
packages on one hand and with statistical packages
on the other for forest maping and forest
inventory from remotelly-sensed imagery
and field data.

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo@ija.csic.es
http://pangea.ija.csic.es/alobo

On Tue, 26 Oct 1999, kjell-olav.bjerknes wrote:

Hello (again)

I'm wondering if anybody of the grass-community has used Grass combined
with forestry --> modelling and planning etc.

sincerely Kjell-Olav

On Tue, 26 Oct 1999, Agustin Lobo wrote:

Well, I would not say that is "ideal", it is possible. Actually, writing
(i.e. population or metapopulation) models in C (or C++) is far from
ideal, as writing the code tends to imply too much time devoted to "low
level" (not a fair term, but an usual one) programming and the resulting
code uses to be too obscure for others to read (often it's easier to write
your own program in C than reading it afterwards).

  Ah, you bring back memories of my graduate school days! I learned to
program in FORTRAN, and no one commented the code because that meant
punching more Hollerith cards on the 029 keypunch. The closest we came was
to make lines with a felt-tip marker across the top of the deck. That way,
if we dropped the cards, we could put them back in order fairly quickly.

  It was only when I moved to microcomputers and C (in the mid-1980's) that
I learned the value of commenting code. Scientists aren't taught this;
programmers are.

  My code now is at least 50% comments; often much more. I explain why I did
something a certain way or what I was trying to accomplish. The effort is
repaid manyfold when I look at old code years later. :slight_smile:

Finally, I explored the possibility of using Splus (R is now a free
alternative and mostly compatible) programs, as Splus (or R) can issue OS
commands. Therefore, it is possible, from within an Splus program, run
i.e. r.stats and read in the result into an S array and make computations.
But the communication is through files.

  I've know of S-Plus and I just discovered R. I think that it would be
ideal to link GRASS and R for analytical purposes.

Rich

Dr. Richard B. Shepard, President

                       Applied Ecosystem Services, Inc. (TM)
              Making environmentally-responsible mining happen. (SM)
                       --------------------------------
            2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com

On Tue, 26 Oct 1999, Agustin Lobo wrote:

Now there are other script languages than could be better, i.e.,
like perl, does anybody have experience at integrating grass
commands within a perl script?

Despite what others may think or say perl is an excellant language for
simple to very complex projects. It is only as obscure as you want it to
be. Since perl was developed because of a lack in shell and filter
programming I'd say it would work, generating and passing commands, to
GRASS. There are statistical, and matrix modules already available for
perl (OpenSource of course) which would make custom applications very
easy. There is already modules for PostgreSQL (which has come up in
another thread) plus most of the other RDBMS engines avaliable.

Finally, I explored the possibility of using Splus (R is now a
free alternative and mostly compatible) programs, as Splus (or R)
can issue OS commands. Therefore, it is possible, from within an
Splus program, run i.e. r.stats and read in the result into
an S array and make computations. But the communication is
through files.

With perl it can be pipes or files or even by using backticks.

I'm a perl fan and font junkie, with a proclivity for GIS, maps, and
databases.

Rod
--
Roderick A. Anderson
raanders@altoplanos.net Altoplanos Information Systems, Inc.
Voice: 208.765.6149 212 S. 11th Street, Suite 5
FAX: 208.664.5299 Coeur d'Alene, ID 83814

Finally, I explored the possibility of using Splus (R is now a
free alternative and mostly compatible) programs, as Splus (or R)
can issue OS commands. Therefore, it is possible, from within an
Splus program, run i.e. r.stats and read in the result into an S
array and make computations. But the communication is through
files.

I've know of S-Plus and I just discovered R. I think that it
would be ideal to link GRASS and R for analytical purposes.

Alternatively, R has a batch mode that can be called from the shell. You
could actually build an R script programetrically from another app once
the data files have been created, then launch R to do batch processing
by running the script.

Since you can hack away at the base libraries by definition (they are in
the R language after all), you can get the specific output you are
looking for - I'm doing exactly athat now with the linear analysis
functions. So customizing R could also be an option to facilitate
particular analysis or graphing needs, as well as the integration of the
results back into GRASS.

Perhaps more relevant to GRASS users is a documentation project for R
that is still in planning stages, which will be aimed at producing short
but useful 'task help' documents to explain common R tasks, with a focus
towards specific user communities. I can follow up with a post as this
project develops.

Cheers,

Pete

--
Pete St. Onge
pete@seul.org