ArcGIS のジオプロセシングは、既存の情報から新しい情報を作成するツールの実行からなります。この実行結果は、通常、ワークフロー(一般に、データ管理、空間解析、データ変換の各タスクまたはこれら 3 つすべてのタスクの組み合わせに関係する)を自動化するために後続のツールの入力として使用されます。長年の間、ジオプロセシングでは、多様な GIS 演算のコレクション、つまりコマンドのコレクションと、それらを使用するための柔軟なフレームワークである AML(ARC Macro Language)を提供する最初の製品の 1 つとして ArcInfo Workstation を使用してきました。
ArcGIS 9 では、新しい GIS 演算子のセットとそれらを使用するための新規フレームワークが導入されました。これらの演算子は、[ユニオン(Union)] や [クリップ(Clip)] など、可能な限り名前が同じに維持されているため、その多くが ArcInfo Workstation ユーザにとってなじみのあるものになっています。また、ArcGIS 9.0 では、Python などのスクリプト言語もサポートされるようになり、したがって、AML でよく使用されるより複雑なワークフローも記述できるようになりました。しかも、非独占的な言語の使用によって AML よりも豊富な機能が提供されています。
ArcInfo Workstation と ArcGIS 9 間でコマンドとツール名の関係を維持しようという取り組みはスクリプト モデルにも適用され、多くの手順では、特性がほとんど同じまま維持されています。可能な場合は、ワークスペースでのデータのリスト表示やデータセットのプロパティの記述など、AML の使いやすさが ArcGIS でも維持されています。目的とするところは、どの AML ユーザも、ArcGIS でジオプロセシング スクリプトを簡単に記述できるようになることです。
このような移行をサポートするために、以下の対応する構文では、Python を使用した場合の AML 関数の実行方法について概説します。必ずしもすべての AML 関数およびディレクティブが新規のモデルに適用されるわけではありません。直接、ArcInfo Workstation の環境に関連付けられているものもあれば(SHOW 関数など)、ArcGIS ジオプロセシング コンポーネントではなく Python 自体でより適切にサポートされているものもあります(LISTFILE など)。多くの例で、一般的な Python モジュールが ArcGIS Python 機能と併せて使用されています。
AML ディレクティブに対応する Python の構文の詳細
AML 関数に対応する構文
ABS < x > |
abs(x)
ACCESS < path > |
import arcpy
arcpy.TestSchemaLock(path)
ACOS < x > |
import math
math.acos(x)
AFTER < s > < search_s > |
s[s.find(search_s) + 1:]
ANGRAD |
<該当なし>
ASIN < x > |
import math
math.asin(x)
ATAN < x > |
import math
math.atan(x)
ATAN2 < y > < x > |
import math
math.atan2(y, x)
BEFORE < s > < search_s > |
s[:s.find(search_s)]
CALC < expression > |
import arcpy
arcpy.CalculateValue_management(expression)
CLOSE < file_unit > |
file_unit.close()
COLUMNINFO |
<該当なし>
COPY < input > < output > |
import arcpy
arcpy.Copy_management(input, output)
COS < x > |
import math
math.cos(x)
CVTDISTANCE |
<該当なし>
DATE -DEFAULT |
import time
time.strftime("%y-%m-%d", time.localtime())
DATE -FULL |
import time
time.strftime("%y-%m-%d.%H:%M:%S.%a", time.localtime())
DATE -USA |
import time
time.strftime("%m/%d/%y", time.localtime())
DATE -UFULL |
import time
time.strftime("%m/%d/%y.%H:%M:%S.%a", time.localtime())
DATE -VFULL |
import time
time.strftime("%d %b %y %H:%M:%S %A", time.localtime())
DATE -DAY |
import time
time.strftime("%d", time.localtime())
DATE -MONTH |
import time
time.strftime("%B", time.localtime())
DATE -YEAR |
import time
time.strftime("%Y", time.localtime())
DATE -VIS |
import time
time.strftime("%d %b %y", time.localtime())
DATE -TIME |
import time
time.strftime("%H:%M:%S", time.localtime())
DATE -AMPM |
import time
time.strftime("%I:%M %p", time.localtime())
DATE -DOW |
import time
time.strftime("%A", time.localtime())
DATE -CAL |
import time
time.strftime("%B %d, %Y", time.localtime())
DATE -TAG |
import time
time.strftime("%y%m%d", time.localtime())
DATE -FTAG |
import time
time.strftime("%y%m%d.%H%M%S", time.localtime())
DATE -DFMT |
import time
time.strftime(s, time.localtime())
# Format string (s) using below
# %% same as %
# %a day of week, using locale's abbreviated weekday names
# %A day of week, using locale's full weekday names
# %b,%h month, using locale's abbreviated month names
# %B month, using locale's full month names #%c date and time as %x %X
# %d day of month (01-31)
# %H hour (00-23)
# %I hour (00-12)
# %j day number of year (001-366)
# %m month number (01-12)
# %M minute (00-59)
# %p locale's equivalent of AM or PM, whichever is appropriate
# %r time as %I:%M:%S %p
# %S seconds (00-59)
# %U week number of year (01-52), Sunday is the first day of the week
# %w day of week; Sunday is day 0
# %W week number of year (01-52), Monday is the first
# %x date, using locale's date format
# %X time, using locale's time format
# %y year within century (00-99)
# %Y year, including century (for example, 1994)
# %Z time zone abbreviation
DELETE < path > |
import arcpy
arcpy.Delete_management(path)
DIGNUM |
<該当なし>
DIR < file > |
import os
os.path.dirname(file)
ENTRYNAME < file > -EXT |
import os
os.path.basename(file)
ENTRYNAME < file > -NOEXT |
import os
os.path.splitext(file)[0]
ENTRYNAME < file > -EXTONLY |
import os
os.path.splitext(file)[1]
EXISTS < file > |
import arcpy
arcpy.Exists(file)
EXP < x > |
import math
math.exp(x)
EXTRACT < pos > < elements > |
#elements are blank separated
elements.split()[pos - 1]
EXTRACT < pos > < elements > |
#elements are comma separated
elements.split(",")[pos - 1]
FILELIST |
<該当なし>
FORMAT < format > { exp1 exp2 } |
"First %s, second %s" % (exp1, exp2)
FORMATDATE |
<該当なし>
GETCHAR < prompt > |
raw_input(prompt)
GETCHOICE < choices > < prompt > <-SORT> |
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
list = choices.split()
list.sort()
print PopupList(prompt, list)
GETCOVER < workspace > < wildcard > < prompt > <-SORT> |
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
arcpy.env.workspace = workspace
list = arcpy.ListDatasets(wildcard, "cover")
list.sort()
print PopupList(prompt, list)
GETDATABASE |
<該当なし>
GETDATALAYER |
<該当なし>
GETDEFLAYERS |
<該当なし>
GETFILE < wildcard > <-INFO> < prompt > <-SORT> |
# Assumes arcpy.env.workspace is set
#
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
list = arcpy.ListTables(wildcard, "INFO")
list.sort()
print PopupList(prompt, list)
GETFILE < wildcard > <-WORKSPACE> < prompt > <-SORT> |
# Assumes arcpy.env.workspace is set
#
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
list = arcpy.ListWorkspaces(wildcard, "COVERAGES")
list.sort()
print PopupList(prompt, list)
GETFILE <wildcard> <-FILE> < prompt > <-SORT> |
# Assumes arcpy.env.workspace is set
#
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
import dircache
import os
list = arcpy.ListFiles()
list.sort()
print PopupList(prompt, list)
GETFILE <wildcard> <-DIRECTORY> < prompt > <-SORT> |
# Assumes arcpy.env.workspace is set
#
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
import dircache
import os
list = arcpy.ListFiles()
list.sort()
print PopupList(prompt, list)
GETGRID < workspace > < wildcard > < prompt > <-SORT> |
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
arcpy.env.workspace = workspace
list = arcpy.ListRasters(wildcard, "GRID")
list.sort()
print PopupList(prompt, list)
GETIMAGE < workspace > < wildcard > < type > < prompt > <-SORT> |
# Type mapping:
# -ALL use "" (blank)
# -BMP use bmp
# -TIFF use tiff
# -IMAGINE use img
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
arcpy.env.workspace = workspace
list = arcpy.ListRasters(wildcard, type)
list.sort()
print PopupList(prompt, list)
GETITEM < path > < prompt > <-SORT> |
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
list = []
pFields = arcpy.ListFields(path)
for field in pFields:
list.append(pField.name)
list.sort()
print PopupList(prompt, list)
GETLAYERCOLS |
<該当なし>
GETLIBRARY |
<該当なし>
GETSTACK |
<該当なし>
GETSYMBOL |
<該当なし>
GETTIN < workspace > < wildcard > < prompt > <-SORT> |
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
arcpy.env.workspace = workspace
list = arcpy.ListDatasets(wildcard, "tin")
list.sort()
print PopupList(prompt, list)
GETUNIQUE < path > < item > < prompt > |
from Tkinter import *
def PopupList(title, list):
root = Tk()
root.title(title)
root.protocol("WM_DELETE_WINDOW", root.quit)
frame = Frame(root)
vScrollbar = Scrollbar(frame, orient=VERTICAL)
hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
vScrollbar.config(command=listbox.yview)
vScrollbar.pack(side=RIGHT, fill=Y)
hScrollbar.config(command=listbox.xview)
hScrollbar.pack(side=BOTTOM, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=1)
frame.pack()
for a in list:
listbox.insert(END, a)
listbox.bind("<Double-Button-1>", PopupList_callback)
listbox.selection_set(0)
root.mainloop()
index = listbox.curselection()
entry = listbox.get(index)
root.destroy()
return entry
def PopupList_callback(event):
event.widget.quit()
import arcpy
list = []
rows = arcpy.da.SearchCursor(path, [item])
for row in rows:
list.append(row[0])
list.sort()
count = len(list)
pos = 1
prev = list[0]
while pos < count:
if prev == list[pos]:
del(list[pos])
count = count - 1
else:
prev = list[pos]
pos = pos + 1
print PopupList(prompt, list)
IACCLOSE |
<該当なし>
IACCONNECT |
<該当なし>
IACDISCONNECT |
<該当なし>
IACOPEN |
<該当なし>
IACREQUEST |
<該当なし>
INDEX < s > < search > |
s.find(search) + 1
INVANGLE < x1 y1 x2 y2 > |
import math
dx = x2 - x1
dy = y2 - y1
if dx == 0.0 and dy == 0.0:
angle = 0
else:
angle = math.atan2(math.fabs(dy), math.fabs(dx))
if dx < 0.0:
angle = 180.0 - angle
if dy < 0.0:
angle = 360.0 - angle
INVDISTANCE < x1 y1 x2 y2 > |
import math
dist = math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
ITEMINFO < specifier > < item > |
import arcpy
fields = arcpy.ListFields(specifier)
for field in fields:
if field.name.lower() == item.lower():
print field.name
print field.length
break
JOINFILE < obj1 > < obj2 > -file -sub |
import os
os.path.join(obj1, obj2)
JOINFILE < obj1 > < obj2 >-ext |
if obj2[0] == ".":
obj1+ obj2
else:
obj1 + "." + obj2
KEYWORD < search_string > < keywords > |
import re
def keyword(search_string, keywords):
found = 0
search_string = search_string.upper()
for cnt, s in enumerate([kw.upper() for kw in keywords], start=1):
if search_string == s:
return cnt
else:
f = re.findall("\A{0}".format(search_string), s)
if len(f) == 1:
if found:
return -1
else:
found = cnt
return found
print keyword('LINE', ['LINE', 'POINT', 'POLYGON'])
print keyword('point', ['LINE', 'POINT', 'POLYGON'])
print keyword('L', ['LINE', 'POINT', 'POLYGON'])
print keyword('K', ['LINE', 'POINT', 'POLYGON'])
print keyword('PO', ['LINE', 'POINT', 'POLYGON'])
print keyword('ABC', ['abcd', 'abc', 'abcd', 'efh', 'abc'])
print keyword('"A A"', ['a', '"a b"', '"a c"', '"a a"', '"a e"'])
print keyword('1', ['a12234a', '224556'])
print keyword('1', ['23456', '213456'])
print keyword('1', ['23456', '1', '213456'])
print keyword('1', ['23456', '2', '1456'])
LENGTH < string > |
len(string)
LISTFILE |
<該当なし>
LISTITEM < specifier > |
import arcpy
fieldNames = []
fields = arcpy.ListFields(specifier)
for field in fields:
fieldNames.append(field.name)
LISTUNIQUE < specifier > < item > |
import arcpy
list = []
rows = arcpy.da.SearchCursor(specifier, [item])
for row in rows:
list.append(row[0])
list.sort()
count = len(list)
pos = 1
prev = list[0]
while pos < count:
if prev == list[pos]:
del(list[pos])
count = count - 1
else:
prev = list[pos]
pos = pos + 1
LOCASE < s > |
s.lower()
LOG < x > |
import math
math.log(x)
LOG10 < x > |
import math
math.log10(x)
MAX < x > < y > |
max(x, y)
MENU |
<該当なし>
MIN < x > < y > |
min(x, y)
MOD < x > < y > |
x % y
NULL < string > |
if string == None or string.strip() == "":
".TRUE."
else:
".FALSE."
OKANGLE |
<該当なし>
OKDISTANCE |
<該当なし>
OPEN < file > -READ |
f = open(file, "r")
OPEN < file > -WRITE |
f = open(file, "w")
OPEN < file > -APPEND |
f = open(file, "a")
PATHNAME < file > |
# Assumes arcpy.env.workspace is set
#
import arcpy
import os
os.path.join(arcpy.env.workspace, file)
QUERY |
<該当なし>
QUOTE |
<該当なし>
QUOTEEXISTS |
<該当なし>
RADANG |
<該当なし>
RANDOM |
import random
random.randint(1, 2**31 - 1)
RANDOM < seed > |
import random
random.seed(seed)
random.randint(1, 2**31 - 1)
RANDOM < begin > < end > |
import random
random.randint(begin, end)
RANDOM < seed > < begin > < end > |
import random
random.seed(seed)
random.randint(begin, end)
READ <f ile_unit > |
file_unit.readline()
RENAME < input > < output > |
import arcpy
arcpy.Rename_management(input, output)
RESPONSE < prompt > -NOECHO |
import getpass
getpass.getpass(prompt)
RESPONSE < prompt > |
import getpass
getpass.default_getpass(prompt)
ROUND < n > |
long(round(n))
SCRATCHNAME |
import arcpy
# Assumes arcpy.env.workspace is already set
arcpy.CreateScratchName()
SEARCH < s > < search_s > |
s.find(search_s) + 1
SHOW |
<該当なし>
SIN < x > |
import math
math.sin(x)
SORT < elements > -ASCEND |
# Elements are blank separated
#
list = elements.split()
list.sort()
SORT < elements > -DESCEND |
# Elements are blank separated
#
list = elements.split()
list.sort(None, None, True)
SORT < elements > -ASCEND |
# Elements are comma separated
#
list = elements.split(",")
list.sort()
SORT < elements > -DESCEND |
# Elements are comma separated
#
list = elements.split(",")
list.sort(None, None, True)
SQRT < x > |
import math
math.sqrt(x)
SUBST < s > < search_s > < replace_s > |
s.replace(search_s, replace_s)
SUBST < s > < search_s > |
s.replace(search_s, "")
SUBSTR < s > < pos > |
s[pos - 1:]
SUBSTR < s > < pos > < num_chars > |
s[pos - 1:pos + num_chars - 1]
TAN < x > |
import math
math.tan(x)
TASK |
<該当なし>
TOKEN < elements > -COUNT |
# Elements are blank separated
#
len(elements.split())
TOKEN < elements > -FIND < e > |
# Elements are blank separated
#
elements.split().index(e) + 1
TOKEN < elements > -MOVE < from > < to > |
# Elements are blank separated
#
list = elements.split()
list.insert(To-1, list[From-1])
del(list[To])
TOKEN < elements > -INSERT < pos > < s > |
# Elements are blank separated
#
list = elements.split()
list.insert(pos-1,s)
TOKEN < elements > -DELETE < pos > |
# Elements are blank separated
#
list = elements.split()
del(list[pos-1])
TOKEN < elements > -REPLACE < pos > < s > |
# Elements are blank separated
#
list = elements.split()
list[pos-1] = s
TOKEN < elements > -MOVE <from> <to> |
# Elements are blank separated
#
list = elements.split()
fvalue = list[From-1]
tvalue = list[To-1]
list[From-1] = tvalue
list[To-1] = fvalue
TOKEN < elements > -COUNT |
# Elements are comma separated
#
len(elements.split(""))
TOKEN < elements > -FIND < e > |
# Elements are comma separated
#
elements.split().index(e) + 1
TOKEN < elements > -MOVE <from> <to> |
# Elements are comma separated
#
list = elements.split("")
list.insert(To-1, list[From-1])
del(list[To])
TOKEN <elements> -INSERT <pos> <s> |
# Elements are comma separated
#
list = elements.split("")
list.insert(pos-1,s)
TOKEN < elements > -DELETE < pos > |
# Elements are comma separated
#
list = elements.split("")
del(list[pos-1])
TOKEN < elements > -REPLACE <pos> <s> |
# Elements are comma separated
#
list = elements.split("")
list[pos-1] = s
TOKEN < elements > -MOVE < from > < to > |
# Elements are comma separated
#
list = elements.split("")
fvalue = list[From-1]
tvalue = list[To-1]
list[From-1] = tvalue
list[To-1] = fvalue
TRANSLATE < string > |
string.upper()
TRANSLATE < string > < new old > |
for i in old:
if string.find(i) > -1:
string = string.replace(i,new[old.find(i)])
TRIM <s> -BOTH < trim_char > |
s.strip(trim_char)
TRIM <s> -LEFT < trim_char > |
s.lstrip(trim_char)
TRIM <s> -RIGHT < trim_char > |
s.rstrip(trim_char)
TRIM < s > -BOTH |
s.strip()
TRIM < s > -LEFT |
s.lstrip()
TRIM < s > -RIGHT |
s.rstrip()
TRUNCATE < x > |
long(x)
TYPE < object > |
type(object)
UNQUOTE |
<該当なし>
UPCASE < s > |
s.upper()
USERNAME |
import getpass
getpass.getuser()
VALUE |
<該当なし>
VARIABLE |
<該当なし>
VERIFY < search_string > < string > |
count = 0
for i in range(len(search_string)):
if string.find(search_string[i]) == -1:
count = i + 1
break
WRITE < file_unit > < string > |
file_unit.write(string)