Browse Source

修改:超阈值->复核数据合理性

张世豪 1 tháng trước cách đây
mục cha
commit
4604a4b6ee
1 tập tin đã thay đổi với 48 bổ sung48 xóa
  1. 48 48
      public.py

+ 48 - 48
public.py

@@ -12,7 +12,7 @@ def soil_bulk_density(arr): #arr为计算过的数组
     try:
         for i in arr['土壤容重平均值(g/cm3)(计算)']:
             if i > 1.6 or i < 0.8:
-                shenHeList.append('土壤容重:超阈值。')
+                shenHeList.append('土壤容重:复核数据合理性。')
                 shenHeTarget.append('土壤容重平均值。')
             else:
                 shenHeList.append('')
@@ -42,7 +42,7 @@ def soil_bulk_density(arr): #arr为计算过的数组
     try:
         for i in arr['加和%']:
             if float(i) > 100.02 or float(i) < 99.98:
-                plusShenHeList.append('土壤颗粒加和:超阈值。')
+                plusShenHeList.append('土壤颗粒加和:复核数据合理性。')
                 plusShenHeTarget.append('土壤颗粒含量加和。')
             else:
                 plusShenHeList.append('')
@@ -157,7 +157,7 @@ def water_stable(arr):
             #     shenHeTar.append('')
             # 规则2判断
             if row['总和(%)'] > 60 or row['总和(%)'] < 1:
-                plusList.append('水稳性大团聚体:总和超阈值。')
+                plusList.append('水稳性大团聚体:总和复核数据合理性。')
                 plusTar.append('水稳总和。')
             else:
                 plusList.append('')
@@ -343,56 +343,56 @@ def cation_value(arr):
         for index, row in arr.iterrows():
             # 风干样含水量 0.5-5,存疑
             if pd.isna(row['含水量']) or row['含水量'] > 5 or row['含水量'] < 0.5:
-                waterMount.append('风干试样含水量(分析基):超阈值。')
+                waterMount.append('风干试样含水量(分析基):复核数据合理性。')
                 waterMountTar.append('风干试样含水量(分析基)。')
             else:
                 waterMount.append('')
                 waterMountTar.append('')
             # (1)pH在[4, 9]范围之外的,存疑;
             if pd.isna(row['pH']) or row['pH'] < 4 or row['pH'] > 9:
-                phList.append('pH:超阈值。')
+                phList.append('pH:复核数据合理性。')
                 phTar.append('pH。')
             else:
                 phList.append('')
                 phTar.append('')
             # (2)阳离子交换量在[6, 38]范围之外的,存疑;
             if row['阳离子交换量Cmol(+)/kg'] < 6 or row['阳离子交换量Cmol(+)/kg'] > 38:
-                cationList.append('阳离子交换量:超阈值。')
+                cationList.append('阳离子交换量:复核数据合理性。')
                 cationTar.append('阳离子交换量。')
             else:
                 cationList.append('')
                 cationTar.append('')
             # (3)交换性盐基总量在[3, 30]范围之外的,存疑;
             if row['交换性盐总量Cmol(+)/kg'] <3 or row['交换性盐总量Cmol(+)/kg'] > 30:
-                exchangeableSalt.append('交换性盐基总量:超阈值。')
+                exchangeableSalt.append('交换性盐基总量:复核数据合理性。')
                 exchangeableSaltTar.append('交换性盐总量。')
             else:
                 exchangeableSalt.append('')
                 exchangeableSaltTar.append('')
             # (4)交换性钙在[1, 25]范围之外的,存疑;
             if row['交换性钙Cmol(1/2Ca2+)/kg'] < 1 or row['交换性钙Cmol(1/2Ca2+)/kg'] > 25:
-                exchangeableCa.append('交换性钙:交换性钙超阈值。')
+                exchangeableCa.append('交换性钙:交换性钙复核数据合理性。')
                 exchangeableCaTar.append('交换性钙。')
             else:
                 exchangeableCa.append('')
                 exchangeableCaTar.append('')
             # (5)交换性镁在[0.5, 12.5]范围之外的,存疑;
             if row['交换性镁cmol(1/2Mg2+)/kg'] < 0.5 or row['交换性镁cmol(1/2Mg2+)/kg'] > 12.8:
