[GRASS-user] Looping r.sun.hourly with Python script fails

umberto.minora umberto.minora at unimi.it
Wed Apr 1 01:57:34 PDT 2015


I am trying to loop 'r.sun.hourly' over all the days of the year.
I am interested in deriving hourly shadow maps (the binary version of
'beam_rad_basename' argument) for all the year.
Anyway, I am receiving this error:

Traceback (most recent call last):
  File "D:\UMBE\PhD\Nepal\khumbu_article\shadow\r.sun.hourly
\r.sun.hourly_daily_script.py", line 16, in <module>
    r.sun.hourly(flags="b",
AttributeError: 'Module' object has no attribute 'hourly'

My guess is that 'r.sun'hourly' addon is not implemented into pygrass after
installation. if so, how can I add it to be recognized by pygrass?
The initial part of my script is below, and the way I call it is by typing
the path and name of my ".py" file into the grass console (is there a better
way?).
Thanks for any help or suggestion.

    from grass.pygrass.modules.shortcuts import raster as r
    from grass.pygrass.modules.shortcuts import imagery as i

    dem= "khumbu_dem"
    aspect= "khumbu_aspect"
    slope= "khumbu_slope"

    month=['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep',
'oct', 'nov', 'dec']
   
day_month=[range(1,32),range(32,60),range(60,91),range(91,121),range(121,152),range(152,182),range(182,213),range(213,244),range(244,274),range(274,305),range(305,335),range(335,366)]
hour=range(24)

    for m in day_month:
	    for d in m:
			    r.sun.hourly(flags="b",
					 elevation=dem,
					 aspect=aspect,
					 slope=slope,
					 start_time=0,
					 end_time=24,
					 day=d,
					 year=2014,
					 beam_rad_basename=m+ "_"+ d+ "_"+ beam)



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Looping-r-sun-hourly-with-Python-script-fails-tp5196404.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list