|
POST
|
To demonstrate how to combine the lists (which may be of different lengths) see the following example: aList = ["a", "c", "e", "g"]
bList = ["b", "d", "f", "h", "i", "j"]
n1 = len(aList)
n2 = len(bList)
combo = []
for i in range(0, n1):
combo += [aList, bList]
if n2 > n1:
combo += bList[n1:n2]
print combo
Ensure that aList is the shorter of the two and bList is equal to or greater than aList.
... View more
04-05-2011
03:09 AM
|
0
|
0
|
1648
|
|
POST
|
Sharynh http://forums.arcgis.com/threads/27483-module-object-has-no-attribute-GetParamaterAsText spelling issues is the source of your problem
... View more
04-05-2011
02:57 AM
|
0
|
0
|
1668
|
|
POST
|
I am assuming that you are using the spatial analyst extension, if so, see the first example in this link http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z00000005000000.htm
... View more
04-05-2011
02:42 AM
|
0
|
0
|
829
|
|
POST
|
Sounds like a symbology issue, don't let the visual be your guide, you can always change it. To see if there are real differences, subtract both grids and check for numerical differences. Also ensure that you are using the same environment settings (ie cell size and extent) when running both
... View more
04-04-2011
12:05 PM
|
0
|
0
|
585
|
|
POST
|
No problem Karl I also wanted to point out that the line (end-start)/60.0 ) ensures that integer division doesn't occur. Consider the following code snippet which demonstrates the importance of ensuring that at least one of the inputs is a floating point number when performing division IF you want a floating point result.
>>> start = 0
>>> end = 10
>>> result = (end - start) / 60
>>> print result
0
>>> result_good = (end - start) / 60.0
>>> print result_good
0.166666666667
>>>
... View more
04-03-2011
03:57 AM
|
0
|
0
|
3039
|
|
POST
|
gp.AddMessage("Processing time:", (end-start)/60, "minutes") this line is wrong since it read gp.AddMessage("Processing time:" + str( (end-start)/60.0 ) + " minutes") the reason that you didn't get an error in Pythonwin is because, it simply ignored it...there may be other errors but remember print "a", "b", "c" needs to be translate to gp.AddMessage("a" + "b" + "c") until ESRI makes AddMessage more Pythonic
... View more
04-02-2011
02:35 PM
|
0
|
0
|
3039
|
|
IDEA
|
All too often, people use the Define Projection tool when they really want to use the Project tool, thinking that if they use it, their data will be projected into the coordinate system that they want. I suggest that the Define Projection tool be renamed to Initial Projection or Fix Projection something similar OR checks to prevent projected data being defined as geographic should be implemented and persistent in the interface Also, this tool should, or could be disabled, if a coordinate system already exists, allowing the user time to think about what they are really trying to do. The two proposals Initial and Fix projection could call the same code essentially, allowing one to define a coordinate system for which one doesn't exist or to fix one that is incorrect.
... View more
04-02-2011
05:56 AM
|
24
|
20
|
9141
|
|
POST
|
I suspect it depends upon the element that you wish to change, for example, the sample code in the help file found here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000000m000000.htm contains lines of code... if elm.text == "2009":
elm.text = "2010" which suggests that you could simply change it to something like this if elm.text == "2009":
elm.text = "" essentially "removing" it
... View more
03-31-2011
02:31 AM
|
0
|
0
|
4165
|
|
POST
|
and to add to that path list, it looks in the path where the main script resides, which makes it useful and easier to distribute scripts and toolboxes as one grouping in one folder
... View more
03-31-2011
12:41 AM
|
0
|
0
|
4255
|
|
POST
|
Here is a sample program that imports a user module which contains functions
'''
Main_program.py
demonstrates how to import and call functions from another module
'''
import CallingFunctions
a_list = [1,2,3,4,5,6,7,8,9,10]
print CallingFunctions.func1(a_list)
print CallingFunctions.func5(a_list)
print CallingFunctions.func8(a_list)
The module that is imported is here
'''
Callingfunctions.py
imported into another program giving it access to the functions
'''
def func1(inputs=None):
x = sum(inputs)
return "sum some numbers: ", x
'''
more functions
'''
def func5(inputs=None):
x_sq = 0
for x in inputs:
x_sq += x**2
return "sum of squares: ", x_sq
'''
more functions
'''
def func8(inputs=None):
return "hello from 8: ", inputs
'''
more functions
'''
if __name__ == "__main__":
a_list = [1,2,3,4,5,6,7,8,9,10]
inputs = "test inputs"
a_dict = {1:[func1([1,2,3]) ],
5:[func5([1,2,3])],
8:[func8("inputs to 8")]}
needed = [1,5,8]
for akey in needed:
if akey in a_list:
action = a_dict[akey]
print "\naction: ", action
if the two *.py files are located within the same directory, you can import the CallingFunctions module and use its functions from the Main_program. In this manner you can create "helper" modules that can be used by other programs. you should also note, that for testing purposes, the CallingFunctions can be run in standalone mode with the addition of the code block denoted by the "if" statement towards the end
... View more
03-30-2011
11:44 AM
|
1
|
0
|
4255
|
|
POST
|
You are encountering integer division (read all about it). To overcome this you need to cast one of the two grids to its floating point representation. In version 10, this would be accomplished by using "float" either the tool or within the raster calculator.
... View more
03-26-2011
04:56 PM
|
0
|
0
|
2353
|
|
POST
|
Did you rule out subtracting one from the other? Look for subtract or minus within the spatial analyst for your version, for example, in V10 http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z00000093000000.htm
... View more
03-26-2011
12:35 PM
|
0
|
0
|
1424
|
|
POST
|
this is the only bug associated with it http://resources.arcgis.com/content/nimbus-bug?bugID=TklNMDU5OTcy try another dataset and see if it works if you are sure that both files have the same coordinate system (hopefully you didn't use Define Projection at any step of the process...you could have defined one or more wrong)
... View more
03-25-2011
11:20 AM
|
0
|
0
|
6053
|
|
POST
|
are both files in the same coordinate system? don't rely on the view of the data since projection on the fly make things look nice, but they aren't
... View more
03-25-2011
07:35 AM
|
0
|
0
|
6053
|
|
POST
|
did you rule out adding appropriate X and Y fields (decimal etc) and use the Calculate Geometry option in the table?
... View more
03-24-2011
02:06 PM
|
0
|
0
|
1184
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-03-2017 11:39 AM | |
| 1 | 08-05-2019 05:21 PM | |
| 1 | 09-02-2016 08:05 AM | |
| 1 | 01-15-2018 01:10 PM | |
| 1 | 09-17-2018 12:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|