54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
'''
|
|
ArcGis 字段计算器 模块代码
|
|
'''
|
|
codeblock_dltb_yjdl = """
|
|
def calculate_yjdl(dlbm):
|
|
if str(dlbm).startswith('01'):
|
|
return '耕地'
|
|
elif str(dlbm).startswith('02'):
|
|
return '园地'
|
|
elif str(dlbm).startswith('03'):
|
|
return '林地'
|
|
elif str(dlbm).startswith('04'):
|
|
return '草地'
|
|
else:
|
|
return '其他'"""
|
|
|
|
codeblock_dltb_ejdl = """
|
|
def calculate_ejdl(dlbm,dlmc):
|
|
if str(dlbm).startswith('03'):
|
|
return '林地'
|
|
elif str(dlbm).startswith('04'):
|
|
return '草地'
|
|
elif str(dlbm).startswith('12'):
|
|
return '其他'
|
|
elif str(dlbm).startswith('0101'):
|
|
return '水田'
|
|
elif str(dlbm).startswith('0102'):
|
|
return '水浇地'
|
|
elif str(dlbm).startswith('0103'):
|
|
return '旱地'
|
|
elif str(dlbm).startswith('0201'):
|
|
return '果园'
|
|
elif str(dlbm).startswith('0202'):
|
|
return '茶园'
|
|
elif str(dlbm).startswith('0203'):
|
|
return '橡胶园'
|
|
elif str(dlbm).startswith('0204'):
|
|
return '其他园地'
|
|
else:
|
|
return dlmc"""
|
|
|
|
codeblock_cal_shfj = """
|
|
def calculate_shfj(girdcode):
|
|
if int(girdcode) == 1:
|
|
return "重度酸化"
|
|
elif int(girdcode) == 2:
|
|
return "中度酸化"
|
|
elif int(girdcode) == 3:
|
|
return "轻度酸化"
|
|
elif int(girdcode) == 4:
|
|
return "弱酸化"
|
|
else: # dPH
|
|
return "其他"
|
|
""" |