Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create monthly average maps as described in R.Sun in Grass. I have my DSM. In reading the page on OSGEO it mentions that it is possible without showing how. Ideas? I assume I will need to write a script.

share|improve this question
We need to update the answers. Things are easier now in GRASS7 within it's temporal framework. – Nikos Alexandris Mar 29 '15 at 13:15

I guess that you need to loop over days in a month and then average. Here's attempt at a bash script. The ideas is to calculate the individual solar radiation, and then store the filenames. You can process those with r.series to calculate the monthly average.

mdoys=( 31 59 90 120 151 181 212 243 273 304 334 365 ) 
months=( 'January' 'February' 'March' 'April' 'May' 'June' 'July' 'August' 'September' 'October' 'November' 'December' )
for ((doy=1;doy<365;doy++)) do

  r.sun -s elev=elevation.dem slop=slope asp=aspect \
        beam_read=beam_${doy} diff_rad=diff_${doy} day=${doy}

  if [[ ${doy} -lt ${mdoys[${this_month}]} ]] ;  then
  if [[ ${doy} -eq ${mdoys[${this_month}]} ]] ; then
   echo ${files} > rasters_${months[$this_month]}
   # Use r.series to process the files in rasters_January, for example
share|improve this answer
BTW, I haven't tested it on GRASS, proceed with caution! :) The logic seems to hold, though! – Jose Jun 13 '11 at 23:20
Just saw this. +1 for indexing in bash. Looks like Python, a bit :-). – Nikos Alexandris Mar 29 '15 at 13:13

Here a link to a plain shell script (rather than the bash solution of Jose's comment):

Get there:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.