|
POST
|
Dask is pretty useful, I've played around with it, but need to get up to speed as it's being used as the distributed processing engine in v.2 of the Aust. Geoscience Data Cube API. I'll look at memmap again, didn't realise the limit was no longer there. For most of what I do, reading to array then writing to memmap file, then reading in again just increases the amount of IO, but for larger timeseries it would be useful, or especially for windowed operations (aka focal in ArcGIS terminology) so no need to handle tiling edge effects.
... View more
05-22-2016
04:54 PM
|
1
|
2
|
2459
|
|
POST
|
I tend to read rasters directly to arrays in memory as chunks both because of the 2GB memmap limit and because it avoids the doubling up of file system IO (reading it in, saving it back out to npy, reading it back in). But I'm usually dealing with large stacks of timeseries data. Horses for courses
... View more
05-19-2016
08:23 PM
|
0
|
5
|
2459
|
|
POST
|
Rebecca, the RasterToNumpyArray function supports extracting smaller chunks from the raster using the {lower_left_corner}, {ncols}, {nrows} parameters: RasterToNumPyArray (in_raster, {lower_left_corner}, {ncols}, {nrows}, {nodata_to_value}) So you could loop through and reclass a smaller array each time.
... View more
05-19-2016
06:25 PM
|
0
|
8
|
5815
|
|
POST
|
It's the closest you'll get to a proper matrix/spreadsheet in the ArcPy/geoprocessing framework. Otherwise you'll have to use an external GUI toolkit, like Qt. What do you mean "some kind of trick"?
... View more
05-18-2016
08:12 PM
|
0
|
0
|
5424
|
|
POST
|
I discounted a GPValueTable originally, but went back after your post and tried it and seems to do what the OP wants. # import modules
import arcpy
import numpy as np
class Toolbox(object):
def __init__(self):
self.label = "SomeToolbox"
self.alias = "SomeToolbox"
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
def __init__(self):
self.label = "SomeTool"
self.description = "SomeTool"
self.canRunInBackground = False
def getParameterInfo(self):
param = arcpy.Parameter(
displayName='The Matrix',
name='TheMatrix',
datatype='GPValueTable',
parameterType="Required",
direction="Input")
param.columns = [['GPString', 'Name'], ['Double', 'BinaYog'], ['Double', 'FiberHat'], ['Double', 'ElektrikHat'], ['Double', 'KaraYolu']]
param.values = [['BinaYog',1,0,0,0],['FiberHat',0,1,0,0],['ElektrikHat',0,0,1,0],['KaraYolu',0,0,0,1]]
return [param]
def execute(self, parameters, messages):
#row[1:] strips off the 1st column
matrix = np.array([row[1:] for row in parameters[0].values],
dtype=np.float32)
messages.addMessage(matrix) EDIT: added code to show how to turn the Value Table into a numpy array.
... View more
05-15-2016
04:11 PM
|
1
|
2
|
5425
|
|
POST
|
Not with a python script tool or toolbox. You could build a custom form with pyside/pyqt and use a QTableWidget for the matrix.
... View more
05-14-2016
08:47 PM
|
0
|
0
|
5425
|
|
POST
|
Just use `return` to exit the current function import sys,os
import arcpy
import pythonaddins
class btnThatDoesSomething(object):
def onClick(self):
# df = etc...
if df.spatialReference.name not in ("NAD_1983_BC_Environment_Albers", "NAD 1983 BC Environment Albers"):
pythonaddins.MessageBox("Change dataframe spatial reference to NAD_1983_BC_Environment_Albers and re-run tool", "Report Generator")
return
# Rest of script
... View more
05-08-2016
03:58 PM
|
1
|
0
|
1793
|
|
POST
|
lpinner wrote: But it's a lot a stuff to install and configure... And then you have to deal with a python/ArcObjects frankenhybrid
... View more
04-20-2016
08:10 PM
|
0
|
0
|
1325
|
|
POST
|
Possibly... ArcObjects is the only way to do what the OP wants and using COM via comtypes is the most used (by python people) way of accessing AO (there's also the .NET route using pythonnet). But it's a lot a stuff to install and configure...
... View more
04-20-2016
03:09 PM
|
3
|
3
|
1325
|
|
POST
|
You need ArcObjects. Don't fret All is not lost... How do I access ArcObjects from Python? - Geographic Information Systems Stack Exchange Arcobjects in Python script tool to suppress the Save dialog
... View more
04-19-2016
07:25 PM
|
2
|
5
|
6150
|
|
POST
|
You can install them to users computers in the usual way or put them in the same folder as the script and python will find them automatically or you can put them anywhere you like and tell python where to find them at runtime using sys.path.append('path/to/parent/folder') before you import them. If the 3rd party packages contain compiled binary libraries, ie. pyd or dll files, you'll probably need to do some os.environ['PATH'] manipulation as well.
... View more
04-17-2016
03:16 AM
|
1
|
0
|
726
|
|
POST
|
Clicked submit too soon and can't edit my previous comment on the mobile GeoNet site... The print statement after yo needs to be indented 4 spaces further than the except clause. Move the except back until it's indented the same as the try, then move the print back. Should look something like : try: with arcpy.da.UpdateCursor etc... for row etc... etc... except Exception as e: print e.message Better yet... Remove the try/except completely so you get a proper exception traceback if something goes wrong.
... View more
04-05-2016
05:44 AM
|
1
|
1
|
2492
|
|
POST
|
Your except clause is indented too far. It should be the same indentation as the try clause.
... View more
04-05-2016
05:29 AM
|
1
|
1
|
2492
|
|
POST
|
Write a batch/python script that changes registry settings. Admin rights are not required if you're only changing values in HKEY_CURRENT_USER. If they were, you wouldn't be able to change the settings via the ArcGIS GUI either...
... View more
04-02-2016
08:11 PM
|
1
|
2
|
2318
|
|
POST
|
A very quick google (that you could have done yourself) returns these two links which look promising: An ArcGIS toolbox - http://www.digital-geography.com/ahp-arcgis-10-x-using-python A QGIS plugin - https://plugins.qgis.org/plugins/EasyAHP (source: https://github.com/MSBilgin/EasyAHP)
... View more
03-30-2016
04:33 PM
|
1
|
0
|
9347
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |