Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 outGlobalRad.save command, or simply with the solar radiation command. But really I have no clue.

I'd be very grateful for any corrections/advice on how to deal with this! Thanks! JJ

This is my script:

#Name: AreaSolarRadiation_example02.py
#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 arcpy.sa import *

#Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

#To run on many shapefiles in one folder
import glob

#Set environment settings
env.workspace="Z:/Personal/MyDropbox/GISwork_DQ_JJS/Analysis/UK/Results/microRep/GISoutput/PolygonToRaster/"

   folder="Z:/Personal/MyDropbox/GISwork_DQ_JJS/Analysis/UK/Results/microRep/GISoutput/PolygonToRaster/"


# 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
outGlobalRad.save("Z:/Personal/MyDropbox/GISwork_DQ_JJS/Analysis/UK/Results/microRep/GISoutput/AreaSolRad/outGlobalRad.tif")
share|improve this question
1  
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
1  
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 (help.arcgis.com/en/arcgisdesktop/10.0/help/…). –  Baltok Mar 22 '12 at 19:30

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.