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 am trying to run the Area Solar Radiation tool using a Python script, because I want to run it on several DEMs at once. I am using a server with Windows 7, ArcGIS 10 and PyScripter.

I am a beginner with Python and ArcGIS and for some reason my script doesn't work. In most of my attempts I end up with an error saying that there is a problem with executing AreaSolarRadiation. When I try running it on only one DEM it runs OK, but the outputs are empty files.

My guess is that there is some problem either with the glob command, the command, or simply with the solar radiation command. But really I have no clue.

This is my script:

#Description: Derives incoming solar radiation from a raster surface.
#Outputs a global radiation raster and optional direct, diffuse and direct duration rasters
#for a specified time period. (April to July).
#Requirements: Spatial Analyst Extension
#Author: ESRI

#Import system modules
import arcpy
from arcpy import env
from import *

#Check out the ArcGIS Spatial Analyst extension license

#To run on many shapefiles in one folder
import glob

#Set environment settings


# Set local variables
inRaster = name
latitude = 51
skySize = 200
timeConfig = TimeMultipleDays(2008, 5, 160)
dayInterval = 14
hourInterval = 0.5
zFactor = 1
calcDirections = 32
zenithDivisions = 16
azimuthDivisions = 16
diffuseProp = 0.7
transmittivity = 0.4
outDirectRad = ""
outDiffuseRad = ""
outDirectDur = ""
#outDirectRad = Raster("Z:/Personal/My Dropbox/GISwork_DQ_JJS/Analysis/UK/Results/microRep/GISoutput/AreaSolRad/outDirectRad")
#outDiffuseRad = Raster("Z:/Personal/My Dropbox/GISwork_DQ_JJS/Analysis/UK/Results/microRep/GISoutput/AreaSolRad/outDiffuseRad")
#outDirectDur = Raster("Z:/Personal/My Dropbox/GISwork_DQ_JJS/Analysis/UK/Results/microRep/GISoutput/AreaSolRad/outDirectDur")

# Execute AreaSolarRadiation
outGlobalRad = AreaSolarRadiation(inRaster, latitude, skySize, timeConfig, dayInterval, hourInterval, "NOINTERVAL", zFactor, "FLAT_SURFACE", calcDirections, zenithDivisions, azimuthDivisions, "UNIFORM_SKY", diffuseProp, transmittivity, outDirectRad, outDiffuseRad, outDirectDur)

# Save the output"Z:/Personal/MyDropbox/GISwork_DQ_JJS/Analysis/UK/Results/microRep/GISoutput/AreaSolRad/outGlobalRad.tif")

The last error message is:

ExecuteError: ERROR 999999: Error executing function. Failed to open raster dataset

Failed to execute (AreaSolarRadiation).

share|improve this question

closed as unclear what you're asking by PolyGeo Feb 22 '15 at 21:54

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. 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.

What is the exact error message(s) you are getting? – Chad Cooper Mar 22 '12 at 17:42
This is the last one: ExecuteError: ERROR 999999: Error executing function. Failed to open raster dataset Failed to execute (AreaSolarRadiation). – Juanjost Mar 22 '12 at 17:57
HA! Classic. The 'ole 999999. – Chad Cooper Mar 22 '12 at 18:11
How many DEMs do you want to run at once? If it's not too many, you can just use the batch version of Area Solar Radiation. Also, a possible alternative to glob is ListRasters (…). – Baltok Mar 22 '12 at 19:30
Could you edit your question to include any clarifications/outcomes that resulted from the last comment, please? – PolyGeo Feb 22 '15 at 21:54