|
@@ -53,9 +53,9 @@ def soil_bulk_density(arr): #arr为计算过的数组
|
|
|
# soilList = [] # 定义一个数组存放土地类型的数据
|
|
|
# soilContent = []
|
|
|
# soilContentTarget = [] # 存放土壤质地异常的指标名称
|
|
|
- # xSLErr = [] # 存放ph>7 洗失量为空的异常数据
|
|
|
- # xSLTarget = [] # 存放异常数据 指标名称
|
|
|
- # try:
|
|
|
+ xSLErr = [] # 存放ph>7 洗失量为空的异常数据
|
|
|
+ xSLTarget = [] # 存放异常数据 指标名称
|
|
|
+ try:
|
|
|
# # 按行循环读取所有数据
|
|
|
# for index, row in arr.iterrows():
|
|
|
# # 1.将0.02-0.2,0.2-2两列加起来
|
|
@@ -94,22 +94,22 @@ def soil_bulk_density(arr): #arr为计算过的数组
|
|
|
#
|
|
|
# # 比较和原有数据是否一致
|
|
|
# arr['土壤质地(判断)'] = soilList
|
|
|
- # for index, row in arr.iterrows():
|
|
|
+ for index, row in arr.iterrows():
|
|
|
# if (row['土壤质地(判断)'] != row['土壤质地']) and (not pd.isna(row['土壤质地'])):
|
|
|
# soilContent.append('存疑:土壤质地填报与判断不一致')
|
|
|
# soilContentTarget.append('土壤质地。')
|
|
|
# else:
|
|
|
# soilContent.append('')
|
|
|
# soilContentTarget.append('')
|
|
|
- # # 如果pH>7,则洗失量数据不能为空;
|
|
|
- # if (not pd.isna(row['pH']) and row['pH'] > 7 and pd.isna(row['洗失量(吸管法需填)%'])):
|
|
|
- # xSLErr.append('洗失量:ph>7但洗失量未检测。')
|
|
|
- # xSLTarget.append('洗失量。')
|
|
|
- # else:
|
|
|
- # xSLErr.append('')
|
|
|
- # xSLTarget.append('')
|
|
|
- # except Exception as err:
|
|
|
- # print('土壤类型判断出错!请检查soil_bulk_density中判断土壤类型内容', err)
|
|
|
+ # 如果pH>7,则洗失量数据不能为空;
|
|
|
+ if (not pd.isna(row['pH']) and row['pH'] > 7 and pd.isna(row['洗失量(吸管法需填)%']) and (pd.isna(row['0.2-0.02mm颗粒含量%']) or pd.isna(row['0.02-0.002mm颗粒含量%']))):
|
|
|
+ xSLErr.append('洗失量:ph>7但洗失量未检测。')
|
|
|
+ xSLTarget.append('洗失量。')
|
|
|
+ else:
|
|
|
+ xSLErr.append('')
|
|
|
+ xSLTarget.append('')
|
|
|
+ except Exception as err:
|
|
|
+ print('土壤洗失量判断出错!请检查soil_bulk_density中判断洗失量内容', err)
|
|
|
# 把存疑数据组合并返回
|
|
|
# print('shenHeList--',shenHeList,len(shenHeList))
|
|
|
# print('plusShenHeList--', plusShenHeList, len(plusShenHeList))
|
|
@@ -174,7 +174,7 @@ def water_stable(arr):
|
|
|
rateList.append('')
|
|
|
rateTar.append('')
|
|
|
resData = pd.DataFrame({
|
|
|
- '审核结果': pd.Series(plusList) + pd.Series(soilType) + pd.Series(rateList),
|
|
|
+ '审核结果': pd.Series(plusList) + pd.Series(rateList),
|
|
|
'异常指标': pd.Series(plusTar) + pd.Series(rateTar),
|
|
|
})
|
|
|
return resData
|