I am trying to optimize the speed of r.sun to compute shadowed area on a DTM at 1m resolution. My current area is 3.39 km² but my final area will be 450 km².

The r.sun wiki say that pre-computing horizons as well as lat/lon increase the model, but the opposite happen on my computer (GRASS 7.0.1RC2, Windows7 64 bits [although r.sun run in 32 bits mode], 4 CPU, 8 threads)

Here is an example:

r.sun elevation=MNEcomplet@ShadowProject day=88 time=7 incidout=incidoutD88T07 --overwrite npartitions=2 distance_step=1

==> 38 sec

r.sun elevation=MNEcomplet@ShadowProject horizon_basename=horizon horizon_step=30 day=88 time=7 incidout=incidoutD88T07 --overwrite npartitions=2 distance_step=1.0 lat=MNEcomplet.lat long=MNEcomplet.lon

==> between 56 sec and 1min7s

npartitions are different on the 2 examples (I have no choice), but this parameter has not a big impact on the computing time.

Does anyone have an idea why it has this behavior?

Testing on Grass 6.4, using horizons allows me to decrease computation time from 42-50s to 32s.

Another question is: Is there a possibility to avoid the computation of the sun angles for each cell ?

Providing a single value for the whole area would be ok for me, and I can compute it by myself

closed as too broad by PolyGeo Apr 28 '18 at 7:21

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Hi again Pierre, just for information, npartitions option was not working for shadow computation on grass6.x. Have you tried without using it ? – simo Sep 21 '15 at 18:59

Browse other questions tagged or ask your own question.