|
POST
|
So the code is erroring out on line 23? Could you post the entire error. In the UpdateCursor loop starting at line 26, you do not need to update the row every time you specify a row value. with arcpy.da.UpdateCursor(sdm_table,["OccProb","PERCENTAGE","ElSeason"]) as cursor:
for row in cursor:
row[1] = (int(row[1])/40468.383184)*100
row[2] = sdm
if row[0] == "VALUE_1":
row[0] = "Low"
elif row[0] == "VALUE_2":
row[0] = "Medium"
cursor.updateRow(row)
del cursor Also, I would delete cursors after you're done with them.
... View more
12-13-2017
01:16 PM
|
1
|
6
|
2363
|
|
POST
|
Can you post the entire code here using the 'Syntax Highlighter' in the "More" menu. We need to know what the variables you're using refer to.
... View more
12-13-2017
12:53 PM
|
1
|
1
|
2363
|
|
POST
|
The following should work. #complete path to .shp or feature class
dataset = r'path_to_dataset'
with arcpy.da.UpdateCursor(dataset, ['OPERATOR']) as cursor:
for row in cursor:
if 'ANADARKO' in row[0]:
row[0] = 'ANADARKO'
elif 'CHESAPEAKE' in row[0]: #use same elif loop for more companies
row[0] = 'CHESAPEAKE'
cursor.updateRow(row)
del cursor
... View more
12-07-2017
11:19 AM
|
2
|
0
|
2104
|
|
POST
|
Have your DBA to a SQL update to the rows every x amount of time.
... View more
12-05-2017
10:08 AM
|
0
|
1
|
18362
|
|
POST
|
What do you mean you're trying to select a .lyrx? Like, pick out a file from a directory? Or query an ArcGIS layer?
... View more
12-05-2017
07:32 AM
|
0
|
2
|
2980
|
|
POST
|
Stack Exchange has a similar question with an answer. Check it out: Using ArcPy to determine ArcMap document version?
... View more
12-01-2017
11:54 AM
|
1
|
0
|
1445
|
|
POST
|
Please read the documentation on the Merge tool. All of the geometries (features) as well as the attributes will be merged together in a single output. No data will be lost.
... View more
11-29-2017
07:47 AM
|
1
|
1
|
1060
|
|
POST
|
I would suggest using the Merge geoprocessing tool.
... View more
11-29-2017
07:40 AM
|
1
|
3
|
1060
|
|
POST
|
Are you currently using ArcGIS Online for the viewing?
... View more
11-28-2017
01:43 PM
|
0
|
2
|
1153
|
|
POST
|
What tool are you referring to? The link is not working for me.
... View more
11-27-2017
08:47 AM
|
0
|
3
|
2943
|
|
POST
|
I see... the below code may work. import arcpy, sys
from arcpy import env
from arcpy.sa import *
# Input data source
arcpy.env.workspace = r"C:/Users/Desktop/weekly_avg_project"
arcpy.env.overwriteOutput = True
# Set output folder
OutputFolder = r"C:/Users/Desktop/weekly_avg_project/output"
# Loop through a list of files in the workspace
NCfiles = arcpy.ListFiles("*.nc")
for filename in NCfiles:
print("Processing: " + filename)
inNCfiles = arcpy.env.workspace + "//" + filename
fileroot = filename[:(len(filename)-3)] + '_var86'
#fileroot = filename[:-3] + '_var86' #I think this will work too- and is easier to read
....
...
..
.
... View more
11-27-2017
08:28 AM
|
2
|
1
|
2946
|
|
POST
|
Do you need to just rename the output filename? If so, it seems like the output layer is currently the 'TempLayerFile' variable. You can rename that like the code below. import arcpy, sys
from arcpy import env
from arcpy.sa import *
# Input data source
arcpy.env.workspace = r"C:/Users/Desktop/weekly_avg_project"
arcpy.env.overwriteOutput = True
# Set output folder
OutputFolder = r"C:/Users/Desktop/weekly_avg_project/output"
# Loop through a list of files in the workspace
NCfiles = arcpy.ListFiles("*.nc")
for filename in NCfiles:
print("Processing: " + filename)
inNCfiles = arcpy.env.workspace + "//" + filename
fileroot = filename[0:(len(filename)-3)]
TempLayerFile = "SM_amount_var86"
outRaster = OutputFolder + "//" + fileroot
# Process: Make NetCDF Raster Layer
outfile = arcpy.MakeNetCDFRasterLayer_md(filename, "var86", "lon", "lat", TempLayerFile, "", "", "BY_VALUE")
proj_ras = arcpy.ProjectRaster_management(outfile, "C:/Users/Desktop/weekly_avg_project/project_ras","GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "NEAREST", "0.125 0.125", "NAD_1983_To_WGS_1984_1", "", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")
# Process: Copy Raster
arcpy.CopyRaster_management(proj_ras, outRaster + ".tif", "", "", "", "NONE", "NONE", "")
... View more
11-27-2017
08:16 AM
|
0
|
4
|
2946
|
|
POST
|
You may want to look into subtypes and how they interact. Geodatabase domains are not dynamic in the way you're needing them.
... View more
11-21-2017
12:58 PM
|
0
|
0
|
1004
|
|
POST
|
You may want to convert each .shp to an in-memory feature layer before running the LayerToKML tool. for dirpath, dirnames, filenames in os.walk(r"Z:/inPath"):
for file in filenames:
if file.endswith('boundary.shp'):
shpPath = os.path.join(dirpath, file)
arcpy.MakeFeatureLayer_management(shpPath,'featLyr')
arcpy.LayerToKML_conversion(layer='featLyr',
out_kmz_file="kmz_out",
layer_output_scale="0", is_composite="NO_COMPOSITE",
boundary_box_extent="DEFAULT", image_size="1024", dpi_of_client="96",
ignore_zvalue="CLAMPED_TO_GROUND")
print "boundary has been made"
arcpy.Delete_management('featLyr')
... View more
11-20-2017
11:37 AM
|
1
|
0
|
5393
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-28-2024 11:43 AM | |
| 1 | 09-12-2025 07:32 AM | |
| 1 | 10-26-2018 06:50 AM | |
| 1 | 10-26-2018 08:43 AM | |
| 1 | 02-25-2016 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
a month ago
|