|
POST
|
Also, there is some good information on this topic in StackExchange: How can I more efficiently select related records?
... View more
10-30-2014
11:45 AM
|
0
|
2
|
1832
|
|
POST
|
Are you using ArcGIS 10.1 or greater? If so, I encourage you to give the cursors in the arcpy data access (arcpy.da) module a try. The data access cursors are more robust and may not crash as easily.
... View more
10-30-2014
11:01 AM
|
1
|
4
|
1832
|
|
POST
|
Does your shapefile workspace only have shapefiles and your raster workspace only have rasters? That is how it looks with znshp and grd. If that is the case, your listing of shapefiles will return nothing in the first pass of the ws loop, which means the second loop won't execute. What about changing zonal_climate_fire to accept the shapefile and raster workspaces as arguments:
def zonal_climate_fire(rasWS, shpWS):
arcpy.env.workspace = rasWS
rasterlist = arcpy.ListRasters()
arcpy.env.workspace = shpWS
shplist = arcpy.ListFeatureClasses()
for k in rasterlist:
for i in shplist:
out_tbl = tbl + "\\" + k + "_ZStats"
print '==============================================='
print 'Zonal Statistics based on fire occurence : ' + k[6:-3]
print '......'
# Preform zonal statistics on the polygon file within the variable 'znlyr'
z = arcpy.gp.ZonalStatisticsAsTable_sa(i, InZnValFld, k, out_tbl, "DATA", "MIN_MAX_MEAN")
# Create a new field to add the filename information
arcpy.AddField_management(z, fieldname1, "DOUBLE")
# Create a new field to add the filename information
arcpy.AddField_management(z, fieldname2, "DOUBLE")
# Add the Year value from the filename to the new field
arcpy.CalculateField_management(z, fieldname1,k[6:-3])
# Add the Year value from the filename to the new field
arcpy.CalculateField_management(z, fieldname2,k[11:])
arcpy.Append_management(z, Template, "","","")
zonal_climate_fire(grd, znshp)
... View more
10-30-2014
07:27 AM
|
2
|
1
|
3831
|
|
POST
|
As Russell Brennan points out, this isn't currently possible with ArcPy. ArcGIS 10.3 adds 9 tools to the Geodatabase Administration toolset, but sadly, this still won't be possible natively through ArcPy or any Geoprocessing Tools with the new release. This is yet another reason retiring the SDE command line tools is premature. The use cases just keep piling up in the forums (sorry, GeoNet) where SDE command line tools work and nothing else is available, but Esri is doing their best David Farragut impersonation with this one. Unfortunately for those customers needing to script advanced geodatabase administration tasks, this isn't Mobile Bay and the mines will go off and cause damage. The sdelayer command should work for what you need, at least for the short while it will be around: sdelayer -o {grant | revoke} -l <table,column> -U <user> -A <SELECT,UPDATE,INSERT,DELETE> [-s <server_name>] [-i {<service> | <port#> | <direct connection>}] [-D <database_name>] -u <DB_user_name> [-p <DB_user_password>] [-I] [-q] Starting with ArcGIS 10.1, Esri decided to stop publishing the reference documentation for the tools online. If you install the tools, the reference documentation is there. Since the tools haven't changed much over the years, I usually just look up information in the ArcGIS 10.0 ArcSDE Administration Command Reference.
... View more
10-29-2014
08:49 PM
|
0
|
0
|
2027
|
|
POST
|
I don't think using the list or tuple function in the way described here will yield the desired result. In the original code snippet, I understand MyAttribute to be a single field/attribute, and that the goal is to populate that attribute with "ALL" or some other multi-character string. Since a multi-character string is iterable, passing MyValue to the tuple function will result in a tuple with multiple single-character items instead of a tuple with a single multi-character items, as demonstrated. The suggestion by Dallas Shearer works since it passes the update cursor a single item multi-character tuple, which is what I think the OP is after.
... View more
10-29-2014
06:20 PM
|
0
|
1
|
1680
|