Advertisement

08.21.2008 at 11:30AM PDT, ID: 23667948
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

Python script - "memory could not be written" error

Asked by mgjust in Python Scripting Language, GIS & GPS Programming

Hello,
The attached image has the error message and I am using the script below. However, this error is not endemic to this script. I am assuming its because the execution of the script (and others) uses the memory cumulatively and then finally there is none left. It happens to me I think because I have lots of iterations on 'big' files. I am also a novice (cut and paster) when it comes to script building. Perhaps there is a way to not have this memory problem with some tweaking of the script? It'd be nice to fix this, for example, with this operation its taking about 8 minutes an area * 412 areas ~ 54 hours. But it keeps stopping usually while I am not at the office. Also, I'll often then need to restart my computer, otherwise Python will just crash.

Any suggestions?
-MJStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
# Import system modules
import sys, string, os, arcgisscripting
 
# Create the Geoprocessor object
gp = arcgisscripting.create()
 
gp.workspace = "C:\\GISWORK\\DEMS\\dems_clips_all"
outfolder = "C:\\GISWORK\\DEMS\\insolation"
count=176
 
# Check out any necessary licenses
gp.CheckOutExtension("spatial")
 
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")
 
# Set local variables
inDEM = gp.ListRasters("gr_dem_*","GRID")
DEM = inDEM.Next()
outGlobalRaster = outfolder+"\\glo_"
outDirectRaster = outfolder+"\\dir_"
outDiffuseRaster = outfolder+"\\dif_"
outDurationRaster = outfolder+"\\dur_"
while DEM:
    count+= 1
    output1=outGlobalRaster + str(count).zfill(3)
    output2=outDirectRaster + str(count).zfill(3)
    output3=outDiffuseRaster + str(count).zfill(3)
    output4=outDurationRaster + str(count).zfill(3)
    # Process: AreaSolarRadiation...
    gp.AreaSolarRadiation(DEM, output1, "", "", "WholeYear 2007", "", "", "INTERVAL", "", "", "", "", "", "", "", "", output2, output3, output4)
    DEM = inDEM.Next()
Attachments:
 
Python error image
Python error image
 
[+][-]08.21.2008 at 12:56PM PDT, ID: 22283722

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Python Scripting Language, GIS & GPS Programming
Sign Up Now!
Solution Provided By: pepr
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.23.2008 at 07:09AM PDT, ID: 22296999

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628