-                exchangeableMg.append('交换性镁:超阈值。')
+                exchangeableMg.append('交换性镁:复核数据合理性。')
                 exchangeableMgTar.append('交换性镁。')
             else:
                 exchangeableMg.append('')
                 exchangeableMgTar.append('')
             # (6)交换性钾在[0.1, 1.5]范围之外的,存疑;
             if row['交换性钾Cmol(+)/kg'] < 0.1 or row['交换性钾Cmol(+)/kg'] > 1.5:
-                exchangeableK.append('交换性钾:超阈值。')
+                exchangeableK.append('交换性钾:复核数据合理性。')
                 exchangeableKTar.append('交换性钾。')
             else:
                 exchangeableK.append('')
                 exchangeableKTar.append('')
             # (7)交换性钠在[0.1, 2]范围之外的,存疑;
             if row['交换性钠cmol(+)/kg'] < 0.1 or row['交换性钠cmol(+)/kg'] > 2:
-                exchangeableNa.append('交换性钠:超阈值。')
+                exchangeableNa.append('交换性钠:复核数据合理性。')
                 exchangeableNaTar.append('交换性钠。')
             else:
                 exchangeableNa.append('')
@@ -457,70 +457,70 @@ def eight_ion_coun(arr, summary):
         #(2)水溶性盐总量在[0.1, 2]范围之外的,存疑;
         for index, row in arr.iterrows():
             if (not pd.isna(row['水溶性全盐量g/kg']) and row['水溶性全盐量g/kg'] < 0.1) or (not pd.isna(row['水溶性全盐量g/kg']) and row['水溶性全盐量g/kg'] > 2):
-                allArr.append('全盐量:超阈值。')
+                allArr.append('全盐量:复核数据合理性。')
                 allArrTar.append('全盐量。')
             else:
                 allArr.append('')
                 allArrTar.append('')
             #(3)电导率在[0.01, 2]范围之外的,存疑;
             if ( not pd.isna(row['电导率ms/cm']) and row['电导率ms/cm'] < 0.01) or (not pd.isna(row['电导率ms/cm']) and row['电导率ms/cm'] > 2):
-                conductivity.append('电导率:超阈值。')
+                conductivity.append('电导率:复核数据合理性。')
                 conductivityTar.append('电导率。')
             else:
                 conductivity.append('')
                 conductivityTar.append('')
             #(4)水溶性钠在[0.05, 0.5]范围之外的,存疑;
             if (not pd.isna(row['水溶性钠离子含量Cmol(Na+)/kg']) and row['水溶性钠离子含量Cmol(Na+)/kg'] <0.05) or (pd.isna(row['水溶性钠离子含量Cmol(Na+)/kg']) and row['水溶性钠离子含量Cmol(Na+)/kg'] > 0.5):
-                naArr.append('水溶性钠离子:水溶性钠离子超阈值。')
+                naArr.append('水溶性钠离子:水溶性钠离子复核数据合理性。')
                 naArrTar.append('水溶性钠离子。')
             else:
                 naArr.append('')
                 naArrTar.append('')
             #(5)水溶性钾在[0.01, 0.5]范围之外的,存疑;
             if (not pd.isna(row['水溶性钾离子含量Cmol(K+)/kg']) and row['水溶性钾离子含量Cmol(K+)/kg'] <0.01) or ( not pd.isna(row['水溶性钾离子含量Cmol(K+)/kg']) and row['水溶性钾离子含量Cmol(K+)/kg'] > 0.5):
-                kArr.append('水溶性钾离子:超阈值。')
+                kArr.append('水溶性钾离子:复核数据合理性。')
                 kArrTar.append('水溶性钾离子。')
             else:
                 kArr.append('')
                 kArrTar.append('')
             #(6)水溶性钙在[0.25, 5]范围之外的,存疑;
             if (not pd.isna(row['水溶性钙离子含量cmol(1/2Ca2+)/kg']) and row['水溶性钙离子含量cmol(1/2Ca2+)/kg'] <0.25) or (not pd.isna(row['水溶性钙离子含量cmol(1/2Ca2+)/kg']) and row['水溶性钙离子含量cmol(1/2Ca2+)/kg'] > 0.5):
