-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.py
More file actions
80 lines (62 loc) · 1.83 KB
/
template.py
File metadata and controls
80 lines (62 loc) · 1.83 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#---------------------------------------------------------------------------
# <name of script.py>
#
# Author: Anders Olson
#
# Usage: Requires arcpy and python 3, run as stand-alone script.
#
# Description: Script creates x,y,z... add description of script...
# ---------------------------------------------------------------------------
import arcpy
import datetime
from datetime import datetime
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
# ================================#
# Define variables and environments
# ================================#
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
# Set the arcpy overwriteOutput ON
arcpy.gp.overwriteOutput = True
# Create output messages for arcpy
def outputMessage(msg):
print(msg)
arcpy.AddMessage(msg)
def outputError(msg):
print(msg)
arcpy.AddError(msg)
# Start a timer
startTime = datetime.now()
# Define some variables
varX = 'Some text'
varY = 45.2
workspace = r'C:\Users\andolson\someGDB.gdb'
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
# ================================#
# Define functions
# ================================#
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
'''
Summary: Function creates x,y,z thing...
Parameters:
inputData -- <Description of input data>
inVar -- <Description of input variable>
Returns:
outputData -- <Description of output data>
'''
def someFunction0 (inputData, inVar, outputData):
varSum = inputData + inVar
outputMessage(varSum)
return outputData
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
# ================================#
# Call Functions & Run Code
# ================================#
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
# Run a function
someFunction0(4, 3, r'C:\Users\andolson')
# Run some code
x = len(varX)
for n in range(x):
outputMessage(n)
# Print timer progress
outputMessage('Task Completed!\nFinal run time is: {}'.format(datetime.now() - startTime))