[GRASS-SVN] r58035 - grass-addons/grass7/raster/r.skyview
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 17 19:49:07 PDT 2013
Author: annakrat
Date: 2013-10-17 19:49:06 -0700 (Thu, 17 Oct 2013)
New Revision: 58035
Modified:
grass-addons/grass7/raster/r.skyview/r.skyview.py
Log:
r.skyview: stop script when r.horizon fails; added input value checking
Modified: grass-addons/grass7/raster/r.skyview/r.skyview.py
===================================================================
--- grass-addons/grass7/raster/r.skyview/r.skyview.py 2013-10-17 21:22:22 UTC (rev 58034)
+++ grass-addons/grass7/raster/r.skyview/r.skyview.py 2013-10-18 02:49:06 UTC (rev 58035)
@@ -31,6 +31,7 @@
#% type: integer
#% required: yes
#% answer: 16
+#% options: 2-64
#%end
#%option
#% key: maxdistance
@@ -58,12 +59,13 @@
n_dir = int(options['ndir'])
horizon_step = 360. / n_dir
- if horizon_step < 1:
- gcore.fatal(_("Please decrease the number of directions."))
+ tmp_rast_name_hor = 'tmp_horizon_' + str(os.getpid())
+ ret = gcore.run_command('r.horizon', elevin=elev, direction=0, horizonstep=horizon_step,
+ horizon=tmp_rast_name_hor, flags='d')
+ if ret != 0:
+ gcore.fatal(_("r.horizon failed to compute horizon elevation angle maps. "
+ "Please report this problem to developers."))
- tmp_rast_name_hor = 'tmp_horizon_' + str(os.getpid())
- gcore.run_command('r.horizon', elevin=elev, direction=0, horizonstep=horizon_step,
- horizon=tmp_rast_name_hor, flags='d')
gcore.info(_("Computing sky view factor ..."))
new_maps = gcore.mlist_grouped('rast',
pattern=tmp_rast_name_hor + "*")[gcore.gisenv()['MAPSET']]
More information about the grass-commit
mailing list