Procházet zdrojové kódy

洗失量、全盐量等处理

Kejl před 3 týdny
rodič
revize
5fad53720d
3 změnil soubory, kde provedl 21 přidání a 21 odebrání
  1. 3 3
      partReport.py
  2. 14 14
      public.py
  3. 4 4
      report.py

+ 3 - 3
partReport.py

@@ -1821,10 +1821,10 @@ def getChemicalIndicators(originData, data,type, changeFileUrl, saveFileUrl, che
     paragraph_t_12.add_run(f'图12:全盐量与电导率相关性分析图').bold = True
     paragraph_t_12.alignment = WD_ALIGN_PARAGRAPH.CENTER
 
-    if os.path.isfile(f'{mkdir_path}/离子总量与水溶性盐总量关系图.png'):
-        doc.add_picture(f'{mkdir_path}/离子总量与水溶性盐总量关系图.png', width=Inches(6.0))
+    if os.path.isfile(f'{mkdir_path}/离子总量与全盐量关系图.png'):
+        doc.add_picture(f'{mkdir_path}/离子总量与水全盐量关系图.png', width=Inches(6.0))
     paragraph_t_13 = doc.add_paragraph()
-    paragraph_t_13.add_run(f'图13:水溶性盐总量与离子总量关系分析图').bold = True
+    paragraph_t_13.add_run(f'图13:全盐量量与离子总量关系分析图').bold = True
     paragraph_t_13.alignment = WD_ALIGN_PARAGRAPH.CENTER
 
     # 这里添加新增的剖面数据指标 添加异常数据表和折线图

+ 14 - 14
public.py

@@ -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

+ 4 - 4
report.py

@@ -1023,15 +1023,15 @@ def manyTypes(data,url):
     pio.write_html(fig, file=html_file_path, auto_open=False)
     # 同时保存一份图片
     pio.write_image(fig, f"{url}/全盐量与电导率相关性分析图.png")
-    # 离子总量 水溶性盐总量及差值
+    # 离子总量 全盐量及差值
     filterData = data.dropna(subset=['全盐量', '离子总量'])
     x2 = np.arange(0, len(filterData['离子总量']), 1)
     y2 = filterData['离子总量'].sort_values()
     y3 = filterData['全盐量'].sort_values()
     y4 = (y2-y3).sort_values()
-    getInteractiveImg(x2, y2, '离子总量', x2, y3, '水溶性盐总量', x2, y4,
-                    '离子总量与水溶性盐总量之差', url,
-                    '离子总量与水溶性盐总量关系图', '样品序号', '离子总量/水溶性盐总量(g/kg)', data['原样品编号'])
+    getInteractiveImg(x2, y2, '离子总量', x2, y3, '全盐量', x2, y4,
+                    '离子总量与全盐量之差', url,
+                    '离子总量与全盐量关系图', '样品序号', '离子总量/全盐量(g/kg)', data['原样品编号'])
 
 # 绘制水稳数据折线图
 def makeWaterImg(data,url,name):