|
POST
|
Exponent (power) map algebra operator is ** not ^. Here's the list (see Power). Furthermore, Exp(grid) is a function, so there is no need for ^ or **. 1/(1+Exp(3.642-1.502*"Z BIN"-0.784*"SALINITET BIN"-0.619*"Vs_aspect BIN"-0.004*"Distance to Water"-0.738*"DRENAZA BIN"-1.029*"Poljski_Vodni_Kapacitet BIN")) or possibly (but untested): 1/(1+math.e**(3.642-1.502*"Z BIN"-0.784*"SALINITET BIN"-0.619*"Vs_aspect BIN"-0.004*"Distance to Water"-0.738*"DRENAZA BIN"-1.029*"Poljski_Vodni_Kapacitet BIN"))
... View more
03-26-2015
01:18 PM
|
1
|
1
|
3868
|
|
POST
|
The way it is now, you've listed some feature classes in the variable 'fc', listed some feature classes in your workspace into the variable 'vertices', destroyed the 'fc' list, and are looping through everything in 'vertices' in a new variable called 'fc'. I think you may want: import arcpy, os
#array of files to be processed
fcs = ['D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W187North', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN2W188', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E180', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E190', 'D:\\Broomfield.Lidar\\HARN_Vertices.gdb\\VertexN3E191']
outputFolder = r'C:\junk' # or whatever you choose
for fc in fcs:
fcName = os.path.basename(fc) # returns 'VertexN2W187North', etc.
arcpy.MinimumBoundingGeometry_management(fcName, os.path.join(outputFolder, fcName + "_Poly"), "RECTANGLE_BY_AREA", "ALL", "", "NO_MBG_FIELDS")
... View more
03-26-2015
11:34 AM
|
0
|
1
|
1991
|
|
POST
|
Just curious, are you using 32- or 64-bit Python? I can't seem to shake these Memory Errors with 32-bit. Any more than 10,000 x 10,000 comparisons returns an error, but I may be sloppy managing memory. edit: or when you say you worked around it, do you mean you processed chunks at a time?
... View more
03-25-2015
02:25 PM
|
1
|
1
|
1525
|
|
POST
|
Oh, you may want to check Tabulate Area. With both of these, if you have overlapping polygons, you will have to process zone features individually, since the zones are converted to raster (flattened), internally.
... View more
03-25-2015
02:22 PM
|
0
|
0
|
2192
|
|
POST
|
This thread is getting too long to read, so sorry if this has been mentioned and/or ruled out. You may be able to save yourself some time by Merging (that is, edit merge) or Dissolving all lines into one massive multipart polygon, then Exploding or running Multipart to Singlepart to separate into touching clusters. Finally, Spatial Join named segments to clusters. You will have to manually inspect clusters that should have more than one name.
... View more
03-25-2015
01:35 PM
|
0
|
1
|
1492
|
|
POST
|
Sorry to say, but I can't reproduce your error. I'm using version 6.0 for 10.2. I don't see anything wrong with your syntax - the backslash situation in the call to ETS_GPIDW raised an eyebrow, but I could also save to \Sal.img and \pSal.img, so I don't think that's it. This works for me: import arcpy
arcpy.ImportToolbox(r'C:\Program Files (x86)\ET SpatialTechniques\ET Surface 6.0 for ArcGIS 10.2\ET Surface.tbx')
arcpy.ETS_GPIDW("C:\junk\csv_points.shp", "C:\junk\idw.img", "Elev", 25, 2, 12, 2000)
... View more
03-25-2015
10:04 AM
|
0
|
0
|
831
|
|
POST
|
If you're feeling brave, install PySAL and use the natural breaks function once you have a list of values (get using a SearchCursor, or better yet FeatureClassToNumPyArray). I'd consider this an advanced manoeuvre which would probably spawn many more questions, but worth noting.
... View more
03-25-2015
09:23 AM
|
1
|
0
|
2715
|
|
POST
|
Probably not possible in batch processing. Possibly possible in model builder using an iterator. Definitely possible using python.
... View more
03-25-2015
07:51 AM
|
1
|
0
|
3429
|
|
POST
|
Hmmm, well my numpyNear() function gives 'MemoryError' at around 10,000 points. Whether that's due to SciPy or my setup, I don't know. edit: I see you said comparisons, so I guess that's about in line with 10,000 points compared to itself: 100,000,000 distance comparisons.
... View more
03-24-2015
03:39 PM
|
0
|
3
|
1525
|
|
POST
|
No, you're right, it isn't apples-to-apples (I meant to say so). stat_points() is much more fully functional, but that comes at a cost. My main observation was that your pure numpy method is likely done behind the scenes using scipy, which comes at its own cost.
... View more
03-24-2015
03:24 PM
|
0
|
5
|
1525
|
|
POST
|
Just ran a quick test between stat_point() and the following function for 1,000 points and the results are: stat_point() - 29s, numpyNear() - 0.5s. Almost of the stat_point() time is due to calls to arcpy.Describe (14.1s) and arcpy.AddField (14.7s), so the numpy stuff isn't the problem. ... def numpyNear(fc):
... npArray = arcpy.da.FeatureClassToNumPyArray(fc,["OID@","SHAPE@XY"])
... distArray = scipy.spatial.distance.pdist(npArray['SHAPE@XY'],'euclidean')
... sqDistArray = scipy.spatial.distance.squareform(distArray)
... nearFID = npArray['OID@'][numpy.argsort(sqDistArray)[:,1]].transpose()
... npAppend = numpy.lib.recfunctions.append_fields(npArray,'NearFID',nearFID)
... nearDist = numpy.sort(sqDistArray)[:,1].transpose()
... npAppend = numpy.lib.recfunctions.append_fields(npAppend,'NearDist',nearDist)
... outFC = r'in_memory\outPts'+str(random.random()*1000)
... outFeat = arcpy.da.NumPyArrayToFeatureClass(npAppend,outFC,"SHAPE@XY")
... arcpy.CopyFeatures_management(outFC,r'in_memory\numpy_Pts')
... View more
03-24-2015
03:06 PM
|
0
|
7
|
3560
|
|
POST
|
I should probably read this more closely, but I've used scipy.spatial.distance.pdist for approximately what I think may be happening in lines 43-45 (pairwise distances?).
... View more
03-24-2015
02:27 PM
|
0
|
9
|
3560
|
|
POST
|
See this help page for how to use the Check Values button to generate output file names, based on inputs:
... View more
03-24-2015
01:55 PM
|
0
|
2
|
3429
|
|
BLOG
|
Spoiler alert: on the same 1,000 point feature class, it took ArcPy over 3 minutes to do what NumPy/SciPy accomplished in 0.5 seconds. Near Analysis: ArcPy vs. NumPy/SciPy | Darren's Side Projects
... View more
03-23-2015
04:01 PM
|
0
|
0
|
1240
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|