[GRASS-dev] hints for creating new module

Carlos "Guâno" Grohmann carlos.grohmann at gmail.com
Tue Mar 27 13:59:01 EDT 2007


Dear list

I am trying to create a new module for GRASS. It is a module for
calculation of surface roughness, based on dispersion of vectors
normal to planes. The planes are defined as triangles in a "cell" of
four pixels, so we can create two triangles with the diagonal of the
square, either using the UpperLeft-LowerRight diagonal or the
LowerLeft-UpperRight one. this decision is based on the differences of
the values of the pixels. the pair with less difference is chosed.
This is based on the "Regular TIN" concept of Petter Pilesjo (see
http://www.igc.usp.br/pessoais/guano/temp/pilesjo_2007_tadtm.pdf).

The idea is to calculate the vectors magnitude for all area, then
calculate the Fisher dispersion for the vector inside a sub-region
(1000x1000m grid, for instance), then assign this value to a point.
After all area is analyzed, the values of the points will be
interpolated. Low dispersion values indicate low roughness, while high
dispersion indicates high roughness (the concept is found in:

Hobson, R. D. 1972, Surface roughness in topography: quantitative
approach. In: Chorley, R. J. (ed.)  Spatial analysis in geomorphology,
Methuer, London: 225-245

So far, I managed to modify the source of r.surf.area to calculate the
vectors magnitude, but for the next step, I need your advice.

what is better: create temporary ascii files with the results (vector
magnitude, dispersion) and then call v.surf.rst via a shell script, or
store the values in variables and call rst inside the program? How to
manage temp files, and how to call other modules inside the program?

thanks


-- 
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke




More information about the grass-dev mailing list