[GRASS-SVN] r71516 - grass-addons/grass7/raster/r.sun.daily
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 30 14:57:58 PDT 2017
Author: annakrat
Date: 2017-09-30 14:57:58 -0700 (Sat, 30 Sep 2017)
New Revision: 71516
Modified:
grass-addons/grass7/raster/r.sun.daily/r.sun.daily.py
Log:
r.sun.daily: compute the sum after all maps are computed, don't use the same input and output in mapcalc expression
Modified: grass-addons/grass7/raster/r.sun.daily/r.sun.daily.py
===================================================================
--- grass-addons/grass7/raster/r.sun.daily/r.sun.daily.py 2017-09-30 21:56:12 UTC (rev 71515)
+++ grass-addons/grass7/raster/r.sun.daily/r.sun.daily.py 2017-09-30 21:57:58 UTC (rev 71516)
@@ -358,7 +358,7 @@
Sum up multiple raster maps
"""
maps = '+'.join([basename + suf for suf in suffixes])
- grass.mapcalc('{sum_} = {sum_} + {new}'.format(sum_=sum_, new=maps),
+ grass.mapcalc('{sum_} = {new}'.format(sum_=sum_, new=maps),
overwrite=True, quiet=True)
@@ -468,7 +468,6 @@
# Parallel processing
proc_list = []
proc_count = 0
- suffixes = []
suffixes_all = []
days = range(start_day, end_day + 1, day_step)
num_days = len(days)
@@ -494,7 +493,6 @@
proc_list[proc_count].start()
proc_count += 1
- suffixes.append(suffix)
suffixes_all.append(suffix)
if proc_count == nprocs or proc_count == num_days or count == num_days:
@@ -507,19 +505,19 @@
if exitcodes != 0:
core.fatal(_("Error while r.sun computation"))
- if beam_rad:
- sum_maps(beam_rad, beam_rad_basename, suffixes)
- if diff_rad:
- sum_maps(diff_rad, diff_rad_basename, suffixes)
- if refl_rad:
- sum_maps(refl_rad, refl_rad_basename, suffixes)
- if glob_rad:
- sum_maps(glob_rad, glob_rad_basename, suffixes)
-
# Empty process list
proc_list = []
- suffixes = []
+ if beam_rad:
+ sum_maps(beam_rad, beam_rad_basename, suffixes_all)
+ if diff_rad:
+ sum_maps(diff_rad, diff_rad_basename, suffixes_all)
+ if refl_rad:
+ sum_maps(refl_rad, refl_rad_basename, suffixes_all)
+ if glob_rad:
+ sum_maps(glob_rad, glob_rad_basename, suffixes_all)
+
+
# FIXME: how percent really works?
# core.percent(1, 1, 1)
More information about the grass-commit
mailing list