[GRASS-dev] Addons: r.sun2 segfault with -s

hi again,

while r.horizon is working in both modes, some troubles with r.sun2:

Spearfish data set:

g.region rast=elevation.dem -p

# took these values from the manuak page:
r.horizon elevation.dem step=30 e_buff=20 horizon=horangle dist=0.7 \
              maxdistance=4000

r.sun2 -s elevation.dem horizon=horangle aspin=aspect slopein=slope \
          glob_rad=global_rad day=180 time=14
Mode 1: instantaneous solar incidence angle & irradiance using a set local
time

Segmentation fault

GRASS 6.4.svn (spearfish60):~/grass64 > gdb r.sun2
GNU gdb 6.6-3mdv2008.0 (Mandriva Linux release 2008.0)
...
This GDB was configured as "x86_64-mandriva-linux-gnu"...
Using host libthread_db library "/lib64/libthread_db.so.1".
(gdb) r -s elevation.dem horizon=horangle aspin=aspect slopein=slope
glob_rad=global_rad day=180 time=14
...
Mode 1: instantaneous solar incidence angle & irradiance using a set local
time

  0%
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46932323701152 (LWP 7370)]
0x0000000000409afc in lumcline2 (sungeom=0x7fff6a09d610,
sunVarGeom=0x7fff6a09d5b0, sunSlopeGeom=0x7fff6a09d580,
   gridGeom=0x7fff6a09d720, horizonpointer=0x0) at rsunlib.c:383
383 horizonHeight = invScale*(

I assume that horizonpointer=0x0 is no good thing.

Without -s it works.

Any ideas,
Markus

On Fri, Sep 26, 2008 at 9:04 AM, Markus Neteler <neteler@osgeo.org> wrote:

hi again,

while r.horizon is working in both modes, some troubles with r.sun2:

Spearfish data set:

g.region rast=elevation.dem -p

# took these values from the manuak page:
r.horizon elevation.dem step=30 e_buff=20 horizon=horangle dist=0.7 \
             maxdistance=4000

r.sun2 -s elevation.dem horizon=horangle aspin=aspect slopein=slope \
         glob_rad=global_rad day=180 time=14
Mode 1: instantaneous solar incidence angle & irradiance using a set local
time

Segmentation fault

Thomas Huld from JRC has fixed it:
- catching the missing horizonstep parameter above (horizonstep=30)
- additionally a bugfix for horangle map name scheme (before it wasn't picking
  up the horangle maps due to a name flaw, there was a Warning, tough).

r.sun2 seems to be fine now.
I would suggest that we substitute r.sun in GRASS 7 with r.horizon and
r.sun2 (renamed
to r.sun there).

Markus