Prechádzať zdrojové kódy

洗失量 存疑表等处理

Kejl 1 mesiac pred
rodič
commit
65aa1d52e9
3 zmenil súbory, kde vykonal 19 pridanie a 19 odobranie
  1. 14 14
      public.py
  2. 3 3
      report.py
  3. 2 2
      rongzhong.py

+ 14 - 14
public.py

@@ -54,9 +54,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两列加起来
@@ -95,22 +95,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))
@@ -173,7 +173,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

+ 3 - 3
report.py

@@ -1029,9 +1029,9 @@ def manyTypes(data,url):
     y4 = (y2-y3)
     if not filterData.empty:
         #要增加对指标值是否缺失进行判断,都不缺失绘图
-        getInteractiveImg(x2, y2, '离子总量', x2, y3, '水溶性盐总量', x2, y4,
-                      '离子总量与水溶性盐总量之差', url,
-                      '全盐量与离子总量相关性散点图', '样品数量', '离子总量/水溶性盐总量(g/kg)', data['原样品编号'])
+        getInteractiveImg(x2, y2, '离子总量', x2, y3, '全盐量', x2, y4,
+                      '离子总量与全盐量之差', url,
+                      '全盐量与离子总量相关性散点图', '样品数量', '离子总量/全盐量(g/kg)', data['原样品编号'])
 
 
 

+ 2 - 2
rongzhong.py

@@ -684,8 +684,8 @@ def makeNormalWord(url):
         '原样品编号': table_1_index['原样品编号'],
         '样品编号': table_1_index['样品编号'],
         '土地利用类型': table_1_index['土地利用类型'],
-        '指标': table_1_index['指标'] + table_3_index['指标'] + table_5_index['指标'] + table_8_index['指标'] + table_10_index['指标'] + table_12_index['指标'] + table_14_index['指标'],
-        '原因': table_1_index['原因'] + table_3_index['原因'] + table_5_index['原因'] + table_8_index['原因'] + table_10_index['原因'] + table_12_index['原因'] + table_14_index['原因'],
+        '指标': pd.Series(table_1_index['指标']) + pd.Series(table_3_index['指标']) + pd.Series(table_5_index['指标']) + pd.Series(table_8_index['指标']) + pd.Series(table_10_index['指标']) + pd.Series(table_12_index['指标']) + pd.Series(table_14_index['指标']),
+        '原因': pd.Series(table_1_index['原因']) + pd.Series(table_3_index['原因']) + pd.Series(table_5_index['原因']) + pd.Series(table_8_index['原因']) + pd.Series(table_10_index['原因']) + pd.Series(table_12_index['原因']) + pd.Series(table_14_index['原因']),
         '结合外业调查及相关信息评价': emptyArr,
         '数据判定': emptyArr
     })