-                caArr.append('水溶性钙离子:超阈值。')
+                caArr.append('水溶性钙离子:复核数据合理性。')
                 caArrTar.append('水溶性钙离子。')
             else:
                 caArr.append('')
                 caArrTar.append('')
             #(7)水溶性镁在[0.125, 2.5]范围之外的,存疑;
             if (not pd.isna(row['水溶性镁离子Cmol(1/2Mg2+)/kg']) and row['水溶性镁离子Cmol(1/2Mg2+)/kg'] <0.125) or  (not pd.isna(row['水溶性镁离子Cmol(1/2Mg2+)/kg']) and row['水溶性镁离子Cmol(1/2Mg2+)/kg'] > 2.5):
-                mgArr.append('水溶性镁离子:超阈值。')
+                mgArr.append('水溶性镁离子:复核数据合理性。')
                 mgArrTar.append('水溶性镁离子。')
             else:
                 mgArr.append('')
                 mgArrTar.append('')
             #(8)水溶性碳酸根在[0.01, 2.5]范围之外的,存疑;
             if (not pd.isna(row['水溶性碳酸根离子含量cmol(1/2CO32+)/kg']) and row['水溶性碳酸根离子含量cmol(1/2CO32+)/kg'] <0.01) or (not pd.isna(row['水溶性碳酸根离子含量cmol(1/2CO32+)/kg']) and row['水溶性碳酸根离子含量cmol(1/2CO32+)/kg'] > 2.5):
-                coArr.append('水溶性碳酸根:超阈值。')
+                coArr.append('水溶性碳酸根:复核数据合理性。')
                 coArrTar.append('水溶性碳酸根。')
             else:
                 coArr.append('')
                 coArrTar.append('')
             #(9)水溶性碳酸氢根在[0.05, 5]范围之外的,存疑;
             if (not pd.isna(row['水溶性碳酸氢离子含量cmol(1/2HCO3-)/kg']) and row['水溶性碳酸氢离子含量cmol(1/2HCO3-)/kg'] <0.05) or (not pd.isna(row['水溶性碳酸氢离子含量cmol(1/2HCO3-)/kg']) and row['水溶性碳酸氢离子含量cmol(1/2HCO3-)/kg'] > 5):
-                cohArr.append('水溶性碳酸氢根:超阈值。')
+                cohArr.append('水溶性碳酸氢根:复核数据合理性。')
                 cohArrTar.append('水溶性碳酸氢根。')
             else:
                 cohArr.append('')
                 cohArrTar.append('')
             #(10)水溶性硫酸根在[0.25, 2.5]范围之外的,存疑;
             if (not pd.isna(row['水溶性硫酸根离子含量cmol(1/2SO42-)/kg']) and row['水溶性硫酸根离子含量cmol(1/2SO42-)/kg'] <0.25) or (not pd.isna(row['水溶性硫酸根离子含量cmol(1/2SO42-)/kg']) and row['水溶性硫酸根离子含量cmol(1/2SO42-)/kg'] > 2.5):
-                soArr.append('水溶性硫酸根:超阈值。')
+                soArr.append('水溶性硫酸根:复核数据合理性。')
                 soArrTar.append('水溶性硫酸根。')
             else:
                 soArr.append('')
                 soArrTar.append('')
             #(11)水溶性氯根在[0.5, 5]范围之外的,存疑;
             if (not pd.isna(row['水溶性氯离子含量cmol(Cl-)/kg']) and row['水溶性氯离子含量cmol(Cl-)/kg'] <0.5) or  (not pd.isna(row['水溶性氯离子含量cmol(Cl-)/kg']) and row['水溶性氯离子含量cmol(Cl-)/kg'] > 5):
-                clArr.append('水溶性氯根:超阈值。')
+                clArr.append('水溶性氯根:复核数据合理性。')
                 clArrTar.append('水溶性氯根。')
             else:
                 clArr.append('')
@@ -559,12 +559,12 @@ def eight_ion_coun(arr, summary):
                 changeComArr.append('')
             #(16)(水溶性全盐量 - 八大离子加和) / 八大离子加和 * 100,不超过±20 %
             if not pd.isna(row['(水溶性全盐量-八大离子加和)/水溶性全盐量×100']) and (row['(水溶性全盐量-八大离子加和)/水溶性全盐量×100'] < -0.2 or row['(水溶性全盐量-八大离子加和)/水溶性全盐量×100'] > 0.2) :
