# [GRASS-user] python scripts + HSV + r.composite

Carlos Grohmann carlos.grohmann at gmail.com
Thu Jan 20 15:13:14 EST 2011

```Hello all.

In the last days I've been working on a script trying to implement the
COLTOP method of Jaboyedoff et al., 2009

pdf here: http://www.igc.usp.br/pessoais/guano/temp/Jaboyedoff_etal_2009_Geomorph_Turtle_mountain_DEM.pdf

Basically it takes the aspect and slope, calculates the position of
this 'vector' in a stereonet (equal-angle projection, same used in
structural geology) and assign a color to the coordinates from a HSV
color space. This is then used to make a color-shaded DEM, where in
theory all possible orientations of lineaments would be visible,
overcoming the limitations of common shaded relief maps.

So I made a python script (also attached, needs to run on GRASS 7) to
calculate compass-oriented aspect values and the radius of a "pole to
line" on a stereonet. (Jaboyedoff uses "poles to planes", but I think
that using the vector defined by aspect/slope as lineations is easier
to interpret). Then I use these values  to calculate the RBG values
from the HSV colorspace (H=aspect_compass, S=slope_radius, V=fixed
value, like 0.7). After that, I multiply the results (which are given
in the 0-1 interval) by 255 and write them back to GRASS, where I use
r.composite to create the final image.

The thing is, the results I get, although you can see the method
works, are far from being as nice as the example presented in
Jaboyedoff's paper. It seems he did more than just calculate the
HSV-to-RBG. Also, it doesn't matter the value of V I use, the
r.composite output is always the same. The V value should give me
brigther or darker maps.

There is some stuff in the script that won't make to the final cut,
they are there just to check if the maps were created correctly etc.
Also there are some stuff that could be done with r.mapcalc, but i
decided to do all in python just to practice.

I'd like to get some feedback from you guys on this.

best

Carlos

--
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
http://lattes.cnpq.br/5846052449613692
Linux User #89721
________________
Can’t stop the signal.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.coltop
Type: application/octet-stream
Size: 6312 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20110120/abb5e673/r.obj
```