Advertisement

01.08.2008 at 03:56PM PST, ID: 23068228
[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!

6.6

Modify Python Script for more automation

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

Tags:

Hello, I have been using the code below with success with ESRI ArcMap 9.2. However, I'd like to know how to add some more automation to this script.  Currently I run this from the command line like this:

C:\Python24\python "C:\Documents and Settings\user\Desktop\test.py" LANDCOVERfileLIST DONUTfileLIST

So each time I want to run this I need to create a list of files to use and then enter their location in the statement above and run. I also change the 'new_name' field each time in the body of the script.  I need the count appended to the end to be the way it is, it currently matches the ID of the files.  I have six (and counting)  sets of landcover files each in their own folder and each with a unique name and numbered 1 - 71 and then I have one set of Donut files each numbered 1 -71. So in the end I'll have 6 sets of files now named new_name01, newname02, etc. How can I set this up to be more automatic?

Can I?
-make so I just use the folders where the files are located and have a name derived from folder name?
-make a long list with file locations and somehow have the outnames change for every set and the numbers stay in sync?
-do this someother way that is more elegant than I currently think of?

I appreciate annotated code  and instructions so that I can learn more about python, etc.
Thank you,
MJ

# Multi_Output_Map_Algebra_sample.py
# Description:
#   Runs an expression built with the Map Algebra language.
# Requirements: None
import sys, arcgisscripting
#import sys

# Create the Geoprocessor object
gp = arcgisscripting.create()
f = open(sys.argv[1],'r')
circlefile = open(sys.argv[2],'r')
count = 1
tmpdir = 'c:\\temp\\'
try:
            for landcover in f:
                  donut = circlefile.readline()
                  
                  # Set local variables
                  Outfname = os.path.join(tmpdir, 'new_name', str(count))
                  InExpression = "CON(ISNULL(" + donut.strip() + ")," + landcover.strip() + "," + landcover.strip() + " * -1)"
                  print InExpression
                  # Check out Spatial Analyst extension license
                  gp.CheckOutExtension("Spatial")

                  # Process: MapAlgebra
                  gp.SingleOutputMapAlgebra_sa(InExpression, Outfile)

                  count = count + 1
            f.close
            circlefile.close
except:
    # If an error occurred while running a tool, then print the messages.
    print gp.GetMessages()Start Free Trial
[+][-]01.09.2008 at 07:57AM PST, ID: 20619159

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.09.2008 at 11:19AM PST, ID: 20621242

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.15.2008 at 09:29AM PST, ID: 20664530

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.15.2008 at 12:23PM PST, ID: 20666121

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 12:10AM PST, ID: 20669965

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 12:45AM PST, ID: 20670092

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 05:50AM PST, ID: 20671719

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 06:10AM PST, ID: 20671916

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 10:17AM PST, ID: 20674463

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 01:45PM PST, ID: 20676510

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 01:50PM PST, ID: 20676555

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 04:02PM PST, ID: 20677581

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 11:21PM PST, ID: 20679353

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 11:29PM PST, ID: 20679387

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.17.2008 at 01:05PM PST, ID: 20685395

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.17.2008 at 08:50PM PST, ID: 20688108

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.17.2008 at 11:23PM PST, ID: 20688571

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.22.2008 at 11:15PM PST, ID: 20721368

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.22.2008 at 11:51PM PST, ID: 20721498

View this solution now by starting your 7-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, Scripting Languages
Tags: Python 2.4
Sign Up Now!
Solution Provided By: pepr
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.23.2008 at 01:49PM PST, ID: 20728280

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

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