-                rateArr.append('存疑:(水溶性全盐量-八大离子加和)/水溶性全盐量×100超阈值。')
+                rateArr.append('存疑:(水溶性全盐量-八大离子加和)/水溶性全盐量×100复核数据合理性。')
             else:
                 rateArr.append('')
             #(17)阳离子总量 - 阴离子总量应基本相等,超过±1则提示异常
             if not pd.isna(row['阳离子总量-阴离子总量']) and (row['阳离子总量-阴离子总量'] < -1 or row['阳离子总量-阴离子总量'] > 1) :
-                subtractionArr.append('存疑:阳离子总量 - 阴离子总量超阈值。')
+                subtractionArr.append('存疑:阳离子总量 - 阴离子总量复核数据合理性。')
             else:
                 subtractionArr.append('')
         resData = pd.DataFrame({
@@ -615,71 +615,71 @@ def nutrient_data(arr):
                 sKErrTar.append('')
             #(2)有机质在[2, 50]范围之外的,存疑;有机质<5提示异常;
             if row['有机质g/kg'] < 2 or row['有机质g/kg'] >50:
-                organicMatter.append('有机质:超阈值。')
+                organicMatter.append('有机质:复核数据合理性。')
                 organicMatterTar.append('有机质。')
             else:
                 organicMatter.append('')
                 organicMatterTar.append('')
             #(3)全氮在[0.1, 2.5]范围之外的;存疑;
             if row['全氮g/kg'] < 0.1 or row['全氮g/kg'] > 2.5:
-                NArr.append('全氮:超阈值。')
+                NArr.append('全氮:复核数据合理性。')
                 NArrTar.append('全氮。')
             else:
                 NArr.append('')
                 NArrTar.append('')
             #(4)全磷在[0.18, 1.5]范围之外的;存疑;
             if row['全磷g/kg'] < 0.18 or row['全磷g/kg'] > 1.5:
-                PArr.append('全磷:超阈值。')
+                PArr.append('全磷:复核数据合理性。')
                 PArrTar.append('全磷。')
             else:
                 PArr.append('')
                 PArrTar.append('')
             #(5)全钾在[10, 29]范围之外的;存疑;
             if row['全钾g/kg'] < 10 or row['全钾g/kg'] > 29:
-                KArr.append('全钾:超阈值。')
+                KArr.append('全钾:复核数据合理性。')
                 KArrTar.append('全钾。')
             else:
                 KArr.append('')
                 KArrTar.append('')
             #(6)有效磷在[1, 80]范围之外的;存疑; 耕地 超过80存疑
             if (row['pH'] >= 6.5 and (row['有效磷g/kg'] < 3 or row['有效磷g/kg'] > 60)) or (row['pH'] < 6.5 and (row['有效磷g/kg'] <1 or row['有效磷g/kg'] > 80) or (row['编号'][6:10] == '0101' or row['编号'][6:10] == '0102' or row['编号'][6:10] == '0103') and row['有效磷g/kg'] > 60) :
-                availableP.append('有效磷:超阈值。')
+                availableP.append('有效磷:复核数据合理性。')
                 availablePTar.append('有效磷。')
             else:
                 availableP.append('')
                 availablePTar.append('')
             # if row['有效磷g/kg'] < 1 or row['有效磷g/kg'] > 60 or ((row['编号'][6:11] == '0101' or row['编号'][6:11] == '0102' or row['编号'][6:11] == '0103') and row['有效磷g/kg'] > 60):
-            #     availableP.append('存疑:有效磷超阈值。')
+            #     availableP.append('存疑:有效磷复核数据合理性。')
             # else:
             #     availableP.append('')
             #(7)速效钾在[30, 300] 范围之外的;存疑; 耕地超过300存疑
             if row['速效钾mg/kg'] < 30 or row['速效钾mg/kg'] > 300 or ((row['编号'][6:10] == '0101' or row['编号'][6:10] == '0102' or row['编号'][6:10] == '0103') and row['速效钾mg/kg'] > 300):
-                availablek.append('速效钾:超阈值。')
+                availablek.append('速效钾:复核数据合理性。')
                 availablekTar.append('速效钾。')
             else:
                 availablek.append('')
                 availablekTar.append('')
             #(8)缓效钾在[100, 2000]范围之外的;存疑;
             if row['缓效钾mg/kg'] < 100 or row['缓效钾mg/kg'] > 2000:
-                slowlyK.append('缓效钾:超阈值。')
+                slowlyK.append('缓效钾:复核数据合理性。')
                 slowlyKTar.append('缓效钾。')
             else:
                 slowlyK.append('')
                 slowlyKTar.append('')
             #(9)有机质 / 全氮比值≥20和≤13,提示存疑
             if row['有机质g/kg']/row['全氮g/kg'] >=20 or row['有机质g/kg']/row['全氮g/kg'] <=13 :
-                organicRate.append('存疑:有机质/全氮比值超阈值。')
+                organicRate.append('存疑:有机质/全氮比值复核数据合理性。')
             else:
                 organicRate.append('')
             #(10)有机质、全氮含量异常高,但速效养分特低,提示异常   无法量化不处理
             #(11)母岩为片麻岩,但全钾、速效缓效钾含量低,提示异常   无法量化不处理
             #(12)有效磷<3和大于60,提示异常;速效钾<50提示异常
             if row['有效磷g/kg'] < 3 or row['有效磷g/kg'] > 60:
-                availablePCom.append('有效磷:超阈值。')
+                availablePCom.append('有效磷:复核数据合理性。')
             else:
                 availablePCom.append('')
             if row['速效钾mg/kg'] < 50:
-                availableTxt.append('速效钾:超阈值。')
+                availableTxt.append('速效钾:复核数据合理性。')
             else:
                 availableTxt.append('')
             #(13)速效钾>缓效钾,提示异常
@@ -722,35 +722,35 @@ def soil_metal(arr):
         for index, row in arr.iterrows():
             #(1)有效硫在[2, 60]范围之外的,存疑;
             if (not pd.isna(row['有效硫mg/kg']) and row['有效硫mg/kg'] <2) or (not pd.isna(row['有效硫mg/kg']) and row['有效硫mg/kg'] >60):
-                effectiveL.append('有效硫:超阈值。')
+                effectiveL.append('有效硫:复核数据合理性。')
                 effectiveLTar.append('有效硫。')
             else:
                 effectiveL.append('')
                 effectiveLTar.append('')
             #(2)有效硅在[10, 500]范围之外的,存疑;
             if ( not pd.isna(row['有效硅mg/kg']) and row['有效硅mg/kg'] <10) or (not pd.isna(row['有效硅mg/kg']) and row['有效硅mg/kg'] >500):
-                effectiveG.append('有效硅:超阈值。')
+                effectiveG.append('有效硅:复核数据合理性。')
                 effectiveGTar.append('有效硅。')
             else:
                 effectiveG.append('')
                 effectiveGTar.append('')
             #(3)有效铁在[5, 300]范围之外的,存疑;
             if ( not pd.isna(row['有效铁mg/kg']) and row['有效铁mg/kg'] <5) or (not pd.isna(row['有效铁mg/kg']) and row['有效铁mg/kg'] >300):
-                effectiveT.append('有效铁:超阈值。')
+                effectiveT.append('有效铁:复核数据合理性。')
                 effectiveTTar.append('有效铁。')
             else:
                 effectiveT.append('')
                 effectiveTTar.append('')
             #(4)有效锰在[5, 200]范围之外的,存疑;
             if (not pd.isna(row['有效锰mg/kg']) and row['有效锰mg/kg'] <5) or (not pd.isna(row['有效锰mg/kg']) and row['有效锰mg/kg'] >200) :
-                effectiveM.append('有效锰:超阈值。')
+                effectiveM.append('有效锰:复核数据合理性。')
                 effectiveMTar.append('有效锰。')
             else:
                 effectiveM.append('')
                 effectiveMTar.append('')
             #(5)有效铜在[0.1, 8]范围之外的,存疑;
             if ( not pd.isna(row['有效铜mg/kg']) and row['有效铜mg/kg'] <0.1) or (not pd.isna(row['有效铜mg/kg']) and row['有效铜mg/kg'] >8):
-                effectiveCu.append('有效铜:超阈值。')
+                effectiveCu.append('有效铜:复核数据合理性。')
                 effectiveCuTar.append('有效铜。')
             else:
                 effectiveCu.append('')
@@ -758,21 +758,21 @@ def soil_metal(arr):
 
             #(6)有效锌在[0.1, 10] 范围之外的,存疑;
             if (not pd.isna(row['有效锌mg/kg']) and row['有效锌mg/kg'] <0.1) or (not pd.isna(row['有效锌mg/kg']) and row['有效锌mg/kg'] >10):
-                effectiveX.append('有效锌:超阈值。')
+                effectiveX.append('有效锌:复核数据合理性。')
                 effectiveXTar.append('有效锌。')
             else:
                 effectiveX.append('')
                 effectiveXTar.append('')
             #(7)有效硼在[0.1, 2] 范围之外的,存疑;
             if (not pd.isna(row['有效硼mg/kg']) and row['有效硼mg/kg'] <0.1) or (not pd.isna(row['有效硼mg/kg']) and row['有效硼mg/kg'] >2):
-                effectiveP.append('有效硼:超阈值。')
+                effectiveP.append('有效硼:复核数据合理性。')
                 effectivePTar.append('有效硼。')
             else:
                 effectiveP.append('')
                 effectivePTar.append('')
             #(8)有效钼在[0.03, 1]范围之外的,存疑。
             if (not pd.isna(row['有效钼mg/kg']) and row['有效钼mg/kg'] <0.03) or (not pd.isna(row['有效钼mg/kg']) and row['有效钼mg/kg'] >1):
-                effectiveMu.append('有效钼:超阈值。')
+                effectiveMu.append('有效钼:复核数据合理性。')
                 effectiveMutar.append('有效钼。')
             else:
                 effectiveMu.append('')
@@ -927,42 +927,42 @@ def last_metal(arr):
         for index, row in arr.iterrows():
             # (3)总镉在[0.03, 0.3]范围之外的,存疑
             if row['镉mg/kg'] < 0.03 or row['镉mg/kg'] > 0.3:
-                totalGe.append('总镉:超阈值。')
+                totalGe.append('总镉:复核数据合理性。')
                 totalGeTar.append('总镉。')
             else:
                 totalGe.append('')
                 totalGeTar.append('')
             # (4)总汞在[0.01, 0.3]范围之外的,存疑
             if row['汞mg/kg'] < 0.01 or row['汞mg/kg'] > 0.3:
-                totalGo.append('总汞:超阈值。')
+                totalGo.append('总汞:复核数据合理性。')
                 totalGoTar.append('总汞。')
             else:
                 totalGo.append('')
                 totalGoTar.append('')
             # (5)总砷在[0.5, 30]范围之外的,存疑
             if row['砷mg/kg'] < 0.5 or row['砷mg/kg'] > 30:
-                totalShen.append('总砷:超阈值。')
+                totalShen.append('总砷:复核数据合理性。')
                 totalShenTar.append('总砷。')
             else:
                 totalShen.append('')
                 totalShenTar.append('')
             # (6)总铅在[2, 100]范围之外的,存疑
             if row['铅mg/kg'] < 2 or row['铅mg/kg'] > 100:
-                totalPb.append('总铅:超阈值。')
+                totalPb.append('总铅:复核数据合理性。')
                 totalPbTar.append('总铅。')
             else:
                 totalPb.append('')
                 totalPbTar.append('')
             # (7)总铬在[0.4, 200]范围之外的,存疑
             if row['铬mg/kg'] < 0.4 or row['铬mg/kg'] > 200:
-                totalG.append('总铬:超阈值。')
+                totalG.append('总铬:复核数据合理性。')
                 totalGTar.append('总铬。')
             else:
                 totalG.append('')
                 totalGTar.append('')
             # (8)总镍在[0.3, 100]范围之外的,存疑
             if row['镍mg/kg'] < 0.3 or row['镍mg/kg'] > 100:
-                totalN.append('总镍:超阈值。')
+                totalN.append('总镍:复核数据合理性。')
                 totalNTar.append('总镍。')
             else:
                 totalN.append('')