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")
No comments:
Post a Comment