-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython Automation ArcGIS Pro.py
More file actions
51 lines (32 loc) · 1.06 KB
/
Python Automation ArcGIS Pro.py
File metadata and controls
51 lines (32 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
#importing libraries
import arcpy
from arcpy import env
from arcpy.sa import*
# check out the Spatial Analyst extension
arcpy.CheckOutExtension("Spatial")
# set the input environment
env.workspace = r''
# set the output path
output_path = r''
# Define headWater values for each DEM raster uisng Dic
X_values = {
'dem_ft_0': 11.46,
'dem_ft_1': 11.48,
'dem_ft_2': 9.02,
'dem_ft_3': 41.04,
}
# loop through each raster in the workspace
for raster in arcpy.ListRasters ('dem_ft_*'):
# get the corresponding X value
X = X_values[raster]
# perform the calculation
raster_obj = Raster(raster)
output_raster = (X-raster_obj)/0.46
# get the DEM number from the raster name
dem_num = raster.split('_')[-1]
# save the output raster in tif format
output_raster.save(f'{output_path}\inundation_king_tide_100y1d_SLR1_huc_{dem_number}.tif')
print('raster calculation is done!')