anweiguo před 4 měsíci
rodič
revize
3aa4c4df29
86 změnil soubory, kde provedl 129 přidání a 10508 odebrání
  1. 1 1
      .gitignore
  2. 1 1
      Dockerfile
  3. 38 0
      README.md
  4. 0 1362
      Untitled.ipynb
  5. 5 5
      data_processing/processing_limit_power/processing_limit_power_by_agcavc.py
  6. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/Dockerfile-checkpoint
  7. 0 106
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/processing_limit_power_by_agcavc-checkpoint.py
  8. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/requirements-checkpoint.txt
  9. 0 607
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/test-checkpoint.ipynb
  10. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/requirements.txt
  11. 0 607
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/test.ipynb
  12. 4 5
      data_processing/processing_limit_power/processing_limit_power_by_machines.py
  13. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/Dockerfile-checkpoint
  14. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/Untitled-checkpoint.ipynb
  15. 0 97
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/processing_limit_power_by_machines-checkpoint.py
  16. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/requirements-checkpoint.txt
  17. 0 216
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/test-checkpoint.ipynb
  18. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_machines/Dockerfile
  19. 0 89
      data_processing/processing_limit_power/processing_limit_power_by_machines/Untitled.ipynb
  20. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_machines/requirements.txt
  21. 0 294
      data_processing/processing_limit_power/processing_limit_power_by_machines/test.ipynb
  22. 6 6
      data_processing/processing_limit_power/processing_limit_power_by_records.py
  23. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/Dockerfile-checkpoint
  24. 0 94
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/processing_limit_power_by_records-checkpoint.py
  25. 0 5
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/requirements-checkpoint.txt
  26. 0 295
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/test-checkpoint.ipynb
  27. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_records/Dockerfile
  28. 0 5
      data_processing/processing_limit_power/processing_limit_power_by_records/requirements.txt
  29. 0 339
      data_processing/processing_limit_power/processing_limit_power_by_records/test.ipynb
  30. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/Dockerfile-checkpoint
  31. 0 135
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/processing_limit_power_by_statistics_light-checkpoint.py
  32. 0 8
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/requirements-checkpoint.txt
  33. 0 298
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/test-checkpoint.ipynb
  34. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_statistics/Dockerfile
  35. 0 8
      data_processing/processing_limit_power/processing_limit_power_by_statistics/requirements.txt
  36. 0 598
      data_processing/processing_limit_power/processing_limit_power_by_statistics/test.ipynb
  37. 4 8
      data_processing/processing_limit_power/processing_limit_power_by_statistics_light.py
  38. 7 0
      data_processing/processing_limit_power/test.py
  39. 0 0
      docker_bulid/.ipynb_checkpoints/__init__-checkpoint.py
  40. 0 0
      docker_bulid/.ipynb_checkpoints/main-checkpoint.py
  41. 0 5
      docker_bulid/.ipynb_checkpoints/method_a-checkpoint.py
  42. 0 5
      docker_bulid/.ipynb_checkpoints/method_b-checkpoint.py
  43. 0 47
      docker_bulid/J00260/.ipynb_checkpoints/docker-compose-checkpoint.yml
  44. 0 12
      docker_bulid/J00260/.ipynb_checkpoints/public-checkpoint.env
  45. 0 47
      docker_bulid/J00260/docker-compose.yml
  46. 0 12
      docker_bulid/J00260/public.env
  47. 0 0
      docker_bulid/__init__.py
  48. 0 4
      docker_bulid/main.py
  49. 0 5
      docker_bulid/method_a.py
  50. 0 5
      docker_bulid/method_b.py
  51. 0 0
      evaluation_processing/analysis.py
  52. 0 16
      evaluation_processing/analysis_report/.ipynb_checkpoints/Dockerfile-checkpoint
  53. 0 247
      evaluation_processing/analysis_report/.ipynb_checkpoints/analysis-checkpoint.py
  54. 0 9
      evaluation_processing/analysis_report/.ipynb_checkpoints/requirements-checkpoint.txt
  55. 0 131
      evaluation_processing/analysis_report/.ipynb_checkpoints/test-checkpoint.ipynb
  56. 0 16
      evaluation_processing/analysis_report/Dockerfile
  57. 0 9
      evaluation_processing/analysis_report/requirements.txt
  58. 0 131
      evaluation_processing/analysis_report/test.ipynb
  59. 3 6
      evaluation_processing/evaluation_accuracy.py
  60. 0 16
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/Dockerfile-checkpoint
  61. 0 212
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/evaluation_accuracy-checkpoint.py
  62. 0 6
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/requirements-checkpoint.txt
  63. 0 1506
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/test-checkpoint.ipynb
  64. 0 16
      evaluation_processing/evaluation_accuracy/Dockerfile
  65. 0 6
      evaluation_processing/evaluation_accuracy/requirements.txt
  66. 0 830
      evaluation_processing/evaluation_accuracy/test.ipynb
  67. 0 5
      main.py
  68. 2 6
      models_processing/model_predict/model_prediction_lightgbm.py
  69. 0 16
      models_processing/model_prediction_lightgbm/.ipynb_checkpoints/Dockerfile-checkpoint
  70. 0 99
      models_processing/model_prediction_lightgbm/.ipynb_checkpoints/model_prediction_lightgbm-checkpoint.py
  71. 0 7
      models_processing/model_prediction_lightgbm/.ipynb_checkpoints/requirements-checkpoint.txt
  72. 0 490
      models_processing/model_prediction_lightgbm/.ipynb_checkpoints/test-checkpoint.ipynb
  73. 0 16
      models_processing/model_prediction_lightgbm/Dockerfile
  74. 0 7
      models_processing/model_prediction_lightgbm/requirements.txt
  75. 0 537
      models_processing/model_prediction_lightgbm/test.ipynb
  76. 6 6
      models_processing/model_train/model_training_lightgbm.py
  77. 0 16
      models_processing/model_training_lighgbm/.ipynb_checkpoints/Dockerfile-checkpoint
  78. 0 130
      models_processing/model_training_lighgbm/.ipynb_checkpoints/model_training_lightgbm-checkpoint.py
  79. 0 7
      models_processing/model_training_lighgbm/.ipynb_checkpoints/requirements-checkpoint.txt
  80. 0 179
      models_processing/model_training_lighgbm/.ipynb_checkpoints/test-checkpoint.ipynb
  81. 0 16
      models_processing/model_training_lighgbm/Dockerfile
  82. 0 7
      models_processing/model_training_lighgbm/requirements.txt
  83. 0 334
      models_processing/model_training_lighgbm/test.ipynb
  84. 13 0
      requirements.txt
  85. 24 0
      run_all.py
  86. 15 0
      test_unit/test_agc_avc.py

+ 1 - 1
.gitignore

@@ -5,4 +5,4 @@
 ipynb_checkpoints/**
 __pycache__/**
 *.zip
-.ipynb_checkpoints/*
+**/.ipynb_checkpoints/

+ 1 - 1
data_processing/processing_limit_power/processing_limit_power_by_agcavc/Dockerfile → Dockerfile

@@ -1,5 +1,5 @@
 # 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
+FROM 192.168.1.36:5000/python:3.7
 ENV LANG=en_US.UTF-8
 # 设置工作目录
 WORKDIR /app

+ 38 - 0
README.md

@@ -0,0 +1,38 @@
+# 算法平台
+
+该平台集成了每人经反复验证过的、有效的、通用的数据处理组件与算法组件,提升了组件的可读性、复用性、扩展性与可维护性。
+
+## 1.代码目录结构
+
+按照组件功能划分目录结构
+
+### 数据处理 data_processing
+
+* [异常处理] abnormal_processing
+* [限电处理] processing_limit_power
+* ·agc-avc清洗    ·样板机法清洗    ·限电记录清洗    ·统计法清洗-光    ·统计法清洗-风
+
+### 特征工程 feature_processing
+
+* [归一化] feature_normalizer
+* ·‌Min-Max归一化    ·‌Z-Score归一化
+* [PCA降维] feature_pca
+* [特征选择] feature_select
+* [特征变换] feature_transform
+
+### 模型 model_processing
+
+* [模型训练] model_train
+* ·‌LSTM    ·‌CNN    ·DNN    ·Lightgbm   ·Xgboost    ·RandomForest
+* [模型预测] model_predict
+
+### 评估 evaluation_processing
+
+* 准确率计算
+* 分析报告
+
+## 2.代码测试
+
+1.Docker镜像为python3.7,开发完后,需要做单元测试,requirements.txt加入所需要的包,run_all.py中services中加入启动程序的路径和端口。
+
+2.启动run_all,可采用postman或代码等其他形式进行接口调用测试。测试通过方可提交。

+ 0 - 1362
Untitled.ipynb

@@ -1,1362 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 8,
-   "id": "8e82214d-6c64-433d-800f-2dde5f4a18bc",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>temperature10</th>\n",
-       "      <th>temperature190</th>\n",
-       "      <th>direction160</th>\n",
-       "      <th>direction40</th>\n",
-       "      <th>temperature110</th>\n",
-       "      <th>direction80</th>\n",
-       "      <th>speed60</th>\n",
-       "      <th>globalr-1</th>\n",
-       "      <th>mcc</th>\n",
-       "      <th>dq</th>\n",
-       "      <th>temperature150</th>\n",
-       "      <th>speed20</th>\n",
-       "      <th>speed110</th>\n",
-       "      <th>direction120</th>\n",
-       "      <th>speed190</th>\n",
-       "      <th>solarZenith</th>\n",
-       "      <th>temperature90</th>\n",
-       "      <th>direction200</th>\n",
-       "      <th>speed150</th>\n",
-       "      <th>temperature50</th>\n",
-       "      <th>direction30</th>\n",
-       "      <th>temperature160</th>\n",
-       "      <th>direction170</th>\n",
-       "      <th>temperature20</th>\n",
-       "      <th>direction70</th>\n",
-       "      <th>direction130</th>\n",
-       "      <th>temperature200</th>\n",
-       "      <th>speed70</th>\n",
-       "      <th>temperature120</th>\n",
-       "      <th>speed30</th>\n",
-       "      <th>speed100</th>\n",
-       "      <th>speed80</th>\n",
-       "      <th>speed180</th>\n",
-       "      <th>dniCalcd</th>\n",
-       "      <th>speed140</th>\n",
-       "      <th>temperature60</th>\n",
-       "      <th>dateTime</th>\n",
-       "      <th>temperature30</th>\n",
-       "      <th>temperature170</th>\n",
-       "      <th>direction20</th>\n",
-       "      <th>humidity2</th>\n",
-       "      <th>reportCdq-0</th>\n",
-       "      <th>direction180</th>\n",
-       "      <th>realPowerAvg</th>\n",
-       "      <th>direction60</th>\n",
-       "      <th>direction140</th>\n",
-       "      <th>speed40</th>\n",
-       "      <th>hcc</th>\n",
-       "      <th>clearskyGhi</th>\n",
-       "      <th>temperature130</th>\n",
-       "      <th>lcc</th>\n",
-       "      <th>updater</th>\n",
-       "      <th>speed90</th>\n",
-       "      <th>temperature2</th>\n",
-       "      <th>tcc</th>\n",
-       "      <th>direction100</th>\n",
-       "      <th>speed170</th>\n",
-       "      <th>temperature70</th>\n",
-       "      <th>speed130</th>\n",
-       "      <th>direction190</th>\n",
-       "      <th>openCapacity</th>\n",
-       "      <th>temperature40</th>\n",
-       "      <th>creator</th>\n",
-       "      <th>direction10</th>\n",
-       "      <th>temperature180</th>\n",
-       "      <th>direction150</th>\n",
-       "      <th>direction50</th>\n",
-       "      <th>speed50</th>\n",
-       "      <th>updateTime</th>\n",
-       "      <th>direction90</th>\n",
-       "      <th>farmId</th>\n",
-       "      <th>temperature100</th>\n",
-       "      <th>speed10</th>\n",
-       "      <th>temperature140</th>\n",
-       "      <th>speed120</th>\n",
-       "      <th>reportDq-avg</th>\n",
-       "      <th>deleted</th>\n",
-       "      <th>speed200</th>\n",
-       "      <th>realPower</th>\n",
-       "      <th>createTime</th>\n",
-       "      <th>radiation</th>\n",
-       "      <th>surfacePressure</th>\n",
-       "      <th>tpr</th>\n",
-       "      <th>direction110</th>\n",
-       "      <th>time</th>\n",
-       "      <th>speed160</th>\n",
-       "      <th>temperature80</th>\n",
-       "      <th>reportMid-E395</th>\n",
-       "      <th>reportDq-E1</th>\n",
-       "      <th>reportCdq-16</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>673db4f849572921ef42cba8</td>\n",
-       "      <td>27.7109</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>83.1655</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.4782</td>\n",
-       "      <td>7.1173</td>\n",
-       "      <td>424.13</td>\n",
-       "      <td>21.9464</td>\n",
-       "      <td>87.89</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>6.7773</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>3.73</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>27.3009</td>\n",
-       "      <td>83.1655</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>27.4945</td>\n",
-       "      <td>83.4382</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>7.3400</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>6.7773</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>7.4282</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>671.91</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>27.2864</td>\n",
-       "      <td>2024-05-09 12:45:00</td>\n",
-       "      <td>27.3936</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.1655</td>\n",
-       "      <td>74.7145</td>\n",
-       "      <td>54.76</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>53.94</td>\n",
-       "      <td>83.3364</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>6.7773</td>\n",
-       "      <td>48.9836</td>\n",
-       "      <td>967.31</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>33.2100</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>7.4945</td>\n",
-       "      <td>28.0282</td>\n",
-       "      <td>64.0664</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>\"100\"</td>\n",
-       "      <td>27.3282</td>\n",
-       "      <td>xxl-nwp</td>\n",
-       "      <td>82.7745</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>83.3364</td>\n",
-       "      <td>7.1173</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>83.5209</td>\n",
-       "      <td>J00629</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>6.0600</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>26.09</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>817.38</td>\n",
-       "      <td>1011.2582</td>\n",
-       "      <td>3.6418</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>1.715230e+12</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>673db4f849572921ef42cba9</td>\n",
-       "      <td>24.8673</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>156.4900</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>157.9882</td>\n",
-       "      <td>7.2227</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>5.4409</td>\n",
-       "      <td>37.79</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>6.6982</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>62.65</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>24.5636</td>\n",
-       "      <td>156.4900</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>24.7055</td>\n",
-       "      <td>157.7882</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>7.5791</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>6.6982</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>7.7209</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>578.63</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>24.5482</td>\n",
-       "      <td>2024-03-15 16:45:00</td>\n",
-       "      <td>24.6318</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>156.4900</td>\n",
-       "      <td>79.4464</td>\n",
-       "      <td>25.06</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>30.98</td>\n",
-       "      <td>157.2818</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>6.6982</td>\n",
-       "      <td>22.3345</td>\n",
-       "      <td>405.80</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>20.4445</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>7.8382</td>\n",
-       "      <td>25.1018</td>\n",
-       "      <td>42.8709</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>\"100\"</td>\n",
-       "      <td>24.5827</td>\n",
-       "      <td>xxl-nwp</td>\n",
-       "      <td>154.7436</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>157.2818</td>\n",
-       "      <td>7.2227</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>158.1727</td>\n",
-       "      <td>J00629</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>5.5973</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>34.86</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>343.47</td>\n",
-       "      <td>1011.1018</td>\n",
-       "      <td>0.0227</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>1.710492e+12</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2</th>\n",
-       "      <td>673db4f849572921ef42cbaa</td>\n",
-       "      <td>27.8864</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>191.0036</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>192.5145</td>\n",
-       "      <td>5.6836</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.3218</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>5.2318</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>91.77</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>27.5873</td>\n",
-       "      <td>191.0036</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>27.7291</td>\n",
-       "      <td>192.3100</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>5.9927</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>5.2318</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>6.1155</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>27.5745</td>\n",
-       "      <td>2024-07-11 06:00:00</td>\n",
-       "      <td>27.6564</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>191.0036</td>\n",
-       "      <td>86.4000</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>191.7955</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>5.2318</td>\n",
-       "      <td>8.0936</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>4.1973</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>6.2218</td>\n",
-       "      <td>28.1164</td>\n",
-       "      <td>12.6736</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>\"100\"</td>\n",
-       "      <td>27.6055</td>\n",
-       "      <td>xxl-nwp</td>\n",
-       "      <td>189.2900</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>191.7955</td>\n",
-       "      <td>5.6836</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>192.7009</td>\n",
-       "      <td>J00629</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>4.3000</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>1004.3500</td>\n",
-       "      <td>0.3109</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>1.720649e+12</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>3</th>\n",
-       "      <td>673db4f849572921ef42cbab</td>\n",
-       "      <td>26.2082</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>170.0482</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>171.3245</td>\n",
-       "      <td>9.5318</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>0.6045</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>8.7836</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>96.27</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>25.9418</td>\n",
-       "      <td>170.0482</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>26.0682</td>\n",
-       "      <td>171.1555</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>10.0455</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>8.7836</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>10.2473</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>25.9264</td>\n",
-       "      <td>2024-04-05 19:15:00</td>\n",
-       "      <td>26.0018</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>170.0482</td>\n",
-       "      <td>80.6709</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>170.7291</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>8.7836</td>\n",
-       "      <td>-2.7355</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>8.4118</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>10.4173</td>\n",
-       "      <td>26.4127</td>\n",
-       "      <td>6.3491</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>\"100\"</td>\n",
-       "      <td>25.9600</td>\n",
-       "      <td>xxl-nwp</td>\n",
-       "      <td>168.5218</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>170.7291</td>\n",
-       "      <td>9.5318</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>171.4736</td>\n",
-       "      <td>J00629</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>7.2236</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>1006.1800</td>\n",
-       "      <td>0.0100</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>1.712316e+12</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4</th>\n",
-       "      <td>673db4f849572921ef42cbac</td>\n",
-       "      <td>29.5800</td>\n",
-       "      <td>28.7800</td>\n",
-       "      <td>53.7400</td>\n",
-       "      <td>54.8200</td>\n",
-       "      <td>29.1400</td>\n",
-       "      <td>54.3100</td>\n",
-       "      <td>2.7700</td>\n",
-       "      <td>477.2</td>\n",
-       "      <td>2.1000</td>\n",
-       "      <td>43.77</td>\n",
-       "      <td>28.9600</td>\n",
-       "      <td>2.5500</td>\n",
-       "      <td>2.8800</td>\n",
-       "      <td>54.2400</td>\n",
-       "      <td>3.2200</td>\n",
-       "      <td>58.05</td>\n",
-       "      <td>29.2000</td>\n",
-       "      <td>53.2400</td>\n",
-       "      <td>3.0500</td>\n",
-       "      <td>29.3000</td>\n",
-       "      <td>54.9800</td>\n",
-       "      <td>28.9200</td>\n",
-       "      <td>53.6200</td>\n",
-       "      <td>29.4900</td>\n",
-       "      <td>54.4000</td>\n",
-       "      <td>54.1200</td>\n",
-       "      <td>28.7400</td>\n",
-       "      <td>2.8000</td>\n",
-       "      <td>29.1000</td>\n",
-       "      <td>2.6500</td>\n",
-       "      <td>2.8600</td>\n",
-       "      <td>2.8200</td>\n",
-       "      <td>3.1800</td>\n",
-       "      <td>556.88</td>\n",
-       "      <td>3.0100</td>\n",
-       "      <td>29.2700</td>\n",
-       "      <td>2024-09-03 16:30:00</td>\n",
-       "      <td>29.3900</td>\n",
-       "      <td>28.8700</td>\n",
-       "      <td>55.3000</td>\n",
-       "      <td>75.4700</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>53.4900</td>\n",
-       "      <td>59.27</td>\n",
-       "      <td>54.5300</td>\n",
-       "      <td>53.9900</td>\n",
-       "      <td>2.6900</td>\n",
-       "      <td>31.5700</td>\n",
-       "      <td>439.67</td>\n",
-       "      <td>29.0500</td>\n",
-       "      <td>10.1800</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>2.8400</td>\n",
-       "      <td>29.8700</td>\n",
-       "      <td>38.5400</td>\n",
-       "      <td>54.3100</td>\n",
-       "      <td>3.1400</td>\n",
-       "      <td>29.2400</td>\n",
-       "      <td>2.9600</td>\n",
-       "      <td>53.3700</td>\n",
-       "      <td>\"100\"</td>\n",
-       "      <td>29.3400</td>\n",
-       "      <td>xxl-nwp</td>\n",
-       "      <td>55.6200</td>\n",
-       "      <td>28.8300</td>\n",
-       "      <td>53.8700</td>\n",
-       "      <td>54.6500</td>\n",
-       "      <td>2.7400</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>54.2500</td>\n",
-       "      <td>J00629</td>\n",
-       "      <td>29.1700</td>\n",
-       "      <td>2.4400</td>\n",
-       "      <td>29.0100</td>\n",
-       "      <td>2.9200</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>3.2700</td>\n",
-       "      <td>56.27</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>408.00</td>\n",
-       "      <td>1003.1300</td>\n",
-       "      <td>4.6700</td>\n",
-       "      <td>54.3700</td>\n",
-       "      <td>1.725352e+12</td>\n",
-       "      <td>3.0900</td>\n",
-       "      <td>29.2100</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>29.67</td>\n",
-       "      <td>50.64</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id  temperature10  temperature190  direction160  \\\n",
-       "0  673db4f849572921ef42cba8        27.7109         27.2327       83.8900   \n",
-       "1  673db4f849572921ef42cba9        24.8673         24.5118      159.0355   \n",
-       "2  673db4f849572921ef42cbaa        27.8864         27.5400      193.5809   \n",
-       "3  673db4f849572921ef42cbab        26.2082         25.8855      172.3518   \n",
-       "4  673db4f849572921ef42cbac        29.5800         28.7800       53.7400   \n",
-       "\n",
-       "   direction40  temperature110  direction80  speed60 globalr-1      mcc  \\\n",
-       "0      83.1655         27.2327      83.4782   7.1173    424.13  21.9464   \n",
-       "1     156.4900         24.5118     157.9882   7.2227       NaN   5.4409   \n",
-       "2     191.0036         27.5400     192.5145   5.6836       0.0   3.3218   \n",
-       "3     170.0482         25.8855     171.3245   9.5318       NaN   0.6045   \n",
-       "4      54.8200         29.1400      54.3100   2.7700     477.2   2.1000   \n",
-       "\n",
-       "      dq  temperature150  speed20  speed110  direction120  speed190  \\\n",
-       "0  87.89         27.2327   6.7773    7.6555       83.8900    7.6555   \n",
-       "1  37.79         24.5118   6.6982    8.0836      159.0355    8.0836   \n",
-       "2   0.00         27.5400   5.2318    6.4600      193.5809    6.4600   \n",
-       "3   0.00         25.8855   8.7836   10.7827      172.3518   10.7827   \n",
-       "4  43.77         28.9600   2.5500    2.8800       54.2400    3.2200   \n",
-       "\n",
-       "   solarZenith  temperature90  direction200  speed150  temperature50  \\\n",
-       "0         3.73        27.2327       83.8900    7.6555        27.3009   \n",
-       "1        62.65        24.5118      159.0355    8.0836        24.5636   \n",
-       "2        91.77        27.5400      193.5809    6.4600        27.5873   \n",
-       "3        96.27        25.8855      172.3518   10.7827        25.9418   \n",
-       "4        58.05        29.2000       53.2400    3.0500        29.3000   \n",
-       "\n",
-       "   direction30  temperature160  direction170  temperature20  direction70  \\\n",
-       "0      83.1655         27.2327       83.8900        27.4945      83.4382   \n",
-       "1     156.4900         24.5118      159.0355        24.7055     157.7882   \n",
-       "2     191.0036         27.5400      193.5809        27.7291     192.3100   \n",
-       "3     170.0482         25.8855      172.3518        26.0682     171.1555   \n",
-       "4      54.9800         28.9200       53.6200        29.4900      54.4000   \n",
-       "\n",
-       "   direction130  temperature200  speed70  temperature120  speed30  speed100  \\\n",
-       "0       83.8900         27.2327   7.3400         27.2327   6.7773    7.6555   \n",
-       "1      159.0355         24.5118   7.5791         24.5118   6.6982    8.0836   \n",
-       "2      193.5809         27.5400   5.9927         27.5400   5.2318    6.4600   \n",
-       "3      172.3518         25.8855  10.0455         25.8855   8.7836   10.7827   \n",
-       "4       54.1200         28.7400   2.8000         29.1000   2.6500    2.8600   \n",
-       "\n",
-       "   speed80  speed180  dniCalcd  speed140  temperature60             dateTime  \\\n",
-       "0   7.4282    7.6555    671.91    7.6555        27.2864  2024-05-09 12:45:00   \n",
-       "1   7.7209    8.0836    578.63    8.0836        24.5482  2024-03-15 16:45:00   \n",
-       "2   6.1155    6.4600      0.00    6.4600        27.5745  2024-07-11 06:00:00   \n",
-       "3  10.2473   10.7827      0.00   10.7827        25.9264  2024-04-05 19:15:00   \n",
-       "4   2.8200    3.1800    556.88    3.0100        29.2700  2024-09-03 16:30:00   \n",
-       "\n",
-       "   temperature30  temperature170  direction20  humidity2 reportCdq-0  \\\n",
-       "0        27.3936         27.2327      83.1655    74.7145       54.76   \n",
-       "1        24.6318         24.5118     156.4900    79.4464       25.06   \n",
-       "2        27.6564         27.5400     191.0036    86.4000         0.0   \n",
-       "3        26.0018         25.8855     170.0482    80.6709         NaN   \n",
-       "4        29.3900         28.8700      55.3000    75.4700         NaN   \n",
-       "\n",
-       "   direction180 realPowerAvg  direction60  direction140  speed40      hcc  \\\n",
-       "0       83.8900        53.94      83.3364       83.8900   6.7773  48.9836   \n",
-       "1      159.0355        30.98     157.2818      159.0355   6.6982  22.3345   \n",
-       "2      193.5809          0.0     191.7955      193.5809   5.2318   8.0936   \n",
-       "3      172.3518          0.0     170.7291      172.3518   8.7836  -2.7355   \n",
-       "4       53.4900        59.27      54.5300       53.9900   2.6900  31.5700   \n",
-       "\n",
-       "   clearskyGhi  temperature130      lcc  updater  speed90  temperature2  \\\n",
-       "0       967.31         27.2327  33.2100      NaN   7.4945       28.0282   \n",
-       "1       405.80         24.5118  20.4445      NaN   7.8382       25.1018   \n",
-       "2         0.00         27.5400   4.1973      NaN   6.2218       28.1164   \n",
-       "3         0.00         25.8855   8.4118      NaN  10.4173       26.4127   \n",
-       "4       439.67         29.0500  10.1800      NaN   2.8400       29.8700   \n",
-       "\n",
-       "       tcc  direction100  speed170  temperature70  speed130  direction190  \\\n",
-       "0  64.0664       83.8900    7.6555        27.2327    7.6555       83.8900   \n",
-       "1  42.8709      159.0355    8.0836        24.5118    8.0836      159.0355   \n",
-       "2  12.6736      193.5809    6.4600        27.5400    6.4600      193.5809   \n",
-       "3   6.3491      172.3518   10.7827        25.8855   10.7827      172.3518   \n",
-       "4  38.5400       54.3100    3.1400        29.2400    2.9600       53.3700   \n",
-       "\n",
-       "  openCapacity  temperature40  creator  direction10  temperature180  \\\n",
-       "0        \"100\"        27.3282  xxl-nwp      82.7745         27.2327   \n",
-       "1        \"100\"        24.5827  xxl-nwp     154.7436         24.5118   \n",
-       "2        \"100\"        27.6055  xxl-nwp     189.2900         27.5400   \n",
-       "3        \"100\"        25.9600  xxl-nwp     168.5218         25.8855   \n",
-       "4        \"100\"        29.3400  xxl-nwp      55.6200         28.8300   \n",
-       "\n",
-       "   direction150  direction50  speed50  updateTime  direction90  farmId  \\\n",
-       "0       83.8900      83.3364   7.1173         NaN      83.5209  J00629   \n",
-       "1      159.0355     157.2818   7.2227         NaN     158.1727  J00629   \n",
-       "2      193.5809     191.7955   5.6836         NaN     192.7009  J00629   \n",
-       "3      172.3518     170.7291   9.5318         NaN     171.4736  J00629   \n",
-       "4       53.8700      54.6500   2.7400         NaN      54.2500  J00629   \n",
-       "\n",
-       "   temperature100  speed10  temperature140  speed120 reportDq-avg  deleted  \\\n",
-       "0         27.2327   6.0600         27.2327    7.6555        -0.99      NaN   \n",
-       "1         24.5118   5.5973         24.5118    8.0836          NaN      NaN   \n",
-       "2         27.5400   4.3000         27.5400    6.4600          NaN      NaN   \n",
-       "3         25.8855   7.2236         25.8855   10.7827          NaN      NaN   \n",
-       "4         29.1700   2.4400         29.0100    2.9200          NaN      NaN   \n",
-       "\n",
-       "   speed200 realPower  createTime  radiation  surfacePressure     tpr  \\\n",
-       "0    7.6555     26.09         NaN     817.38        1011.2582  3.6418   \n",
-       "1    8.0836     34.86         NaN     343.47        1011.1018  0.0227   \n",
-       "2    6.4600       0.0         NaN       0.00        1004.3500  0.3109   \n",
-       "3   10.7827       0.0         NaN       0.00        1006.1800  0.0100   \n",
-       "4    3.2700     56.27         NaN     408.00        1003.1300  4.6700   \n",
-       "\n",
-       "   direction110          time  speed160  temperature80 reportMid-E395  \\\n",
-       "0       83.8900  1.715230e+12    7.6555        27.2327            NaN   \n",
-       "1      159.0355  1.710492e+12    8.0836        24.5118            NaN   \n",
-       "2      193.5809  1.720649e+12    6.4600        27.5400          -0.99   \n",
-       "3      172.3518  1.712316e+12   10.7827        25.8855            NaN   \n",
-       "4       54.3700  1.725352e+12    3.0900        29.2100          -0.99   \n",
-       "\n",
-       "  reportDq-E1 reportCdq-16  \n",
-       "0         NaN          NaN  \n",
-       "1         NaN          NaN  \n",
-       "2         0.0          NaN  \n",
-       "3         NaN          NaN  \n",
-       "4       29.67        50.64  "
-      ]
-     },
-     "execution_count": 8,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import pymongo\n",
-    "import pandas as pd\n",
-    "# 显示所有列\n",
-    "pd.set_option('display.max_columns', None)\n",
-    "\n",
-    "# 显示所有行(可选)\n",
-    "pd.set_option('display.max_rows', None)\n",
-    "\n",
-    "# 连接 MongoDB\n",
-    "client = pymongo.MongoClient(\"mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/\")  # 替换为你的连接信息\n",
-    "db = client['db2']  # 替换为你的数据库名\n",
-    "collection = db['j00629_copy_agcavc']  # 替换为你的集合名\n",
-    "\n",
-    "# 查询数据\n",
-    "query = {}  # 空字典表示查询所有数据\n",
-    "cursor = collection.find(query)\n",
-    "\n",
-    "# 将数据转换为 DataFrame\n",
-    "df = pd.DataFrame(list(cursor))\n",
-    "\n",
-    "# 如果有 `_id` 字段,可能需要处理为字符串或删除\n",
-    "if '_id' in df.columns:\n",
-    "    df['_id'] = df['_id'].astype(str)  # 将 ObjectId 转为字符串\n",
-    "    # df.drop('_id', axis=1, inplace=True)  # 或者删除 `_id` 字段\n",
-    "client.close()\n",
-    "df.head()# 查看数据\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "2d45d74a-1157-4226-9aec-a11e39b1e143",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>dateTime</th>\n",
-       "      <th>dq</th>\n",
-       "      <th>realPowerAvg</th>\n",
-       "      <th>realPower</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>7522</th>\n",
-       "      <td>2024-06-04 00:00:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>10018</th>\n",
-       "      <td>2024-06-04 00:15:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>7349</th>\n",
-       "      <td>2024-06-04 00:30:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4732</th>\n",
-       "      <td>2024-06-04 00:45:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>6609</th>\n",
-       "      <td>2024-06-04 01:00:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4990</th>\n",
-       "      <td>2024-06-04 01:15:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>7625</th>\n",
-       "      <td>2024-06-04 01:30:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>10198</th>\n",
-       "      <td>2024-06-04 01:45:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>9656</th>\n",
-       "      <td>2024-06-04 02:00:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>8305</th>\n",
-       "      <td>2024-06-04 02:15:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4449</th>\n",
-       "      <td>2024-06-04 02:30:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>7132</th>\n",
-       "      <td>2024-06-04 02:45:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>12723</th>\n",
-       "      <td>2024-06-04 03:00:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>6859</th>\n",
-       "      <td>2024-06-04 03:15:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>9491</th>\n",
-       "      <td>2024-06-04 03:30:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>6996</th>\n",
-       "      <td>2024-06-04 03:45:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1151</th>\n",
-       "      <td>2024-06-04 04:00:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>11510</th>\n",
-       "      <td>2024-06-04 04:15:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>11087</th>\n",
-       "      <td>2024-06-04 04:30:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2081</th>\n",
-       "      <td>2024-06-04 04:45:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>15081</th>\n",
-       "      <td>2024-06-04 05:00:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>12451</th>\n",
-       "      <td>2024-06-04 05:15:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>14012</th>\n",
-       "      <td>2024-06-04 05:30:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4853</th>\n",
-       "      <td>2024-06-04 05:45:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>16011</th>\n",
-       "      <td>2024-06-04 06:00:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>14169</th>\n",
-       "      <td>2024-06-04 06:15:00</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>0.18</td>\n",
-       "      <td>0.64</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>201</th>\n",
-       "      <td>2024-06-04 06:30:00</td>\n",
-       "      <td>0.20</td>\n",
-       "      <td>1.5</td>\n",
-       "      <td>2.31</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>11367</th>\n",
-       "      <td>2024-06-04 06:45:00</td>\n",
-       "      <td>2.99</td>\n",
-       "      <td>2.8</td>\n",
-       "      <td>3.84</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>9002</th>\n",
-       "      <td>2024-06-04 07:00:00</td>\n",
-       "      <td>6.63</td>\n",
-       "      <td>5.12</td>\n",
-       "      <td>5.68</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>15876</th>\n",
-       "      <td>2024-06-04 07:15:00</td>\n",
-       "      <td>10.83</td>\n",
-       "      <td>8.6</td>\n",
-       "      <td>9.49</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>16374</th>\n",
-       "      <td>2024-06-04 07:30:00</td>\n",
-       "      <td>15.40</td>\n",
-       "      <td>9.61</td>\n",
-       "      <td>9.49</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>10189</th>\n",
-       "      <td>2024-06-04 07:45:00</td>\n",
-       "      <td>20.22</td>\n",
-       "      <td>9.04</td>\n",
-       "      <td>9.03</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>13892</th>\n",
-       "      <td>2024-06-04 08:00:00</td>\n",
-       "      <td>25.15</td>\n",
-       "      <td>9.59</td>\n",
-       "      <td>10.55</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>16253</th>\n",
-       "      <td>2024-06-04 08:15:00</td>\n",
-       "      <td>30.17</td>\n",
-       "      <td>11.53</td>\n",
-       "      <td>12.53</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>14956</th>\n",
-       "      <td>2024-06-04 08:30:00</td>\n",
-       "      <td>35.19</td>\n",
-       "      <td>13.5</td>\n",
-       "      <td>14.52</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>13222</th>\n",
-       "      <td>2024-06-04 08:45:00</td>\n",
-       "      <td>40.15</td>\n",
-       "      <td>16.07</td>\n",
-       "      <td>17.58</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2344</th>\n",
-       "      <td>2024-06-04 09:00:00</td>\n",
-       "      <td>45.03</td>\n",
-       "      <td>18.76</td>\n",
-       "      <td>18.8</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>14543</th>\n",
-       "      <td>2024-06-04 09:15:00</td>\n",
-       "      <td>49.77</td>\n",
-       "      <td>20.09</td>\n",
-       "      <td>19.41</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>11911</th>\n",
-       "      <td>2024-06-04 09:30:00</td>\n",
-       "      <td>54.34</td>\n",
-       "      <td>18.4</td>\n",
-       "      <td>19.72</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>648</th>\n",
-       "      <td>2024-06-04 09:45:00</td>\n",
-       "      <td>58.16</td>\n",
-       "      <td>22.01</td>\n",
-       "      <td>22.63</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>102</th>\n",
-       "      <td>2024-06-04 10:00:00</td>\n",
-       "      <td>61.69</td>\n",
-       "      <td>27.25</td>\n",
-       "      <td>33.96</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>16984</th>\n",
-       "      <td>2024-06-04 10:15:00</td>\n",
-       "      <td>64.90</td>\n",
-       "      <td>36.96</td>\n",
-       "      <td>37.79</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>14350</th>\n",
-       "      <td>2024-06-04 10:30:00</td>\n",
-       "      <td>67.78</td>\n",
-       "      <td>39.46</td>\n",
-       "      <td>40.53</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>15504</th>\n",
-       "      <td>2024-06-04 10:45:00</td>\n",
-       "      <td>70.31</td>\n",
-       "      <td>41.65</td>\n",
-       "      <td>42.67</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>3414</th>\n",
-       "      <td>2024-06-04 11:00:00</td>\n",
-       "      <td>72.49</td>\n",
-       "      <td>44.62</td>\n",
-       "      <td>46.03</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>9945</th>\n",
-       "      <td>2024-06-04 11:15:00</td>\n",
-       "      <td>74.28</td>\n",
-       "      <td>45.27</td>\n",
-       "      <td>38.03</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2249</th>\n",
-       "      <td>2024-06-04 11:30:00</td>\n",
-       "      <td>75.70</td>\n",
-       "      <td>39.89</td>\n",
-       "      <td>41.44</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>13228</th>\n",
-       "      <td>2024-06-04 11:45:00</td>\n",
-       "      <td>76.74</td>\n",
-       "      <td>42.34</td>\n",
-       "      <td>55.0</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>10719</th>\n",
-       "      <td>2024-06-04 12:00:00</td>\n",
-       "      <td>77.41</td>\n",
-       "      <td>64.81</td>\n",
-       "      <td>67.32</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>13527</th>\n",
-       "      <td>2024-06-04 12:15:00</td>\n",
-       "      <td>77.70</td>\n",
-       "      <td>65.73</td>\n",
-       "      <td>66.39</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>3443</th>\n",
-       "      <td>2024-06-04 12:30:00</td>\n",
-       "      <td>77.61</td>\n",
-       "      <td>71.97</td>\n",
-       "      <td>76.51</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>10200</th>\n",
-       "      <td>2024-06-04 12:45:00</td>\n",
-       "      <td>77.14</td>\n",
-       "      <td>73.71</td>\n",
-       "      <td>60.82</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>10053</th>\n",
-       "      <td>2024-06-04 13:00:00</td>\n",
-       "      <td>76.30</td>\n",
-       "      <td>71.39</td>\n",
-       "      <td>77.21</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4088</th>\n",
-       "      <td>2024-06-04 13:15:00</td>\n",
-       "      <td>75.11</td>\n",
-       "      <td>74.44</td>\n",
-       "      <td>71.19</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4388</th>\n",
-       "      <td>2024-06-04 13:30:00</td>\n",
-       "      <td>73.56</td>\n",
-       "      <td>72.99</td>\n",
-       "      <td>70.68</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>11380</th>\n",
-       "      <td>2024-06-04 13:45:00</td>\n",
-       "      <td>71.68</td>\n",
-       "      <td>54.91</td>\n",
-       "      <td>46.13</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4343</th>\n",
-       "      <td>2024-06-04 14:00:00</td>\n",
-       "      <td>69.48</td>\n",
-       "      <td>45.99</td>\n",
-       "      <td>45.35</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2651</th>\n",
-       "      <td>2024-06-04 14:15:00</td>\n",
-       "      <td>66.97</td>\n",
-       "      <td>51.0</td>\n",
-       "      <td>64.43</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>9555</th>\n",
-       "      <td>2024-06-04 14:30:00</td>\n",
-       "      <td>64.18</td>\n",
-       "      <td>57.69</td>\n",
-       "      <td>50.88</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2750</th>\n",
-       "      <td>2024-06-04 14:45:00</td>\n",
-       "      <td>61.10</td>\n",
-       "      <td>50.48</td>\n",
-       "      <td>52.28</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1300</th>\n",
-       "      <td>2024-06-04 15:00:00</td>\n",
-       "      <td>57.77</td>\n",
-       "      <td>52.93</td>\n",
-       "      <td>52.62</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>7278</th>\n",
-       "      <td>2024-06-04 15:15:00</td>\n",
-       "      <td>54.21</td>\n",
-       "      <td>50.11</td>\n",
-       "      <td>51.52</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>6507</th>\n",
-       "      <td>2024-06-04 15:30:00</td>\n",
-       "      <td>50.43</td>\n",
-       "      <td>52.03</td>\n",
-       "      <td>53.18</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2039</th>\n",
-       "      <td>2024-06-04 15:45:00</td>\n",
-       "      <td>46.64</td>\n",
-       "      <td>50.35</td>\n",
-       "      <td>53.33</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2237</th>\n",
-       "      <td>2024-06-04 16:00:00</td>\n",
-       "      <td>42.66</td>\n",
-       "      <td>56.25</td>\n",
-       "      <td>55.31</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>8207</th>\n",
-       "      <td>2024-06-04 16:15:00</td>\n",
-       "      <td>38.52</td>\n",
-       "      <td>51.52</td>\n",
-       "      <td>49.92</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>5581</th>\n",
-       "      <td>2024-06-04 16:30:00</td>\n",
-       "      <td>34.25</td>\n",
-       "      <td>47.22</td>\n",
-       "      <td>56.6</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                  dateTime     dq realPowerAvg realPower\n",
-       "7522   2024-06-04 00:00:00   0.00          0.0       0.0\n",
-       "10018  2024-06-04 00:15:00   0.00          0.0       0.0\n",
-       "7349   2024-06-04 00:30:00   0.00          0.0       0.0\n",
-       "4732   2024-06-04 00:45:00   0.00          0.0       0.0\n",
-       "6609   2024-06-04 01:00:00   0.00          0.0       0.0\n",
-       "4990   2024-06-04 01:15:00   0.00          0.0       0.0\n",
-       "7625   2024-06-04 01:30:00   0.00          0.0       0.0\n",
-       "10198  2024-06-04 01:45:00   0.00          0.0       0.0\n",
-       "9656   2024-06-04 02:00:00   0.00          0.0       0.0\n",
-       "8305   2024-06-04 02:15:00   0.00          0.0       0.0\n",
-       "4449   2024-06-04 02:30:00   0.00          0.0       0.0\n",
-       "7132   2024-06-04 02:45:00   0.00          0.0       0.0\n",
-       "12723  2024-06-04 03:00:00   0.00          0.0       0.0\n",
-       "6859   2024-06-04 03:15:00   0.00          0.0       0.0\n",
-       "9491   2024-06-04 03:30:00   0.00          0.0       0.0\n",
-       "6996   2024-06-04 03:45:00   0.00          0.0       0.0\n",
-       "1151   2024-06-04 04:00:00   0.00          0.0       0.0\n",
-       "11510  2024-06-04 04:15:00   0.00          0.0       0.0\n",
-       "11087  2024-06-04 04:30:00   0.00          0.0       0.0\n",
-       "2081   2024-06-04 04:45:00   0.00          0.0       0.0\n",
-       "15081  2024-06-04 05:00:00   0.00          0.0       0.0\n",
-       "12451  2024-06-04 05:15:00   0.00          0.0       0.0\n",
-       "14012  2024-06-04 05:30:00   0.00          0.0       0.0\n",
-       "4853   2024-06-04 05:45:00   0.00          0.0       0.0\n",
-       "16011  2024-06-04 06:00:00   0.00          0.0       0.0\n",
-       "14169  2024-06-04 06:15:00   0.00         0.18      0.64\n",
-       "201    2024-06-04 06:30:00   0.20          1.5      2.31\n",
-       "11367  2024-06-04 06:45:00   2.99          2.8      3.84\n",
-       "9002   2024-06-04 07:00:00   6.63         5.12      5.68\n",
-       "15876  2024-06-04 07:15:00  10.83          8.6      9.49\n",
-       "16374  2024-06-04 07:30:00  15.40         9.61      9.49\n",
-       "10189  2024-06-04 07:45:00  20.22         9.04      9.03\n",
-       "13892  2024-06-04 08:00:00  25.15         9.59     10.55\n",
-       "16253  2024-06-04 08:15:00  30.17        11.53     12.53\n",
-       "14956  2024-06-04 08:30:00  35.19         13.5     14.52\n",
-       "13222  2024-06-04 08:45:00  40.15        16.07     17.58\n",
-       "2344   2024-06-04 09:00:00  45.03        18.76      18.8\n",
-       "14543  2024-06-04 09:15:00  49.77        20.09     19.41\n",
-       "11911  2024-06-04 09:30:00  54.34         18.4     19.72\n",
-       "648    2024-06-04 09:45:00  58.16        22.01     22.63\n",
-       "102    2024-06-04 10:00:00  61.69        27.25     33.96\n",
-       "16984  2024-06-04 10:15:00  64.90        36.96     37.79\n",
-       "14350  2024-06-04 10:30:00  67.78        39.46     40.53\n",
-       "15504  2024-06-04 10:45:00  70.31        41.65     42.67\n",
-       "3414   2024-06-04 11:00:00  72.49        44.62     46.03\n",
-       "9945   2024-06-04 11:15:00  74.28        45.27     38.03\n",
-       "2249   2024-06-04 11:30:00  75.70        39.89     41.44\n",
-       "13228  2024-06-04 11:45:00  76.74        42.34      55.0\n",
-       "10719  2024-06-04 12:00:00  77.41        64.81     67.32\n",
-       "13527  2024-06-04 12:15:00  77.70        65.73     66.39\n",
-       "3443   2024-06-04 12:30:00  77.61        71.97     76.51\n",
-       "10200  2024-06-04 12:45:00  77.14        73.71     60.82\n",
-       "10053  2024-06-04 13:00:00  76.30        71.39     77.21\n",
-       "4088   2024-06-04 13:15:00  75.11        74.44     71.19\n",
-       "4388   2024-06-04 13:30:00  73.56        72.99     70.68\n",
-       "11380  2024-06-04 13:45:00  71.68        54.91     46.13\n",
-       "4343   2024-06-04 14:00:00  69.48        45.99     45.35\n",
-       "2651   2024-06-04 14:15:00  66.97         51.0     64.43\n",
-       "9555   2024-06-04 14:30:00  64.18        57.69     50.88\n",
-       "2750   2024-06-04 14:45:00  61.10        50.48     52.28\n",
-       "1300   2024-06-04 15:00:00  57.77        52.93     52.62\n",
-       "7278   2024-06-04 15:15:00  54.21        50.11     51.52\n",
-       "6507   2024-06-04 15:30:00  50.43        52.03     53.18\n",
-       "2039   2024-06-04 15:45:00  46.64        50.35     53.33\n",
-       "2237   2024-06-04 16:00:00  42.66        56.25     55.31\n",
-       "8207   2024-06-04 16:15:00  38.52        51.52     49.92\n",
-       "5581   2024-06-04 16:30:00  34.25        47.22      56.6"
-      ]
-     },
-     "execution_count": 11,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df[df['dateTime'].str.contains('2024-06-04')][['dateTime','dq','realPowerAvg','realPower']].sort_values(by='dateTime')"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 5 - 5
data_processing/processing_limit_power/processing_limit_power_by_agcavc/processing_limit_power_by_agcavc.py → data_processing/processing_limit_power/processing_limit_power_by_agcavc.py

@@ -1,13 +1,13 @@
-import argparse
-import pandas as pd 
+import pandas as pd
 from pymongo import MongoClient
 from sqlalchemy import create_engine
 from flask import Flask,request,jsonify
-from waitress import serve
 import time
 import logging
 import traceback
 app = Flask('processing_limit_power_by_agcavc——service')
+
+
 @app.route('/hello', methods=['POST','GET'])
 def hello():
     return jsonify(message='Hello, World!')
@@ -25,6 +25,7 @@ def get_data_from_mongo(args):
     client.close()
     return df
 
+
 def insert_data_into_mongo(res_df,args):
     mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
     client = MongoClient(mongodb_connection)
@@ -39,6 +40,7 @@ def insert_data_into_mongo(res_df,args):
     collection.insert_many(data_dict)
     print("data inserted successfully!")
 
+
 #1.AGC/AVC信号判断限电(有的场站准 有的不准) 1种方法  数据库数据有问题 暂时用不了
 def  agc_avc_judgement(power_df,args):
     timeBegin,timeEnd,col_time,mysql_connection,avc_table = args['timeBegin'], args['timeEnd'],args['col_time'],args['mysql_connection'],args['agc_avc_table']
@@ -92,8 +94,6 @@ def processing_limit_power_by_agcavc():
     return result
 
 
-
-    
 if __name__=="__main__":
     print("Program starts execution!")
     logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "processing_limit_power_by_agcavc.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 106
data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/processing_limit_power_by_agcavc-checkpoint.py

@@ -1,106 +0,0 @@
-import argparse
-import pandas as pd 
-from pymongo import MongoClient
-from sqlalchemy import create_engine
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import logging
-import traceback
-app = Flask('processing_limit_power_by_agcavc——service')
-@app.route('/hello', methods=['POST','GET'])
-def hello():
-    return jsonify(message='Hello, World!')
-
-
-def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    collection = db[mongodb_read_table]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
-    client.close()
-    return df
-
-def insert_data_into_mongo(res_df,args):
-    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    if mongodb_write_table in db.list_collection_names():
-        db[mongodb_write_table].drop()
-        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
-    collection = db[mongodb_write_table]  # 集合名称
-    # 将 DataFrame 转为字典格式
-    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
-    # 插入到 MongoDB
-    collection.insert_many(data_dict)
-    print("data inserted successfully!")
-
-#1.AGC/AVC信号判断限电(有的场站准 有的不准) 1种方法  数据库数据有问题 暂时用不了
-def  agc_avc_judgement(power_df,args):
-    timeBegin,timeEnd,col_time,mysql_connection,avc_table = args['timeBegin'], args['timeEnd'],args['col_time'],args['mysql_connection'],args['agc_avc_table']
-    #限电记录
-    clean_record = []
-    # 创建连接  
-    # cnx = mysql.connector.connect(user=user,password=password,host=host,port=port,database=database)  
-    # # 创建一个游标对象  
-    # cursor = cnx.cursor()
-    engine = create_engine(mysql_connection)
-    # 定义SQL查询  
-    df = pd.read_sql_query(f"select C_TIME AS {col_time}, 1 as agc_avc_limit from {avc_table} where C_TIME>='{timeBegin} 00:00:00' and C_TIME<='{timeEnd} 23:59:59' and  (C_IS_RATIONING_BY_AUTO_CONTROL is True or C_IS_RATIONING_BY_MANUAL_CONTROL=1)", engine)
-    df[col_time] = pd.to_datetime(df[col_time]).dt.strftime('%Y-%m-%d %H:%M:%S')
-    if df.shape[0]>0:
-        print(f"根据限电记录清洗,{timeBegin}至{timeEnd},限电时长共计{round(df.shape[0]/60,2)}小时")
-        clean_record = df[col_time].tolist()
-    # 关闭游标和连接  
-    # cursor.close()  
-    # cnx.close()
-    print(power_df.columns)
-    power_df = pd.merge(power_df,df,on=col_time,how='left')
-    return power_df[power_df['agc_avc_limit']!=1].drop('agc_avc_limit',axis=1)
-
-
-@app.route('/processing_limit_power_by_agcavc', methods=['POST','GET'])
-def processing_limit_power_by_agcavc():
-    # 获取程序开始时间  
-    start_time = time.time()  
-    result = {}
-    success = 0
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print('args',args)
-        logger.info(args)
-        power_df = get_data_from_mongo(args)
-        res_df = agc_avc_judgement(power_df,args)
-        insert_data_into_mongo(res_df,args)
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-   
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    print("Program execution ends!")
-    return result
-
-
-
-    
-if __name__=="__main__":
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("processing_limit_power_by_agcavc")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10086)
-    print("server start!")
-    
-   
-    

+ 0 - 6
data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,6 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-SQLAlchemy==2.0.30
-PyMySQL==1.1.1
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 607
data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,607 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 09:07:30,205 - waitress - INFO - Serving on http://0.0.0.0:10086\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 09:07:33,171 - processing_limit_power_by_agcavc - INFO - {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n",
-      "Index(['_id', 'temperature10', 'temperature190', 'direction160', 'direction40',\n",
-      "       'temperature110', 'direction80', 'speed60', 'globalr-1', 'mcc', 'dq',\n",
-      "       'temperature150', 'speed20', 'speed110', 'direction120', 'speed190',\n",
-      "       'solarZenith', 'temperature90', 'direction200', 'speed150',\n",
-      "       'temperature50', 'direction30', 'temperature160', 'direction170',\n",
-      "       'temperature20', 'direction70', 'direction130', 'temperature200',\n",
-      "       'speed70', 'temperature120', 'speed30', 'speed100', 'speed80',\n",
-      "       'speed180', 'dniCalcd', 'speed140', 'temperature60', 'dateTime',\n",
-      "       'temperature30', 'temperature170', 'direction20', 'humidity2',\n",
-      "       'reportCdq-0', 'direction180', 'realPowerAvg', 'direction60',\n",
-      "       'direction140', 'speed40', 'hcc', 'clearskyGhi', 'temperature130',\n",
-      "       'lcc', 'updater', 'speed90', 'temperature2', 'tcc', 'direction100',\n",
-      "       'speed170', 'temperature70', 'speed130', 'direction190', 'openCapacity',\n",
-      "       'temperature40', 'creator', 'direction10', 'temperature180',\n",
-      "       'direction150', 'direction50', 'speed50', 'updateTime', 'direction90',\n",
-      "       'farmId', 'temperature100', 'speed10', 'temperature140', 'speed120',\n",
-      "       'reportDq-avg', 'deleted', 'speed200', 'realPower', 'createTime',\n",
-      "       'radiation', 'surfacePressure', 'tpr', 'direction110', 'time',\n",
-      "       'speed160', 'temperature80', 'reportMid-E395', 'reportDq-E1',\n",
-      "       'reportCdq-16'],\n",
-      "      dtype='object')\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 09:14:41,418 - processing_limit_power_by_agcavc - INFO - {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00629_20240820091235', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00629_20240820091235', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n",
-      "根据限电记录清洗,2024-03-05至2024-09-04,限电时长共计143.62小时\n",
-      "Index(['_id', 'temperature10', 'temperature190', 'direction160', 'direction40',\n",
-      "       'temperature110', 'direction80', 'speed60', 'globalr-1', 'mcc', 'dq',\n",
-      "       'temperature150', 'speed20', 'speed110', 'direction120', 'speed190',\n",
-      "       'solarZenith', 'temperature90', 'direction200', 'speed150',\n",
-      "       'temperature50', 'direction30', 'temperature160', 'direction170',\n",
-      "       'temperature20', 'direction70', 'direction130', 'temperature200',\n",
-      "       'speed70', 'temperature120', 'speed30', 'speed100', 'speed80',\n",
-      "       'speed180', 'dniCalcd', 'speed140', 'temperature60', 'dateTime',\n",
-      "       'temperature30', 'temperature170', 'direction20', 'humidity2',\n",
-      "       'reportCdq-0', 'direction180', 'realPowerAvg', 'direction60',\n",
-      "       'direction140', 'speed40', 'hcc', 'clearskyGhi', 'temperature130',\n",
-      "       'lcc', 'updater', 'speed90', 'temperature2', 'tcc', 'direction100',\n",
-      "       'speed170', 'temperature70', 'speed130', 'direction190', 'openCapacity',\n",
-      "       'temperature40', 'creator', 'direction10', 'temperature180',\n",
-      "       'direction150', 'direction50', 'speed50', 'updateTime', 'direction90',\n",
-      "       'farmId', 'temperature100', 'speed10', 'temperature140', 'speed120',\n",
-      "       'reportDq-avg', 'deleted', 'speed200', 'realPower', 'createTime',\n",
-      "       'radiation', 'surfacePressure', 'tpr', 'direction110', 'time',\n",
-      "       'speed160', 'temperature80', 'reportMid-E395', 'reportDq-E1',\n",
-      "       'reportCdq-16'],\n",
-      "      dtype='object')\n",
-      "Collection 'j00629_copy_agcavc already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    "%run processing_limit_power_by_agcavc.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "3537b980-9596-4204-967c-28122d03cb0d",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "程序开始时间: 2024-09-26 08:52:23\n",
-      "程序结束时间: 2024-09-26 08:52:28\n",
-      "程序运行时间: 5.01秒\n"
-     ]
-    }
-   ],
-   "source": [
-    "import time  \n",
-    "  \n",
-    "# 获取程序开始时间  \n",
-    "start_time = time.time()  \n",
-    "  \n",
-    "# 这里是你的程序主体  \n",
-    "# 例如,我们可以简单地让程序等待一段时间来模拟一些工作  \n",
-    "time.sleep(5)  # 让程序暂停5秒  \n",
-    "  \n",
-    "# 获取程序结束时间  \n",
-    "end_time = time.time()  \n",
-    "  \n",
-    "# 计算程序运行时间  \n",
-    "elapsed_time = end_time - start_time  \n",
-    "  \n",
-    "# 打印程序开始时间、结束时间和运行时间  \n",
-    "print(f\"程序开始时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))}\")  \n",
-    "print(f\"程序结束时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))}\")  \n",
-    "print(f\"程序运行时间: {elapsed_time:.2f}秒\")"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(timeBegin='2024-05-01', timeEnd='2024-09-20', col_time='C_TIME', user='root', password='mysql_T7yN3E', host='192.168.12.10', port=19306, database='ipfcst_j00260_20240911093804', agc_avc_table='t_power_station_status_data', mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP', mongodb_write_table='J00260NWP_agcavc')\n",
-      "Index(['_id', 'C_TIME', '理论功率', '第1个设备轮毂风速', '实际功率', '实时环境数据', '预测功率',\n",
-      "       'NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向',\n",
-      "       'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向',\n",
-      "       'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向',\n",
-      "       'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向',\n",
-      "       'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射',\n",
-      "       'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'],\n",
-      "      dtype='object')\n",
-      "Collection 'J00260NWP_agcavc already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"processing_limit_power_by_agcavc.py\",\n",
-    "    \"--timeBegin\", \"2024-05-01\",\n",
-    "    \"--timeEnd\", \"2024-09-20\",\n",
-    "    \"--col_time\", \"C_TIME\",\n",
-    "    \"--user\", \"root\",\n",
-    "    \"--password\", \"mysql_T7yN3E\",\n",
-    "    \"--host\", \"192.168.12.10\",\n",
-    "    \"--port\", \"19306\",\n",
-    "    \"--database\", \"ipfcst_j00260_20240911093804\",\n",
-    "    \"--agc_avc_table\",\"t_power_station_status_data\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_agcavc\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 46,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>agc_avc_limit</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "Empty DataFrame\n",
-       "Columns: [C_TIME, agc_avc_limit]\n",
-       "Index: []"
-      ]
-     },
-     "execution_count": 46,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "from sqlalchemy import create_engine\n",
-    "import pandas as pd\n",
-    "engine = create_engine(f\"mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804\")\n",
-    "df = pd.read_sql_query(\"select  C_TIME, 1 as agc_avc_limit from t_power_station_status_data where C_TIME>='2024-05-01 00:00:00' and C_TIME<='2024-09-20 23:59:59' and  (C_IS_RATIONING_BY_AUTO_CONTROL is True or C_IS_RATIONING_BY_MANUAL_CONTROL=1)\",engine)\n",
-    "df['C_TIME'] = pd.to_datetime(df['C_TIME']).dt.strftime('%Y-%m-%d %H:%M:%S')\n",
-    "df"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "8b7a7834-530b-4afa-88f8-b1e51bb7d45b",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_by_agcavc     --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"     --col_time \"C_TIME\"     --user \"root\"     --password \"mysql_T7yN3E\"     --host \"192.168.12.10\"     --port \"19306\"     --database \"ipfcst_j00260_20240911093804\"     --agc_avc_table \"t_power_station_status_data\"     --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP\"     --mongondb_write_table \"J00260NWP_agcavc\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "id": "3e295203-bc38-464e-923c-29149e558c1a",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "'2024-05-01'"
-      ]
-     },
-     "execution_count": 15,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "json_data = {\n",
-    "    \"timeBegin\":\"2024-05-01\",\n",
-    "    \"timeEnd\":\"2024-09-20\",\n",
-    "    \"col_time\":\"C_TIME\",\n",
-    "    \"user\":\"root\",\n",
-    "    \"password\":\"mysql_T7yN3E\",\n",
-    "    \"host\":\"192.168.12.10\",\n",
-    "    \"port\":\"19306\",\n",
-    "    \"database\":\"ipfcst_j00260_20240911093804\",\n",
-    "    \"agc_avc_table\":\"t_power_station_status_data\",\n",
-    "    \"mongodb_connection\":\"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"mongodb_database\":\"algorithm_platform\",\n",
-    "    \"mongodb_read_table\":\"J00260NWP\",\n",
-    "    \"mongodb_write_table\":\"J00260NWP_agcavc\"\n",
-    "}\n",
-    "json_data['timeBegin']"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "cc57105c-df3c-4884-876e-8547bff4c98a",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>temperature10</th>\n",
-       "      <th>temperature190</th>\n",
-       "      <th>direction160</th>\n",
-       "      <th>direction40</th>\n",
-       "      <th>temperature110</th>\n",
-       "      <th>direction80</th>\n",
-       "      <th>speed60</th>\n",
-       "      <th>globalr-1</th>\n",
-       "      <th>mcc</th>\n",
-       "      <th>...</th>\n",
-       "      <th>radiation</th>\n",
-       "      <th>surfacePressure</th>\n",
-       "      <th>tpr</th>\n",
-       "      <th>direction110</th>\n",
-       "      <th>time</th>\n",
-       "      <th>speed160</th>\n",
-       "      <th>temperature80</th>\n",
-       "      <th>reportMid-E395</th>\n",
-       "      <th>reportDq-E1</th>\n",
-       "      <th>reportCdq-16</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>673db4f849572921ef42cba8</td>\n",
-       "      <td>27.7109</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>83.1655</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.4782</td>\n",
-       "      <td>7.1173</td>\n",
-       "      <td>424.13</td>\n",
-       "      <td>21.9464</td>\n",
-       "      <td>...</td>\n",
-       "      <td>817.38</td>\n",
-       "      <td>1011.2582</td>\n",
-       "      <td>3.6418</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>1.715230e+12</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>673db4f849572921ef42cba9</td>\n",
-       "      <td>24.8673</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>156.4900</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>157.9882</td>\n",
-       "      <td>7.2227</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>5.4409</td>\n",
-       "      <td>...</td>\n",
-       "      <td>343.47</td>\n",
-       "      <td>1011.1018</td>\n",
-       "      <td>0.0227</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>1.710492e+12</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2</th>\n",
-       "      <td>673db4f849572921ef42cbaa</td>\n",
-       "      <td>27.8864</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>191.0036</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>192.5145</td>\n",
-       "      <td>5.6836</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.3218</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>1004.3500</td>\n",
-       "      <td>0.3109</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>1.720649e+12</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>3</th>\n",
-       "      <td>673db4f849572921ef42cbab</td>\n",
-       "      <td>26.2082</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>170.0482</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>171.3245</td>\n",
-       "      <td>9.5318</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>0.6045</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>1006.1800</td>\n",
-       "      <td>0.0100</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>1.712316e+12</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4</th>\n",
-       "      <td>673db4f849572921ef42cbac</td>\n",
-       "      <td>29.5800</td>\n",
-       "      <td>28.7800</td>\n",
-       "      <td>53.7400</td>\n",
-       "      <td>54.8200</td>\n",
-       "      <td>29.1400</td>\n",
-       "      <td>54.3100</td>\n",
-       "      <td>2.7700</td>\n",
-       "      <td>477.2</td>\n",
-       "      <td>2.1000</td>\n",
-       "      <td>...</td>\n",
-       "      <td>408.00</td>\n",
-       "      <td>1003.1300</td>\n",
-       "      <td>4.6700</td>\n",
-       "      <td>54.3700</td>\n",
-       "      <td>1.725352e+12</td>\n",
-       "      <td>3.0900</td>\n",
-       "      <td>29.2100</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>29.67</td>\n",
-       "      <td>50.64</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>5 rows × 91 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id  temperature10  temperature190  direction160  \\\n",
-       "0  673db4f849572921ef42cba8        27.7109         27.2327       83.8900   \n",
-       "1  673db4f849572921ef42cba9        24.8673         24.5118      159.0355   \n",
-       "2  673db4f849572921ef42cbaa        27.8864         27.5400      193.5809   \n",
-       "3  673db4f849572921ef42cbab        26.2082         25.8855      172.3518   \n",
-       "4  673db4f849572921ef42cbac        29.5800         28.7800       53.7400   \n",
-       "\n",
-       "   direction40  temperature110  direction80  speed60 globalr-1      mcc  ...  \\\n",
-       "0      83.1655         27.2327      83.4782   7.1173    424.13  21.9464  ...   \n",
-       "1     156.4900         24.5118     157.9882   7.2227       NaN   5.4409  ...   \n",
-       "2     191.0036         27.5400     192.5145   5.6836       0.0   3.3218  ...   \n",
-       "3     170.0482         25.8855     171.3245   9.5318       NaN   0.6045  ...   \n",
-       "4      54.8200         29.1400      54.3100   2.7700     477.2   2.1000  ...   \n",
-       "\n",
-       "  radiation  surfacePressure     tpr  direction110          time  speed160  \\\n",
-       "0    817.38        1011.2582  3.6418       83.8900  1.715230e+12    7.6555   \n",
-       "1    343.47        1011.1018  0.0227      159.0355  1.710492e+12    8.0836   \n",
-       "2      0.00        1004.3500  0.3109      193.5809  1.720649e+12    6.4600   \n",
-       "3      0.00        1006.1800  0.0100      172.3518  1.712316e+12   10.7827   \n",
-       "4    408.00        1003.1300  4.6700       54.3700  1.725352e+12    3.0900   \n",
-       "\n",
-       "   temperature80  reportMid-E395  reportDq-E1  reportCdq-16  \n",
-       "0        27.2327             NaN          NaN           NaN  \n",
-       "1        24.5118             NaN          NaN           NaN  \n",
-       "2        27.5400           -0.99          0.0           NaN  \n",
-       "3        25.8855             NaN          NaN           NaN  \n",
-       "4        29.2100           -0.99        29.67         50.64  \n",
-       "\n",
-       "[5 rows x 91 columns]"
-      ]
-     },
-     "execution_count": 1,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import pymongo\n",
-    "import pandas as pd\n",
-    "\n",
-    "# 连接 MongoDB\n",
-    "client = pymongo.MongoClient(\"mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/\")  # 替换为你的连接信息\n",
-    "db = client['db2']  # 替换为你的数据库名\n",
-    "collection = db['j00629_copy']  # 替换为你的集合名\n",
-    "\n",
-    "# 查询数据\n",
-    "query = {}  # 空字典表示查询所有数据\n",
-    "cursor = collection.find(query)\n",
-    "\n",
-    "# 将数据转换为 DataFrame\n",
-    "df = pd.DataFrame(list(cursor))\n",
-    "\n",
-    "# 如果有 `_id` 字段,可能需要处理为字符串或删除\n",
-    "if '_id' in df.columns:\n",
-    "    df['_id'] = df['_id'].astype(str)  # 将 ObjectId 转为字符串\n",
-    "    # df.drop('_id', axis=1, inplace=True)  # 或者删除 `_id` 字段\n",
-    "client.close()\n",
-    "df.head()# 查看数据\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "7865455a-cbd4-4e55-bf63-b32b3a75a808",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "Index(['_id', 'temperature10', 'temperature190', 'direction160', 'direction40',\n",
-       "       'temperature110', 'direction80', 'speed60', 'globalr-1', 'mcc', 'dq',\n",
-       "       'temperature150', 'speed20', 'speed110', 'direction120', 'speed190',\n",
-       "       'solarZenith', 'temperature90', 'direction200', 'speed150',\n",
-       "       'temperature50', 'direction30', 'temperature160', 'direction170',\n",
-       "       'temperature20', 'direction70', 'direction130', 'temperature200',\n",
-       "       'speed70', 'temperature120', 'speed30', 'speed100', 'speed80',\n",
-       "       'speed180', 'dniCalcd', 'speed140', 'temperature60', 'dateTime',\n",
-       "       'temperature30', 'temperature170', 'direction20', 'humidity2',\n",
-       "       'reportCdq-0', 'direction180', 'realPowerAvg', 'direction60',\n",
-       "       'direction140', 'speed40', 'hcc', 'clearskyGhi', 'temperature130',\n",
-       "       'lcc', 'updater', 'speed90', 'temperature2', 'tcc', 'direction100',\n",
-       "       'speed170', 'temperature70', 'speed130', 'direction190', 'openCapacity',\n",
-       "       'temperature40', 'creator', 'direction10', 'temperature180',\n",
-       "       'direction150', 'direction50', 'speed50', 'updateTime', 'direction90',\n",
-       "       'farmId', 'temperature100', 'speed10', 'temperature140', 'speed120',\n",
-       "       'reportDq-avg', 'deleted', 'speed200', 'realPower', 'createTime',\n",
-       "       'radiation', 'surfacePressure', 'tpr', 'direction110', 'time',\n",
-       "       'speed160', 'temperature80', 'reportMid-E395', 'reportDq-E1',\n",
-       "       'reportCdq-16'],\n",
-       "      dtype='object')"
-      ]
-     },
-     "execution_count": 2,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df.columns"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 6
data_processing/processing_limit_power/processing_limit_power_by_agcavc/requirements.txt

@@ -1,6 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-SQLAlchemy==2.0.30
-PyMySQL==1.1.1
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 607
data_processing/processing_limit_power/processing_limit_power_by_agcavc/test.ipynb

@@ -1,607 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 09:07:30,205 - waitress - INFO - Serving on http://0.0.0.0:10086\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 09:07:33,171 - processing_limit_power_by_agcavc - INFO - {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n",
-      "Index(['_id', 'temperature10', 'temperature190', 'direction160', 'direction40',\n",
-      "       'temperature110', 'direction80', 'speed60', 'globalr-1', 'mcc', 'dq',\n",
-      "       'temperature150', 'speed20', 'speed110', 'direction120', 'speed190',\n",
-      "       'solarZenith', 'temperature90', 'direction200', 'speed150',\n",
-      "       'temperature50', 'direction30', 'temperature160', 'direction170',\n",
-      "       'temperature20', 'direction70', 'direction130', 'temperature200',\n",
-      "       'speed70', 'temperature120', 'speed30', 'speed100', 'speed80',\n",
-      "       'speed180', 'dniCalcd', 'speed140', 'temperature60', 'dateTime',\n",
-      "       'temperature30', 'temperature170', 'direction20', 'humidity2',\n",
-      "       'reportCdq-0', 'direction180', 'realPowerAvg', 'direction60',\n",
-      "       'direction140', 'speed40', 'hcc', 'clearskyGhi', 'temperature130',\n",
-      "       'lcc', 'updater', 'speed90', 'temperature2', 'tcc', 'direction100',\n",
-      "       'speed170', 'temperature70', 'speed130', 'direction190', 'openCapacity',\n",
-      "       'temperature40', 'creator', 'direction10', 'temperature180',\n",
-      "       'direction150', 'direction50', 'speed50', 'updateTime', 'direction90',\n",
-      "       'farmId', 'temperature100', 'speed10', 'temperature140', 'speed120',\n",
-      "       'reportDq-avg', 'deleted', 'speed200', 'realPower', 'createTime',\n",
-      "       'radiation', 'surfacePressure', 'tpr', 'direction110', 'time',\n",
-      "       'speed160', 'temperature80', 'reportMid-E395', 'reportDq-E1',\n",
-      "       'reportCdq-16'],\n",
-      "      dtype='object')\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 09:14:41,418 - processing_limit_power_by_agcavc - INFO - {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00629_20240820091235', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'mysql_connection': 'mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00629_20240820091235', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy', 'mongodb_write_table': 'j00629_copy_agcavc', 'agc_avc_table': 't_power_station_status_data'}\n",
-      "根据限电记录清洗,2024-03-05至2024-09-04,限电时长共计143.62小时\n",
-      "Index(['_id', 'temperature10', 'temperature190', 'direction160', 'direction40',\n",
-      "       'temperature110', 'direction80', 'speed60', 'globalr-1', 'mcc', 'dq',\n",
-      "       'temperature150', 'speed20', 'speed110', 'direction120', 'speed190',\n",
-      "       'solarZenith', 'temperature90', 'direction200', 'speed150',\n",
-      "       'temperature50', 'direction30', 'temperature160', 'direction170',\n",
-      "       'temperature20', 'direction70', 'direction130', 'temperature200',\n",
-      "       'speed70', 'temperature120', 'speed30', 'speed100', 'speed80',\n",
-      "       'speed180', 'dniCalcd', 'speed140', 'temperature60', 'dateTime',\n",
-      "       'temperature30', 'temperature170', 'direction20', 'humidity2',\n",
-      "       'reportCdq-0', 'direction180', 'realPowerAvg', 'direction60',\n",
-      "       'direction140', 'speed40', 'hcc', 'clearskyGhi', 'temperature130',\n",
-      "       'lcc', 'updater', 'speed90', 'temperature2', 'tcc', 'direction100',\n",
-      "       'speed170', 'temperature70', 'speed130', 'direction190', 'openCapacity',\n",
-      "       'temperature40', 'creator', 'direction10', 'temperature180',\n",
-      "       'direction150', 'direction50', 'speed50', 'updateTime', 'direction90',\n",
-      "       'farmId', 'temperature100', 'speed10', 'temperature140', 'speed120',\n",
-      "       'reportDq-avg', 'deleted', 'speed200', 'realPower', 'createTime',\n",
-      "       'radiation', 'surfacePressure', 'tpr', 'direction110', 'time',\n",
-      "       'speed160', 'temperature80', 'reportMid-E395', 'reportDq-E1',\n",
-      "       'reportCdq-16'],\n",
-      "      dtype='object')\n",
-      "Collection 'j00629_copy_agcavc already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    "%run processing_limit_power_by_agcavc.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "3537b980-9596-4204-967c-28122d03cb0d",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "程序开始时间: 2024-09-26 08:52:23\n",
-      "程序结束时间: 2024-09-26 08:52:28\n",
-      "程序运行时间: 5.01秒\n"
-     ]
-    }
-   ],
-   "source": [
-    "import time  \n",
-    "  \n",
-    "# 获取程序开始时间  \n",
-    "start_time = time.time()  \n",
-    "  \n",
-    "# 这里是你的程序主体  \n",
-    "# 例如,我们可以简单地让程序等待一段时间来模拟一些工作  \n",
-    "time.sleep(5)  # 让程序暂停5秒  \n",
-    "  \n",
-    "# 获取程序结束时间  \n",
-    "end_time = time.time()  \n",
-    "  \n",
-    "# 计算程序运行时间  \n",
-    "elapsed_time = end_time - start_time  \n",
-    "  \n",
-    "# 打印程序开始时间、结束时间和运行时间  \n",
-    "print(f\"程序开始时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))}\")  \n",
-    "print(f\"程序结束时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))}\")  \n",
-    "print(f\"程序运行时间: {elapsed_time:.2f}秒\")"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(timeBegin='2024-05-01', timeEnd='2024-09-20', col_time='C_TIME', user='root', password='mysql_T7yN3E', host='192.168.12.10', port=19306, database='ipfcst_j00260_20240911093804', agc_avc_table='t_power_station_status_data', mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP', mongodb_write_table='J00260NWP_agcavc')\n",
-      "Index(['_id', 'C_TIME', '理论功率', '第1个设备轮毂风速', '实际功率', '实时环境数据', '预测功率',\n",
-      "       'NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向',\n",
-      "       'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向',\n",
-      "       'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向',\n",
-      "       'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向',\n",
-      "       'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射',\n",
-      "       'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'],\n",
-      "      dtype='object')\n",
-      "Collection 'J00260NWP_agcavc already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"processing_limit_power_by_agcavc.py\",\n",
-    "    \"--timeBegin\", \"2024-05-01\",\n",
-    "    \"--timeEnd\", \"2024-09-20\",\n",
-    "    \"--col_time\", \"C_TIME\",\n",
-    "    \"--user\", \"root\",\n",
-    "    \"--password\", \"mysql_T7yN3E\",\n",
-    "    \"--host\", \"192.168.12.10\",\n",
-    "    \"--port\", \"19306\",\n",
-    "    \"--database\", \"ipfcst_j00260_20240911093804\",\n",
-    "    \"--agc_avc_table\",\"t_power_station_status_data\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_agcavc\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 46,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>agc_avc_limit</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "Empty DataFrame\n",
-       "Columns: [C_TIME, agc_avc_limit]\n",
-       "Index: []"
-      ]
-     },
-     "execution_count": 46,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "from sqlalchemy import create_engine\n",
-    "import pandas as pd\n",
-    "engine = create_engine(f\"mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804\")\n",
-    "df = pd.read_sql_query(\"select  C_TIME, 1 as agc_avc_limit from t_power_station_status_data where C_TIME>='2024-05-01 00:00:00' and C_TIME<='2024-09-20 23:59:59' and  (C_IS_RATIONING_BY_AUTO_CONTROL is True or C_IS_RATIONING_BY_MANUAL_CONTROL=1)\",engine)\n",
-    "df['C_TIME'] = pd.to_datetime(df['C_TIME']).dt.strftime('%Y-%m-%d %H:%M:%S')\n",
-    "df"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "8b7a7834-530b-4afa-88f8-b1e51bb7d45b",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_by_agcavc     --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"     --col_time \"C_TIME\"     --user \"root\"     --password \"mysql_T7yN3E\"     --host \"192.168.12.10\"     --port \"19306\"     --database \"ipfcst_j00260_20240911093804\"     --agc_avc_table \"t_power_station_status_data\"     --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP\"     --mongondb_write_table \"J00260NWP_agcavc\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "id": "3e295203-bc38-464e-923c-29149e558c1a",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "'2024-05-01'"
-      ]
-     },
-     "execution_count": 15,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "json_data = {\n",
-    "    \"timeBegin\":\"2024-05-01\",\n",
-    "    \"timeEnd\":\"2024-09-20\",\n",
-    "    \"col_time\":\"C_TIME\",\n",
-    "    \"user\":\"root\",\n",
-    "    \"password\":\"mysql_T7yN3E\",\n",
-    "    \"host\":\"192.168.12.10\",\n",
-    "    \"port\":\"19306\",\n",
-    "    \"database\":\"ipfcst_j00260_20240911093804\",\n",
-    "    \"agc_avc_table\":\"t_power_station_status_data\",\n",
-    "    \"mongodb_connection\":\"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"mongodb_database\":\"algorithm_platform\",\n",
-    "    \"mongodb_read_table\":\"J00260NWP\",\n",
-    "    \"mongodb_write_table\":\"J00260NWP_agcavc\"\n",
-    "}\n",
-    "json_data['timeBegin']"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "cc57105c-df3c-4884-876e-8547bff4c98a",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>temperature10</th>\n",
-       "      <th>temperature190</th>\n",
-       "      <th>direction160</th>\n",
-       "      <th>direction40</th>\n",
-       "      <th>temperature110</th>\n",
-       "      <th>direction80</th>\n",
-       "      <th>speed60</th>\n",
-       "      <th>globalr-1</th>\n",
-       "      <th>mcc</th>\n",
-       "      <th>...</th>\n",
-       "      <th>radiation</th>\n",
-       "      <th>surfacePressure</th>\n",
-       "      <th>tpr</th>\n",
-       "      <th>direction110</th>\n",
-       "      <th>time</th>\n",
-       "      <th>speed160</th>\n",
-       "      <th>temperature80</th>\n",
-       "      <th>reportMid-E395</th>\n",
-       "      <th>reportDq-E1</th>\n",
-       "      <th>reportCdq-16</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>673db4f849572921ef42cba8</td>\n",
-       "      <td>27.7109</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>83.1655</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>83.4782</td>\n",
-       "      <td>7.1173</td>\n",
-       "      <td>424.13</td>\n",
-       "      <td>21.9464</td>\n",
-       "      <td>...</td>\n",
-       "      <td>817.38</td>\n",
-       "      <td>1011.2582</td>\n",
-       "      <td>3.6418</td>\n",
-       "      <td>83.8900</td>\n",
-       "      <td>1.715230e+12</td>\n",
-       "      <td>7.6555</td>\n",
-       "      <td>27.2327</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>673db4f849572921ef42cba9</td>\n",
-       "      <td>24.8673</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>156.4900</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>157.9882</td>\n",
-       "      <td>7.2227</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>5.4409</td>\n",
-       "      <td>...</td>\n",
-       "      <td>343.47</td>\n",
-       "      <td>1011.1018</td>\n",
-       "      <td>0.0227</td>\n",
-       "      <td>159.0355</td>\n",
-       "      <td>1.710492e+12</td>\n",
-       "      <td>8.0836</td>\n",
-       "      <td>24.5118</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2</th>\n",
-       "      <td>673db4f849572921ef42cbaa</td>\n",
-       "      <td>27.8864</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>191.0036</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>192.5145</td>\n",
-       "      <td>5.6836</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.3218</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>1004.3500</td>\n",
-       "      <td>0.3109</td>\n",
-       "      <td>193.5809</td>\n",
-       "      <td>1.720649e+12</td>\n",
-       "      <td>6.4600</td>\n",
-       "      <td>27.5400</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>3</th>\n",
-       "      <td>673db4f849572921ef42cbab</td>\n",
-       "      <td>26.2082</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>170.0482</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>171.3245</td>\n",
-       "      <td>9.5318</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>0.6045</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.00</td>\n",
-       "      <td>1006.1800</td>\n",
-       "      <td>0.0100</td>\n",
-       "      <td>172.3518</td>\n",
-       "      <td>1.712316e+12</td>\n",
-       "      <td>10.7827</td>\n",
-       "      <td>25.8855</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "      <td>NaN</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4</th>\n",
-       "      <td>673db4f849572921ef42cbac</td>\n",
-       "      <td>29.5800</td>\n",
-       "      <td>28.7800</td>\n",
-       "      <td>53.7400</td>\n",
-       "      <td>54.8200</td>\n",
-       "      <td>29.1400</td>\n",
-       "      <td>54.3100</td>\n",
-       "      <td>2.7700</td>\n",
-       "      <td>477.2</td>\n",
-       "      <td>2.1000</td>\n",
-       "      <td>...</td>\n",
-       "      <td>408.00</td>\n",
-       "      <td>1003.1300</td>\n",
-       "      <td>4.6700</td>\n",
-       "      <td>54.3700</td>\n",
-       "      <td>1.725352e+12</td>\n",
-       "      <td>3.0900</td>\n",
-       "      <td>29.2100</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>29.67</td>\n",
-       "      <td>50.64</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>5 rows × 91 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id  temperature10  temperature190  direction160  \\\n",
-       "0  673db4f849572921ef42cba8        27.7109         27.2327       83.8900   \n",
-       "1  673db4f849572921ef42cba9        24.8673         24.5118      159.0355   \n",
-       "2  673db4f849572921ef42cbaa        27.8864         27.5400      193.5809   \n",
-       "3  673db4f849572921ef42cbab        26.2082         25.8855      172.3518   \n",
-       "4  673db4f849572921ef42cbac        29.5800         28.7800       53.7400   \n",
-       "\n",
-       "   direction40  temperature110  direction80  speed60 globalr-1      mcc  ...  \\\n",
-       "0      83.1655         27.2327      83.4782   7.1173    424.13  21.9464  ...   \n",
-       "1     156.4900         24.5118     157.9882   7.2227       NaN   5.4409  ...   \n",
-       "2     191.0036         27.5400     192.5145   5.6836       0.0   3.3218  ...   \n",
-       "3     170.0482         25.8855     171.3245   9.5318       NaN   0.6045  ...   \n",
-       "4      54.8200         29.1400      54.3100   2.7700     477.2   2.1000  ...   \n",
-       "\n",
-       "  radiation  surfacePressure     tpr  direction110          time  speed160  \\\n",
-       "0    817.38        1011.2582  3.6418       83.8900  1.715230e+12    7.6555   \n",
-       "1    343.47        1011.1018  0.0227      159.0355  1.710492e+12    8.0836   \n",
-       "2      0.00        1004.3500  0.3109      193.5809  1.720649e+12    6.4600   \n",
-       "3      0.00        1006.1800  0.0100      172.3518  1.712316e+12   10.7827   \n",
-       "4    408.00        1003.1300  4.6700       54.3700  1.725352e+12    3.0900   \n",
-       "\n",
-       "   temperature80  reportMid-E395  reportDq-E1  reportCdq-16  \n",
-       "0        27.2327             NaN          NaN           NaN  \n",
-       "1        24.5118             NaN          NaN           NaN  \n",
-       "2        27.5400           -0.99          0.0           NaN  \n",
-       "3        25.8855             NaN          NaN           NaN  \n",
-       "4        29.2100           -0.99        29.67         50.64  \n",
-       "\n",
-       "[5 rows x 91 columns]"
-      ]
-     },
-     "execution_count": 1,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import pymongo\n",
-    "import pandas as pd\n",
-    "\n",
-    "# 连接 MongoDB\n",
-    "client = pymongo.MongoClient(\"mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/\")  # 替换为你的连接信息\n",
-    "db = client['db2']  # 替换为你的数据库名\n",
-    "collection = db['j00629_copy']  # 替换为你的集合名\n",
-    "\n",
-    "# 查询数据\n",
-    "query = {}  # 空字典表示查询所有数据\n",
-    "cursor = collection.find(query)\n",
-    "\n",
-    "# 将数据转换为 DataFrame\n",
-    "df = pd.DataFrame(list(cursor))\n",
-    "\n",
-    "# 如果有 `_id` 字段,可能需要处理为字符串或删除\n",
-    "if '_id' in df.columns:\n",
-    "    df['_id'] = df['_id'].astype(str)  # 将 ObjectId 转为字符串\n",
-    "    # df.drop('_id', axis=1, inplace=True)  # 或者删除 `_id` 字段\n",
-    "client.close()\n",
-    "df.head()# 查看数据\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "7865455a-cbd4-4e55-bf63-b32b3a75a808",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "Index(['_id', 'temperature10', 'temperature190', 'direction160', 'direction40',\n",
-       "       'temperature110', 'direction80', 'speed60', 'globalr-1', 'mcc', 'dq',\n",
-       "       'temperature150', 'speed20', 'speed110', 'direction120', 'speed190',\n",
-       "       'solarZenith', 'temperature90', 'direction200', 'speed150',\n",
-       "       'temperature50', 'direction30', 'temperature160', 'direction170',\n",
-       "       'temperature20', 'direction70', 'direction130', 'temperature200',\n",
-       "       'speed70', 'temperature120', 'speed30', 'speed100', 'speed80',\n",
-       "       'speed180', 'dniCalcd', 'speed140', 'temperature60', 'dateTime',\n",
-       "       'temperature30', 'temperature170', 'direction20', 'humidity2',\n",
-       "       'reportCdq-0', 'direction180', 'realPowerAvg', 'direction60',\n",
-       "       'direction140', 'speed40', 'hcc', 'clearskyGhi', 'temperature130',\n",
-       "       'lcc', 'updater', 'speed90', 'temperature2', 'tcc', 'direction100',\n",
-       "       'speed170', 'temperature70', 'speed130', 'direction190', 'openCapacity',\n",
-       "       'temperature40', 'creator', 'direction10', 'temperature180',\n",
-       "       'direction150', 'direction50', 'speed50', 'updateTime', 'direction90',\n",
-       "       'farmId', 'temperature100', 'speed10', 'temperature140', 'speed120',\n",
-       "       'reportDq-avg', 'deleted', 'speed200', 'realPower', 'createTime',\n",
-       "       'radiation', 'surfacePressure', 'tpr', 'direction110', 'time',\n",
-       "       'speed160', 'temperature80', 'reportMid-E395', 'reportDq-E1',\n",
-       "       'reportCdq-16'],\n",
-       "      dtype='object')"
-      ]
-     },
-     "execution_count": 2,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df.columns"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 4 - 5
data_processing/processing_limit_power/processing_limit_power_by_machines/processing_limit_power_by_machines.py → data_processing/processing_limit_power/processing_limit_power_by_machines.py

@@ -1,16 +1,15 @@
-import argparse
-import pandas as pd 
+import pandas as pd
 import numpy as np
 from pymongo import MongoClient
 import matplotlib.pyplot as plt
-
-from flask import Flask,request,jsonify
-from waitress import serve
+from flask import Flask, request
 import time
 import logging
 import traceback
 
 app = Flask('processing_limit_power_by_machines——service')
+
+
 def get_data_from_mongo(args):
     mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
     client = MongoClient(mongodb_connection)

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "processing_limit_power_by_machines.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 6
data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/Untitled-checkpoint.ipynb

@@ -1,6 +0,0 @@
-{
- "cells": [],
- "metadata": {},
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 97
data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/processing_limit_power_by_machines-checkpoint.py

@@ -1,97 +0,0 @@
-import argparse
-import pandas as pd 
-import numpy as np
-from pymongo import MongoClient
-import matplotlib.pyplot as plt
-
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import logging
-import traceback
-
-app = Flask('processing_limit_power_by_machines——service')
-def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    collection = db[mongodb_read_table]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
-    client.close()
-    return df
-    
-
-def insert_data_into_mongo(res_df,args):
-    mongodb_connection,mongodb_database,mongodb_write_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_write_table']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    if mongodb_write_table in db.list_collection_names():
-        db[mongodb_write_table].drop()
-        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
-    collection = db[mongodb_write_table]  # 集合名称
-    # 将 DataFrame 转为字典格式
-    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
-    # 插入到 MongoDB
-    collection.insert_many(data_dict)
-    print("data inserted successfully!")
-    
-
-#样板机法
-def windLight_machine_judgment(power,args):
-    col_rp,col_tp = args['col_rp'],args['col_tp']
-    power['diff'] = power[col_tp]-power[col_rp]
-    power['is_limit_machine'] = False
-    diff_mean,diff_std = power['diff'].mean(),power['diff'].std()
-    threshold = diff_mean-1.96*(diff_std/np.sqrt(power.shape[0]))
-    print("threshold",threshold)
-    power.loc[abs(power['diff']) > threshold ,'is_limit_machine'] = True
-    is_limit = power['is_limit_machine']
-    # 可视化结果
-    plt.figure(figsize=(300, 6))
-    plt.plot(power[col_rp], label=col_rp)
-    plt.plot(power[col_tp], label=col_tp)
-    plt.scatter(power.index[is_limit], power[col_rp][is_limit], color='red', label='限电点')
-    plt.legend()
-    plt.title(f' 95%置信水平计算置信区间 ---限电 threshold={threshold}')
-    plt.show()
-    return power[power['is_limit_machine']!=True].drop(['diff','is_limit_machine'],axis=1)
-
-
-@app.route('/processing_limit_power_by_machines', methods=['POST'])
-def processing_limit_power_by_machines():
-    # 获取程序开始时间  
-    start_time = time.time()  
-    result = {}
-    success = 0
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print("*********",args,"*******")
-        power_df = get_data_from_mongo(args)
-        res_df = windLight_machine_judgment(power_df,args)
-        insert_data_into_mongo(res_df,args)
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-   
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    print("Program execution ends!")
-    return result
-    
-
-if __name__=="__main__":
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("processing_limit_power_by_machines log")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10087)
-    print("server start!")

+ 0 - 6
data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,6 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-matplotlib==3.7.5
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 216
data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,216 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import algo_test"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'_id': ObjectId('66ebba82a3b7dbe82538e34a'), 'name': 'Alice', 'age': 25, 'city': 'Beijing'}\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 使用 subprocess 执行 .py 文件\n",
-    "result = subprocess.run(['python', 'algo_test.py'], capture_output=True, text=True)\n",
-    "\n",
-    "# 打印输出\n",
-    "print(result.stdout)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "!pip freeze > requirements.txt"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]\n"
-     ]
-    }
-   ],
-   "source": [
-    "import sys\n",
-    "print(sys.version)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(timeBegin='2024-05-01', timeEnd='2024-09-20', col_time='C_TIME', user='root', password='mysql_T7yN3E', host='192.168.12.10', port=19306, database='ipfcst_j00260_20240911093804', agc_avc_table='t_power_station_status_data', mongondb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongondb_database='algorithm_platform', mongondb_read_table='J00260NWP', mongondb_write_table='J00260NWP_agcavc')\n",
-      "Index(['_id', 'C_TIME', '理论功率', '第1个设备轮毂风速', '实际功率', '实时环境数据', '预测功率',\n",
-      "       'NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向',\n",
-      "       'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向',\n",
-      "       'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向',\n",
-      "       'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向',\n",
-      "       'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射',\n",
-      "       'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'],\n",
-      "      dtype='object')\n",
-      "Collection 'J00260NWP_agcavc already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"processing_limit_power_by_agcavc.py\",\n",
-    "    \"--timeBegin\", \"2024-05-01\",\n",
-    "    \"--timeEnd\", \"2024-09-20\",\n",
-    "    \"--col_time\", \"C_TIME\",\n",
-    "    \"--user\", \"root\",\n",
-    "    \"--password\", \"mysql_T7yN3E\",\n",
-    "    \"--host\", \"192.168.12.10\",\n",
-    "    \"--port\", \"19306\",\n",
-    "    \"--database\", \"ipfcst_j00260_20240911093804\",\n",
-    "    \"--agc_avc_table\",\"t_power_station_status_data\",\n",
-    "    \"--mongondb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongondb_database\", \"algorithm_platform\",\n",
-    "    \"--mongondb_read_table\", \"J00260NWP\",\n",
-    "    \"--mongondb_write_table\", \"J00260NWP_agcavc\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 46,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>agc_avc_limit</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "Empty DataFrame\n",
-       "Columns: [C_TIME, agc_avc_limit]\n",
-       "Index: []"
-      ]
-     },
-     "execution_count": 46,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "from sqlalchemy import create_engine\n",
-    "import pandas as pd\n",
-    "engine = create_engine(f\"mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804\")\n",
-    "df = pd.read_sql_query(\"select  C_TIME, 1 as agc_avc_limit from t_power_station_status_data where C_TIME>='2024-05-01 00:00:00' and C_TIME<='2024-09-20 23:59:59' and  (C_IS_RATIONING_BY_AUTO_CONTROL is True or C_IS_RATIONING_BY_MANUAL_CONTROL=1)\",engine)\n",
-    "df['C_TIME'] = pd.to_datetime(df['C_TIME']).dt.strftime('%Y-%m-%d %H:%M:%S')\n",
-    "df"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "8b7a7834-530b-4afa-88f8-b1e51bb7d45b",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_by_agcavc     --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"     --col_time \"C_TIME\"     --user \"root\"     --password \"mysql_T7yN3E\"     --host \"192.168.12.10\"     --port \"19306\"     --database \"ipfcst_j00260_20240911093804\"     --agc_avc_table \"t_power_station_status_data\"     --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP\"     --mongondb_write_table \"J00260NWP_agcavc\""
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_machines/Dockerfile

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "processing_limit_power_by_machines.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 89
data_processing/processing_limit_power/processing_limit_power_by_machines/Untitled.ipynb

@@ -1,89 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ec2c53de-6bb0-4358-9eb4-e7b7301877df",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "(<bound method Response.json of <Response [200]>>, <Response [200]>)"
-      ]
-     },
-     "execution_count": 11,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import requests\n",
-    "url = 'http://localhost:10087/processing_limit_power_by_machines'\n",
-    "data = {\n",
-    "    'col_rp': '实际功率',\n",
-    "    'col_tp': '理论功率',\n",
-    "    'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017',\n",
-    "    'mongodb_database': 'algorithm_platform',\n",
-    "    'mongodb_read_table': 'J00260NWP_agcavc',\n",
-    "    'mongodb_write_table': 'J00260NWP_machines',\n",
-    "    # 添加其他参数\n",
-    "}\n",
-    "response = requests.post(url, data) \n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "id": "5723d8bf-5711-45c0-a9e6-4649061d7c55",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "{'args': {'col_rp': '实际功率',\n",
-       "  'col_tp': '理论功率',\n",
-       "  'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017',\n",
-       "  'mongodb_database': 'algorithm_platform',\n",
-       "  'mongodb_read_table': 'J00260NWP_agcavc',\n",
-       "  'mongodb_write_table': 'J00260NWP_machines'},\n",
-       " 'end_time': '2024-09-27 11:30:00',\n",
-       " 'start_time': '2024-09-27 11:29:52',\n",
-       " 'success': 1}"
-      ]
-     },
-     "execution_count": 15,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import json  \n",
-    "\n",
-    "parsed_json = json.loads(response.text)\n",
-    "parsed_json"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python 3 (ipykernel)",
-   "language": "python",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.13"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 6
data_processing/processing_limit_power/processing_limit_power_by_machines/requirements.txt

@@ -1,6 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-matplotlib==3.7.5
-Flask==3.0.3
-waitress==3.0.0

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 294
data_processing/processing_limit_power/processing_limit_power_by_machines/test.ipynb


+ 6 - 6
data_processing/processing_limit_power/processing_limit_power_by_records/processing_limit_power_by_records.py → data_processing/processing_limit_power/processing_limit_power_by_records.py

@@ -1,14 +1,13 @@
-import argparse
-import pandas as pd 
+import pandas as pd
 from pymongo import MongoClient
 import requests
-from flask import Flask,request,jsonify
-from waitress import serve
+from flask import Flask,request
 import time
 import logging
 import traceback
 app = Flask('processing_limit_power_by_records——service')
 
+
 def get_data_from_mongo(args):
     mongodb_connection,mongodb_database,mongodb_read_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table']
     client = MongoClient(mongodb_connection)
@@ -37,7 +36,6 @@ def insert_data_into_mongo(res_df,args):
     print("data inserted successfully!")
     
 
-
 def limit_record_judgement(power,args):
     timeBegin,timeEnd,station_code,col_time = args['timeBegin'], args['timeEnd'], args['station_code'], args['col_time']
     url = f'http://itil.jiayuepowertech.com:9958/itil/api/power-limitation?timeBegin={timeBegin}&timeEnd={timeEnd}'
@@ -57,6 +55,7 @@ def limit_record_judgement(power,args):
     print(f"根据限电记录清洗,{timeBegin}至{timeEnd},限电时长共计{round(len(clean_record)/60,2)}小时")
     return power[~power[col_time].isin(clean_record)]
 
+
 @app.route('/processing_limit_power_by_records', methods=['POST'])
 def processing_limit_power_by_records():
     # 获取程序开始时间  
@@ -84,7 +83,8 @@ def processing_limit_power_by_records():
     result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
     print("Program execution ends!")
     return result
-    
+
+
 if __name__=="__main__":
     print("Program starts execution!")
     logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "processing_limit_power_by_records.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 94
data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/processing_limit_power_by_records-checkpoint.py

@@ -1,94 +0,0 @@
-import argparse
-import pandas as pd 
-from pymongo import MongoClient
-import requests
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import logging
-import traceback
-app = Flask('processing_limit_power_by_records——service')
-
-def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    collection = db[mongodb_read_table]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
-    client.close()
-    return df
-    
-
-def insert_data_into_mongo(res_df,args):
-    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    if mongodb_write_table in db.list_collection_names():
-        db[mongodb_write_table].drop()
-        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
-    collection = db[mongodb_write_table]  # 集合名称
-    # 将 DataFrame 转为字典格式
-    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
-    # 插入到 MongoDB
-    collection.insert_many(data_dict)
-    print("data inserted successfully!")
-    
-
-
-def limit_record_judgement(power,args):
-    timeBegin,timeEnd,station_code,col_time = args['timeBegin'], args['timeEnd'], args['station_code'], args['col_time']
-    url = f'http://itil.jiayuepowertech.com:9958/itil/api/power-limitation?timeBegin={timeBegin}&timeEnd={timeEnd}'
-    try:
-        res = requests.get(url).json()
-    except requests.RequestException as e:
-        print(f"请求失败: {e}")
-        return []
-    ele_info = [item for item in res.get('data', []) if item['stationCode'] == station_code]
-    initial_count = len(power)
-    clean_record = []
-    for ele in ele_info:
-        begin,end = ele['timeBegin'], ele['timeEnd']
-        ele_limits = pd.date_range(start=begin, end=end, freq='min').strftime("%Y-%m-%d %H:%M:%S").tolist()
-        if len(ele_limits) > 0:
-            clean_record = clean_record + ele_limits
-    print(f"根据限电记录清洗,{timeBegin}至{timeEnd},限电时长共计{round(len(clean_record)/60,2)}小时")
-    return power[~power[col_time].isin(clean_record)]
-
-@app.route('/processing_limit_power_by_records', methods=['POST'])
-def processing_limit_power_by_records():
-    # 获取程序开始时间  
-    start_time = time.time()  
-    result = {}
-    success = 0
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print('args',args)
-        logger.info(args)
-        power_df = get_data_from_mongo(args)
-        res_df = limit_record_judgement(power_df,args)
-        insert_data_into_mongo(res_df,args)
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-   
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    print("Program execution ends!")
-    return result
-    
-if __name__=="__main__":
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("processing_limit_power_by_records log")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10088)
-    print("server start!")

+ 0 - 5
data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,5 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-requests==2.32.3
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 295
data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,295 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(timeBegin='2024-05-01', timeEnd='2024-09-20', station_code='J00260', col_time='C_TIME', mongondb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongondb_database='algorithm_platform', mongondb_read_table='J00260NWP_machines', mongondb_write_table='J00260NWP_records')\n",
-      "根据限电记录清洗,2024-05-01至2024-09-20,限电时长共计0.0小时\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"processing_limit_power_by_records.py\",\n",
-    "    \"--timeBegin\", \"2024-05-01\",\n",
-    "    \"--timeEnd\", \"2024-09-20\",\n",
-    "    \"--station_code\", \"J00260\",\n",
-    "    \"--col_time\", \"C_TIME\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_machines\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_records\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "49a380e4-db57-4596-ae39-55ed62d92f64",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    " "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "ba8d36c7-cae7-427b-9980-ad8dadc442b2",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-低云量</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>66ecc86f1075358d129a1d56</td>\n",
-       "      <td>2024-05-02 22:30:00</td>\n",
-       "      <td>130.05</td>\n",
-       "      <td>9.63</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.52</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6477</td>\n",
-       "      <td>202.7945</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0173</td>\n",
-       "      <td>20.2918</td>\n",
-       "      <td>20.3927</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>14.0818</td>\n",
-       "      <td>23.4918</td>\n",
-       "      <td>892.3327</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>66ecc86f1075358d129a1d57</td>\n",
-       "      <td>2024-05-02 22:45:00</td>\n",
-       "      <td>130.51</td>\n",
-       "      <td>9.72</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.24</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.9228</td>\n",
-       "      <td>202.6482</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0191</td>\n",
-       "      <td>20.3009</td>\n",
-       "      <td>20.3864</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>13.8264</td>\n",
-       "      <td>24.0436</td>\n",
-       "      <td>892.3809</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>2 rows × 34 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  130.05       9.63  104.76   \n",
-       "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  130.51       9.72  104.76   \n",
-       "\n",
-       "   实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-低云量  NWP-中云量  \\\n",
-       "0   -0.99  92.52       0.0       3.6477     202.7945  ...      0.0   0.0173   \n",
-       "1   -0.99  93.24       0.0       3.9228     202.6482  ...      0.0   0.0191   \n",
-       "\n",
-       "   NWP-高云量  NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度  \\\n",
-       "0  20.2918  20.3927        0.0        0.0        0.0  14.0818  23.4918   \n",
-       "1  20.3009  20.3864        0.0        0.0        0.0  13.8264  24.0436   \n",
-       "\n",
-       "     NWP-气压  \n",
-       "0  892.3327  \n",
-       "1  892.3809  \n",
-       "\n",
-       "[2 rows x 34 columns]"
-      ]
-     },
-     "execution_count": 3,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "from pymongo import MongoClient\n",
-    "import pandas as pd\n",
-    "client = MongoClient(\"mongodb://root:Jydl3377@192.168.1.33:27017\")\n",
-    "# 选择数据库(如果数据库不存在,MongoDB 会自动创建)\n",
-    "db = client[\"algorithm_platform\"]\n",
-    "collection = db['J00260NWP_records']\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df_from_db = pd.DataFrame(list(data_from_db))\n",
-    "client.close()\n",
-    "# 打印读取到的数据\n",
-    "df_from_db.head(2)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 4,
-   "id": "0bb0ca05-9437-4001-b4a3-0f2462688eee",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "(9713, 34)"
-      ]
-     },
-     "execution_count": 4,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df_from_db.shape"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "03343b25-0d46-4353-8ae5-4a2278513473",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_power_by_records   --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"   --station_code \"J00260\"     --col_time \"C_TIME\"    --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP_machines\"     --mongondb_write_table \"J00260NWP_records\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 7,
-   "id": "ab08e3db-a4dc-464c-a461-2797544b453f",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import optuna.integration.lightgbm as lgb_tuner  # 修正导入语句\n",
-    "# from optuna.integration import LightGBMTunerCV  # 正确的导入方式\n",
-    "from sklearn.datasets import load_diabetes  # 使用糖尿病数据集\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "823ec3b1-00db-4bcd-b7ca-c0ba60196d7e",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "f1607a99-475e-47a7-9f3d-3be98efa413c",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "41f23573-05d7-4686-843b-0b3c3f7678e0",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_records/Dockerfile

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "processing_limit_power_by_records.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 5
data_processing/processing_limit_power/processing_limit_power_by_records/requirements.txt

@@ -1,5 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-requests==2.32.3
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 339
data_processing/processing_limit_power/processing_limit_power_by_records/test.ipynb

@@ -1,339 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(timeBegin='2024-05-01', timeEnd='2024-09-20', station_code='J00260', col_time='C_TIME', mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP_machines', mongodb_write_table='J00260NWP_records')\n",
-      "根据限电记录清洗,2024-05-01至2024-09-20,限电时长共计0.0小时\n",
-      "Collection 'J00260NWP_records already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"processing_limit_power_by_records.py\",\n",
-    "    \"--timeBegin\", \"2024-05-01\",\n",
-    "    \"--timeEnd\", \"2024-09-20\",\n",
-    "    \"--station_code\", \"J00260\",\n",
-    "    \"--col_time\", \"C_TIME\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_machines\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_records\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "d409818f-c17f-4a80-9d5e-0def3503ae81",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_power_by_records   --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"   --station_code \"J00260\"     --col_time \"C_TIME\"    --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP_machines\"     --mongondb_write_table \"J00260NWP_records\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "49a380e4-db57-4596-ae39-55ed62d92f64",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 10:48:21,957 - waitress - INFO - Serving on http://0.0.0.0:10088\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 10:48:26,530 - processing_limit_power_by_records log - INFO - {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'station_code': 'J00629', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_agcavc', 'mongodb_write_table': 'j00629_copy_records'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'timeBegin': '2024-03-05', 'timeEnd': '2024-09-04', 'col_time': 'dateTime', 'station_code': 'J00629', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_agcavc', 'mongodb_write_table': 'j00629_copy_records'}\n",
-      "根据限电记录清洗,2024-03-05至2024-09-04,限电时长共计0.0小时\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    " %run processing_limit_power_by_records.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "ba8d36c7-cae7-427b-9980-ad8dadc442b2",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-低云量</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>66ecc86f1075358d129a1d56</td>\n",
-       "      <td>2024-05-02 22:30:00</td>\n",
-       "      <td>130.05</td>\n",
-       "      <td>9.63</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.52</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6477</td>\n",
-       "      <td>202.7945</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0173</td>\n",
-       "      <td>20.2918</td>\n",
-       "      <td>20.3927</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>14.0818</td>\n",
-       "      <td>23.4918</td>\n",
-       "      <td>892.3327</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>66ecc86f1075358d129a1d57</td>\n",
-       "      <td>2024-05-02 22:45:00</td>\n",
-       "      <td>130.51</td>\n",
-       "      <td>9.72</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.24</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.9228</td>\n",
-       "      <td>202.6482</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0191</td>\n",
-       "      <td>20.3009</td>\n",
-       "      <td>20.3864</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>13.8264</td>\n",
-       "      <td>24.0436</td>\n",
-       "      <td>892.3809</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>2 rows × 34 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  130.05       9.63  104.76   \n",
-       "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  130.51       9.72  104.76   \n",
-       "\n",
-       "   实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-低云量  NWP-中云量  \\\n",
-       "0   -0.99  92.52       0.0       3.6477     202.7945  ...      0.0   0.0173   \n",
-       "1   -0.99  93.24       0.0       3.9228     202.6482  ...      0.0   0.0191   \n",
-       "\n",
-       "   NWP-高云量  NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度  \\\n",
-       "0  20.2918  20.3927        0.0        0.0        0.0  14.0818  23.4918   \n",
-       "1  20.3009  20.3864        0.0        0.0        0.0  13.8264  24.0436   \n",
-       "\n",
-       "     NWP-气压  \n",
-       "0  892.3327  \n",
-       "1  892.3809  \n",
-       "\n",
-       "[2 rows x 34 columns]"
-      ]
-     },
-     "execution_count": 3,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "from pymongo import MongoClient\n",
-    "import pandas as pd\n",
-    "client = MongoClient(\"mongodb://root:Jydl3377@192.168.1.33:27017\")\n",
-    "# 选择数据库(如果数据库不存在,MongoDB 会自动创建)\n",
-    "db = client[\"algorithm_platform\"]\n",
-    "collection = db['J00260NWP_records']\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df_from_db = pd.DataFrame(list(data_from_db))\n",
-    "client.close()\n",
-    "# 打印读取到的数据\n",
-    "df_from_db.head(2)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 4,
-   "id": "0bb0ca05-9437-4001-b4a3-0f2462688eee",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "(9713, 34)"
-      ]
-     },
-     "execution_count": 4,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df_from_db.shape"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "03343b25-0d46-4353-8ae5-4a2278513473",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_power_by_records   --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"   --station_code \"J00260\"     --col_time \"C_TIME\"    --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP_machines\"     --mongondb_write_table \"J00260NWP_records\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 7,
-   "id": "ab08e3db-a4dc-464c-a461-2797544b453f",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import optuna.integration.lightgbm as lgb_tuner  # 修正导入语句\n",
-    "# from optuna.integration import LightGBMTunerCV  # 正确的导入方式\n",
-    "from sklearn.datasets import load_diabetes  # 使用糖尿病数据集\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "823ec3b1-00db-4bcd-b7ca-c0ba60196d7e",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "f1607a99-475e-47a7-9f3d-3be98efa413c",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "41f23573-05d7-4686-843b-0b3c3f7678e0",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "processing_limit_power_by_statistics_light.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 135
data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/processing_limit_power_by_statistics_light-checkpoint.py

@@ -1,135 +0,0 @@
-import argparse
-import pandas as pd 
-from pymongo import MongoClient
-from sqlalchemy import create_engine
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import logging
-import traceback
-from sklearn.linear_model import LinearRegression
-import numpy as np
-from bson.decimal128 import Decimal128
-
-app = Flask('processing_limit_power_by_statistics_light——service')
-
-@app.route('/hello', methods=['GET'])
-def hello():
-    return jsonify(message='Hello, World!')
-
-
-def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    collection = db[mongodb_read_table]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
-    client.close()
-    return df
-
-def insert_data_into_mongo(res_df,args):
-    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    if mongodb_write_table in db.list_collection_names():
-        db[mongodb_write_table].drop()
-        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
-    collection = db[mongodb_write_table]  # 集合名称
-    # 将 DataFrame 转为字典格式
-    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
-    # 插入到 MongoDB
-    collection.insert_many(data_dict)
-    print("data inserted successfully!")
-
-
-
-
-def light_statistics_judgement(df_power,args):
-    """
-    原理:基于实测辐照度与实际功率相关性强正相关,呈严格线性关系为假设前提,
-      假设误差大致呈现标准正态分布 mean + N*std   
-    """
-
-    col_radiance, col_power, sigma=args['col_radiance'],args['col_power'],float(args['sigma'])
-    origin_records = df_power.shape[0]
-    # 提取辐射度和实际功率
-    df_power[col_radiance] = df_power[col_radiance].apply(lambda x: float(x.to_decimal()) if isinstance(x, Decimal128) else np.nan)
-    df_power[col_power] = df_power[col_power].apply(lambda x: float(x.to_decimal()) if isinstance(x, Decimal128) else np.nan)
-    df_power = df_power[(~pd.isna(df_power[col_radiance]))&(~pd.isna(df_power[col_power]))&(~((df_power[col_radiance]<=0)&(df_power[col_power]>0)))] 
-    
-    X = df_power[[col_radiance]].values
-    y = df_power[col_power].values
-    print(X)
-    # 创建线性回归模型并拟合
-    model = LinearRegression()
-    model.fit(X, y)
-    
-    # 获取斜率和偏移量
-    k_final = model.coef_[0]
-    b = model.intercept_
-
-    # 计算预测的实际功率范围
-    predicted_power = model.predict(X)
-    margin = np.mean(abs(y - predicted_power))+ sigma * np.std(abs(y - predicted_power))
-    print("margin:",margin)
-    # 过滤数据
-    def filter_unlimited_power(zfs, real_power):
-        high = min(k_final * zfs + b + margin, 100)
-        low = max(k_final * zfs + b - margin, 0)
-        return low <= real_power <= high
-    
-    # 应用过滤并标记数据
-    df_power['c'] = df_power.apply(lambda row: 'green' if filter_unlimited_power(row[col_radiance], row[col_power]) else 'red', axis=1)
-    df_power['is_limit'] = df_power['c'].apply(lambda x: False if x=='green' else True)
-    # df_power.plot.scatter(x=col_radiance, y=col_power, c='c')
-    #过滤掉限电点
-    new_df_power = df_power[df_power['is_limit'] == False]    
-    print(f"未清洗限电前,总共有:{origin_records}条数据")
-    print(f"清除异常点后保留的点有:{len(new_df_power)}, 占比:{round(len(new_df_power) / origin_records, 2)}")
-    return df_power[df_power['is_limit'] == False].drop(['is_limit','c'],axis=1)
-
-
-@app.route('/processing_limit_power_by_statistics_light', methods=['POST','GET'])
-def processing_limit_power_by_statistics_light():
-    # 获取程序开始时间  
-    start_time = time.time()  
-    result = {}
-    success = 0
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print('args',args)
-        logger.info(args)
-        power_df = get_data_from_mongo(args)
-        res_df = light_statistics_judgement(power_df,args)
-        insert_data_into_mongo(res_df,args)
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-   
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    print("Program execution ends!")
-    return result
-
-
-
-    
-if __name__=="__main__":
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("统计法清洗光伏场站限电")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10085)
-    print("server start!")
-    
-   
-    

+ 0 - 8
data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,8 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-SQLAlchemy==2.0.30
-PyMySQL==1.1.1
-Flask==3.0.3
-waitress==3.0.0
-numpy== 1.26.4
-scikit-learn== 1.4.2

+ 0 - 298
data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,298 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 11:00:17,560 - waitress - INFO - Serving on http://0.0.0.0:10086\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 11:00:24,004 - new_leads_classification - INFO - {'timeBegin': '2024-05-01', 'timeEnd': '2024-09-20', 'col_time': 'C_TIME', 'user': 'root', 'password': 'mysql_T7yN3E', 'host': '192.168.12.10', 'port': '19306', 'database': 'ipfcst_j00260_20240911093804', 'agc_avc_table': 't_power_station_status_data', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP', 'mongodb_write_table': 'J00260NWP_agcavc'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'timeBegin': '2024-05-01', 'timeEnd': '2024-09-20', 'col_time': 'C_TIME', 'user': 'root', 'password': 'mysql_T7yN3E', 'host': '192.168.12.10', 'port': '19306', 'database': 'ipfcst_j00260_20240911093804', 'agc_avc_table': 't_power_station_status_data', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP', 'mongodb_write_table': 'J00260NWP_agcavc'}\n",
-      "Index(['_id', 'C_TIME', '理论功率', '第1个设备轮毂风速', '实际功率', '实时环境数据', '预测功率',\n",
-      "       'NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向',\n",
-      "       'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向',\n",
-      "       'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向',\n",
-      "       'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向',\n",
-      "       'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射',\n",
-      "       'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'],\n",
-      "      dtype='object')\n",
-      "Collection 'J00260NWP_agcavc already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    "%run processing_limit_power_by_agcavc.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "3537b980-9596-4204-967c-28122d03cb0d",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "程序开始时间: 2024-09-26 08:52:23\n",
-      "程序结束时间: 2024-09-26 08:52:28\n",
-      "程序运行时间: 5.01秒\n"
-     ]
-    }
-   ],
-   "source": [
-    "import time  \n",
-    "  \n",
-    "# 获取程序开始时间  \n",
-    "start_time = time.time()  \n",
-    "  \n",
-    "# 这里是你的程序主体  \n",
-    "# 例如,我们可以简单地让程序等待一段时间来模拟一些工作  \n",
-    "time.sleep(5)  # 让程序暂停5秒  \n",
-    "  \n",
-    "# 获取程序结束时间  \n",
-    "end_time = time.time()  \n",
-    "  \n",
-    "# 计算程序运行时间  \n",
-    "elapsed_time = end_time - start_time  \n",
-    "  \n",
-    "# 打印程序开始时间、结束时间和运行时间  \n",
-    "print(f\"程序开始时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))}\")  \n",
-    "print(f\"程序结束时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))}\")  \n",
-    "print(f\"程序运行时间: {elapsed_time:.2f}秒\")"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(timeBegin='2024-05-01', timeEnd='2024-09-20', col_time='C_TIME', user='root', password='mysql_T7yN3E', host='192.168.12.10', port=19306, database='ipfcst_j00260_20240911093804', agc_avc_table='t_power_station_status_data', mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP', mongodb_write_table='J00260NWP_agcavc')\n",
-      "Index(['_id', 'C_TIME', '理论功率', '第1个设备轮毂风速', '实际功率', '实时环境数据', '预测功率',\n",
-      "       'NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向',\n",
-      "       'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向',\n",
-      "       'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向',\n",
-      "       'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向',\n",
-      "       'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射',\n",
-      "       'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'],\n",
-      "      dtype='object')\n",
-      "Collection 'J00260NWP_agcavc already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"processing_limit_power_by_agcavc.py\",\n",
-    "    \"--timeBegin\", \"2024-05-01\",\n",
-    "    \"--timeEnd\", \"2024-09-20\",\n",
-    "    \"--col_time\", \"C_TIME\",\n",
-    "    \"--user\", \"root\",\n",
-    "    \"--password\", \"mysql_T7yN3E\",\n",
-    "    \"--host\", \"192.168.12.10\",\n",
-    "    \"--port\", \"19306\",\n",
-    "    \"--database\", \"ipfcst_j00260_20240911093804\",\n",
-    "    \"--agc_avc_table\",\"t_power_station_status_data\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_agcavc\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 46,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>agc_avc_limit</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "Empty DataFrame\n",
-       "Columns: [C_TIME, agc_avc_limit]\n",
-       "Index: []"
-      ]
-     },
-     "execution_count": 46,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "from sqlalchemy import create_engine\n",
-    "import pandas as pd\n",
-    "engine = create_engine(f\"mysql+pymysql://root:mysql_T7yN3E@192.168.12.10:19306/ipfcst_j00260_20240911093804\")\n",
-    "df = pd.read_sql_query(\"select  C_TIME, 1 as agc_avc_limit from t_power_station_status_data where C_TIME>='2024-05-01 00:00:00' and C_TIME<='2024-09-20 23:59:59' and  (C_IS_RATIONING_BY_AUTO_CONTROL is True or C_IS_RATIONING_BY_MANUAL_CONTROL=1)\",engine)\n",
-    "df['C_TIME'] = pd.to_datetime(df['C_TIME']).dt.strftime('%Y-%m-%d %H:%M:%S')\n",
-    "df"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "8b7a7834-530b-4afa-88f8-b1e51bb7d45b",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_by_agcavc     --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"     --col_time \"C_TIME\"     --user \"root\"     --password \"mysql_T7yN3E\"     --host \"192.168.12.10\"     --port \"19306\"     --database \"ipfcst_j00260_20240911093804\"     --agc_avc_table \"t_power_station_status_data\"     --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP\"     --mongondb_write_table \"J00260NWP_agcavc\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "id": "3e295203-bc38-464e-923c-29149e558c1a",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "'2024-05-01'"
-      ]
-     },
-     "execution_count": 15,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "json_data = {\n",
-    "    \"timeBegin\":\"2024-05-01\",\n",
-    "    \"timeEnd\":\"2024-09-20\",\n",
-    "    \"col_time\":\"C_TIME\",\n",
-    "    \"user\":\"root\",\n",
-    "    \"password\":\"mysql_T7yN3E\",\n",
-    "    \"host\":\"192.168.12.10\",\n",
-    "    \"port\":\"19306\",\n",
-    "    \"database\":\"ipfcst_j00260_20240911093804\",\n",
-    "    \"agc_avc_table\":\"t_power_station_status_data\",\n",
-    "    \"mongodb_connection\":\"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"mongodb_database\":\"algorithm_platform\",\n",
-    "    \"mongodb_read_table\":\"J00260NWP\",\n",
-    "    \"mongodb_write_table\":\"J00260NWP_agcavc\"\n",
-    "}\n",
-    "json_data['timeBegin']"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 20,
-   "id": "cc57105c-df3c-4884-876e-8547bff4c98a",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "71"
-      ]
-     },
-     "execution_count": 20,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "16+15+17+23"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_statistics/Dockerfile

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "processing_limit_power_by_statistics_light.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 8
data_processing/processing_limit_power/processing_limit_power_by_statistics/requirements.txt

@@ -1,8 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-SQLAlchemy==2.0.30
-PyMySQL==1.1.1
-Flask==3.0.3
-waitress==3.0.0
-numpy== 1.26.4
-scikit-learn== 1.4.2

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 598
data_processing/processing_limit_power/processing_limit_power_by_statistics/test.ipynb


+ 4 - 8
data_processing/processing_limit_power/processing_limit_power_by_statistics/processing_limit_power_by_statistics_light.py → data_processing/processing_limit_power/processing_limit_power_by_statistics_light.py

@@ -1,9 +1,6 @@
-import argparse
-import pandas as pd 
+import pandas as pd
 from pymongo import MongoClient
-from sqlalchemy import create_engine
 from flask import Flask,request,jsonify
-from waitress import serve
 import time
 import logging
 import traceback
@@ -13,6 +10,7 @@ from bson.decimal128 import Decimal128
 
 app = Flask('processing_limit_power_by_statistics_light——service')
 
+
 @app.route('/hello', methods=['GET'])
 def hello():
     return jsonify(message='Hello, World!')
@@ -30,6 +28,7 @@ def get_data_from_mongo(args):
     client.close()
     return df
 
+
 def insert_data_into_mongo(res_df,args):
     mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
     client = MongoClient(mongodb_connection)
@@ -45,8 +44,6 @@ def insert_data_into_mongo(res_df,args):
     print("data inserted successfully!")
 
 
-
-
 def light_statistics_judgement(df_power,args):
     """
     原理:基于实测辐照度与实际功率相关性强正相关,呈严格线性关系为假设前提,
@@ -76,6 +73,7 @@ def light_statistics_judgement(df_power,args):
     margin = np.mean(abs(y - predicted_power))+ sigma * np.std(abs(y - predicted_power))
     print("margin:",margin)
     # 过滤数据
+
     def filter_unlimited_power(zfs, real_power):
         high = min(k_final * zfs + b + margin, 100)
         low = max(k_final * zfs + b - margin, 0)
@@ -120,8 +118,6 @@ def processing_limit_power_by_statistics_light():
     print("Program execution ends!")
     return result
 
-
-
     
 if __name__=="__main__":
     print("Program starts execution!")

+ 7 - 0
data_processing/processing_limit_power/test.py

@@ -0,0 +1,7 @@
+import sys
+from pymongo import MongoClient
+
+if __name__=="__main__":
+
+
+    print(sys.executable)

+ 0 - 0
docker_bulid/.ipynb_checkpoints/__init__-checkpoint.py


+ 0 - 0
docker_bulid/.ipynb_checkpoints/main-checkpoint.py


+ 0 - 5
docker_bulid/.ipynb_checkpoints/method_a-checkpoint.py

@@ -1,5 +0,0 @@
-import pandas as pd 
-import numpy as np
-
-def method_a():
-    print("method_a print hello world!")

+ 0 - 5
docker_bulid/.ipynb_checkpoints/method_b-checkpoint.py

@@ -1,5 +0,0 @@
-import pandas as pd 
-import numpy as np
-
-def method_b():
-    print("method_b print hello world!")

+ 0 - 47
docker_bulid/J00260/.ipynb_checkpoints/docker-compose-checkpoint.yml

@@ -1,47 +0,0 @@
-version: '3.8'
-services:
-  processing_limit_power_by_agcavc:
-    build:
-      context: ././data_processing/processing_limit_power/processing_limit_power_by_agcavc
-    command: >
-      --timeBegin=${timeBegin}
-      --timeEnd=${timeEnd}
-      --col_time=${col_time}
-      --user=${user}
-      --password=${password}
-      --host=${host}
-      --port=${port}
-      --database="ipfcst_j00260_20240911093804"
-      --agc_avc_table=${agc_avc_table}
-      --mongodb_connection=${mongodb_connection}
-      --mongodb_database=${mongodb_database}
-      --mongodb_read_table="J00260NWP"
-      --mongodb_write_table="J00260NWP_agcavc"
-
-  processing_limit_power_by_machines:
-    build:
-      context: ././data_processing/processing_limit_power/processing_limit_power_by_machines
-    command: >
-      --col_rp=${col_rp} 
-      --col_tp=${col_tp}
-      --mongodb_connection=${mongodb_connection}   
-      --mongodb_database=${mongodb_database}    
-      --mongodb_read_table="J00260NWP_agcavc"     
-      --mongodb_write_table="J00260NWP_machines"
-    depends_on:
-      - processing_limit_power_by_agcavc
-      
-  processing_limit_power_by_records:
-    build:
-      context: ././data_processing/processing_limit_power/processing_limit_power_by_records
-    command: >
-      --timeBegin=${timeBegin}    
-      --timeEnd=${timeEnd}  
-      --station_code="J00260"     
-      --col_time=${col_time}    
-      --mongodb_connection=${mongodb_connection}    
-      --mongodb_database=${mongodb_database} 
-      --mongodb_read_table="J00260NWP_machines"     
-      --mongodb_write_table="J00260NWP_records"
-    depends_on:
-      - processing_limit_power_by_machines

+ 0 - 12
docker_bulid/J00260/.ipynb_checkpoints/public-checkpoint.env

@@ -1,12 +0,0 @@
-user="root"
-password="mysql_T7yN3E"
-host="192.168.12.10"
-port="19306"
-agc_avc_table="t_power_station_status_data"
-mongodb_connection="mongodb://root:Jydl3377@192.168.1.33:27017"
-mongodb_database="algorithm_platform"
-timeBegin="2024-05-01"
-timeEnd="2024-09-20" 
-col_time="C_TIME"
-col_rp="实际功率" 
-col_tp="理论功率"

+ 0 - 47
docker_bulid/J00260/docker-compose.yml

@@ -1,47 +0,0 @@
-version: '3.8'
-services:
-  processing_limit_power_by_agcavc:
-    build:
-      context: ././data_processing/processing_limit_power/processing_limit_power_by_agcavc
-    command: >
-      --timeBegin=${timeBegin}
-      --timeEnd=${timeEnd}
-      --col_time=${col_time}
-      --user=${user}
-      --password=${password}
-      --host=${host}
-      --port=${port}
-      --database="ipfcst_j00260_20240911093804"
-      --agc_avc_table=${agc_avc_table}
-      --mongodb_connection=${mongodb_connection}
-      --mongodb_database=${mongodb_database}
-      --mongodb_read_table="J00260NWP"
-      --mongodb_write_table="J00260NWP_agcavc"
-
-  processing_limit_power_by_machines:
-    build:
-      context: ././data_processing/processing_limit_power/processing_limit_power_by_machines
-    command: >
-      --col_rp=${col_rp} 
-      --col_tp=${col_tp}
-      --mongodb_connection=${mongodb_connection}   
-      --mongodb_database=${mongodb_database}    
-      --mongodb_read_table="J00260NWP_agcavc"     
-      --mongodb_write_table="J00260NWP_machines"
-    depends_on:
-      - processing_limit_power_by_agcavc
-      
-  processing_limit_power_by_records:
-    build:
-      context: ././data_processing/processing_limit_power/processing_limit_power_by_records
-    command: >
-      --timeBegin=${timeBegin}    
-      --timeEnd=${timeEnd}  
-      --station_code="J00260"     
-      --col_time=${col_time}    
-      --mongodb_connection=${mongodb_connection}    
-      --mongodb_database=${mongodb_database} 
-      --mongodb_read_table="J00260NWP_machines"     
-      --mongodb_write_table="J00260NWP_records"
-    depends_on:
-      - processing_limit_power_by_machines

+ 0 - 12
docker_bulid/J00260/public.env

@@ -1,12 +0,0 @@
-user="root"
-password="mysql_T7yN3E"
-host="192.168.12.10"
-port="19306"
-agc_avc_table="t_power_station_status_data"
-mongodb_connection="mongodb://root:Jydl3377@192.168.1.33:27017"
-mongodb_database="algorithm_platform"
-timeBegin="2024-05-01"
-timeEnd="2024-09-20" 
-col_time="C_TIME"
-col_rp="实际功率" 
-col_tp="理论功率"

+ 0 - 0
docker_bulid/__init__.py


+ 0 - 4
docker_bulid/main.py

@@ -1,4 +0,0 @@
-import os
-
-# 获取当前工作目录
-current_dir = os.getcwd()

+ 0 - 5
docker_bulid/method_a.py

@@ -1,5 +0,0 @@
-import pandas as pd 
-import numpy as np
-
-def method_a():
-    print("method_a print hello world!")

+ 0 - 5
docker_bulid/method_b.py

@@ -1,5 +0,0 @@
-import pandas as pd 
-import numpy as np
-
-def method_b():
-    print("method_b print hello world!")

+ 0 - 0
evaluation_processing/analysis_report/analysis.py → evaluation_processing/analysis.py


+ 0 - 16
evaluation_processing/analysis_report/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "analysis.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 247
evaluation_processing/analysis_report/.ipynb_checkpoints/analysis-checkpoint.py

@@ -1,247 +0,0 @@
-# -*- coding: utf-8 -*-
-import pandas as pd
-import matplotlib.pyplot as plt
-from pymongo import MongoClient
-import pickle
-import numpy as np
-import plotly.express as px
-from plotly.subplots import make_subplots
-import plotly.graph_objects as go
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import random
-import argparse
-import logging
-import traceback
-import os
-import lightgbm as lgb
-
-app = Flask('analysis_report——service')
-def get_data_from_mongo(args):
-    # 1.读数据 
-    mongodb_connection,mongodb_database,all_table,accuracy_table,model_table,model_name = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['train_table'],args['accuracy_table'],args['model_table'],args['model_name']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df_all = pd.DataFrame(db[all_table].find({}, {'_id': 0}))
-    
-    df_accuracy = pd.DataFrame(db[accuracy_table].find({}, {'_id': 0}))
-    
-    model_data = db[model_table].find_one({"model_name": model_name})
-    if model_data is not None:
-        model_binary = model_data['model']  # 确保这个字段是存储模型的二进制数据
-        # 反序列化模型 
-        model = pickle.loads(model_binary)
-    client.close()
-    return df_all,df_accuracy,model
-
-
-def draw_info(df_all,df_accuracy,model,features,args):
-    #1.数据描述 数据描述:
-    col_time = args['col_time']
-    label = args['label']
-    df_accuracy_beginTime = df_accuracy[col_time].min()
-    df_accuracy_endTime = df_accuracy[col_time].max()
-    df_train = df_all[df_all[col_time]<df_accuracy_beginTime][features+[col_time,label]]
-    df_train_beginTime = df_train[col_time].min()
-    df_train_endTime = df_train[col_time].max()
-    text_content = f"训练数据时间范围:{df_train_beginTime} 至 {df_train_endTime},共{df_train.shape[0]}条记录,测试集数据时间范围:{df_accuracy_beginTime} 至 {df_accuracy_endTime}。<br>lightgbm模型参数:{model.params}"
-    return text_content
-    
-
-
-def draw_global_scatter(df,args):
-    # --- 1. 实际功率和辐照度的散点图 ---
-    col_x = args['scatter_col_x']
-    col_y = args['label']
-    scatter_fig = px.scatter(
-        df,
-        x=col_x,
-        y=col_y,
-        title=f"{col_x}和{col_y}的散点图",
-        labels={"辐照度": "辐照度 (W/m²)", "实际功率": "实际功率 (kW)"}
-    )
-    return scatter_fig
-    
-    
-
-def draw_corr(df,features,args):
-
-    # --- 2. 相关性热力图 ---
-    # 计算相关性矩阵
-    label = args['label']
-    features_coor = features+[label]
-    corr_matrix = df[features_coor].corr()
-    # 使用 Plotly Express 绘制热力图
-    heatmap_fig = px.imshow(corr_matrix, 
-                    text_auto=True,  # 显示数值
-                    color_continuous_scale='RdBu',  # 配色方案
-                    title="Correlation Heatmap")
-    heatmap_fig.update_coloraxes(showscale=False)
-
-    return heatmap_fig
-
-def draw_feature_importance(model,features):
-    # --- 3. 特征重要性排名 ---
-    # 获取特征重要性
-    importance = model.feature_importance()  # 'split' 或 'gain',根据需求选择
-    
-    # 转换为 DataFrame 方便绘图
-    feature_importance_df = pd.DataFrame({
-        'Feature': features,
-        'Importance': importance
-    })
-    feature_importance_df = feature_importance_df.sort_values(by='Importance', ascending=False)
-    
-    # 使用 Plotly Express 绘制条形图
-    importance_fig = px.bar(feature_importance_df, x='Feature', y='Importance', 
-                 title="特征重要性排名", 
-                 labels={'Feature': '特征', 'Importance': '重要性'}, 
-                 color='Importance', 
-                 color_continuous_scale='Viridis')
-    # 更新每个 trace,确保没有图例
-    
-    importance_fig.update_layout(title="模型特征重要性排名", 
-                                 showlegend=False  # 移除图例
-                                )
-    importance_fig.update_coloraxes(showscale=False)
-    return importance_fig
-
-
-def draw_data_info_table(content):
-    # --- 4. 创建数据说明的表格 ---
-    # 转换为表格格式:1行1列,且填充文字说明
-    # 转换为表格格式  
-    # 创建一个空的图
-    table_fig = go.Figure()
-
-    # 第一部分: 显示文字说明
-    table_fig.add_trace(go.Table(
-        header=dict(
-            values=["说明"],  # 表格只有一列:说明
-            fill_color="paleturquoise",
-            align="center"
-        ),
-        cells=dict(
-            values=[[content]] ,  # 第一行填入文本说明
-            fill_color="lavender",
-            align="center"
-        )
-    ))
-
-   
-    return table_fig
-    
-
-
-def draw_accuracy_table(df,content):
-    
-    # --- 4. 每日的准确率表格 ---
-    # 转换为表格格式  
-    table_fig = go.Figure(
-        data=[
-            go.Table(
-                header=dict(
-                    values=list(df.columns),
-                    fill_color="paleturquoise",
-                    align="center"
-                ),
-                cells=dict(
-                    values=[df[col] for col in df.columns],
-                    fill_color="lavender",
-                    align="center"
-                )
-            )
-        ]
-    )
-    table_fig.update_layout(title="准确率表", showlegend=False)
-    return table_fig
-
-
-@app.route('/analysis_report', methods=['POST'])
-def analysis_report():
-    start_time = time.time()  
-    result = {}
-    success = 0
-    path = ""
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print('args',args)
-        logger.info(args)
-        #获取数据
-        df_all, df_accuracy, model = get_data_from_mongo(args)
-        features = model.feature_name()
-        text_content = draw_info(df_all,df_accuracy,model,features,args)
-        text_fig,scatter_fig,heatmap_fig,importance_fig,table_fig=draw_data_info_table(text_content),draw_global_scatter(df_all,args),draw_corr(df_all,features,args),draw_feature_importance(model,features),\
-        draw_accuracy_table(df_accuracy,text_content)
-        # --- 合并图表并保存到一个 HTML 文件 ---
-        # 创建子图布局
-        combined_fig = make_subplots(
-            rows=5, cols=1,
-            subplot_titles=["数据-模型概览","辐照度和实际功率的散点图", "相关性","特征重要性排名", "准确率表"],
-            row_heights=[0.3, 0.6, 0.6, 0.6, 0.4],
-            specs=[[{"type": "table"}], [{"type": "xy"}], [{"type": "heatmap"}], [{"type": "xy"}],[{"type": "table"}]]  # 指定每个子图类型
-        )
-        # 添加文本信息到子图(第一行)
-        # 添加文字说明
-        for trace in text_fig.data:
-            combined_fig.add_trace(trace, row=1, col=1)
-            
-        # 添加散点图
-        for trace in scatter_fig.data:
-            combined_fig.add_trace(trace, row=2, col=1)
-        
-        # 添加相关性热力图
-        for trace in heatmap_fig.data:
-            combined_fig.add_trace(trace, row=3, col=1)
-            
-        # 添加特征重要性排名图
-        for trace in importance_fig.data:
-            combined_fig.add_trace(trace, row=4, col=1)
-        
-        # 添加表格
-        for trace in table_fig.data:
-            combined_fig.add_trace(trace, row=5, col=1)
-    
-        # 更新布局
-        combined_fig.update_layout(
-        height=1500,
-        title_text="分析结果汇总",  # 添加换行符以适应文本内容
-        title_x=0.5,  # 中心对齐标题
-        showlegend=False,
-        )
-        combined_fig.update_coloraxes(showscale=False)
-        filename = f"{int(time.time() * 1000)}_{random.randint(1000, 9999)}.html"
-        # 保存为 HTML
-        directory = '/usr/share/nginx/html'
-        if not os.path.exists(directory):
-            os.makedirs(directory)
-        file_path = os.path.join(directory, filename)
-        # combined_fig.write_html(f"D://usr//{filename}")
-        combined_fig.write_html(file_path)
-        path = f"http://ds2:10093/{filename}"
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    result['file_path'] = path
-    print("Program execution ends!")
-    return result
-
-
-if __name__=="__main__":  
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("analysis_report log")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10092)
-    print("server start!")

+ 0 - 9
evaluation_processing/analysis_report/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,9 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-requests==2.32.3
-Flask==3.0.3
-waitress==3.0.0
-plotly==5.23.0
-matplotlib==3.7.5
-lightgbm==4.3.0

+ 0 - 131
evaluation_processing/analysis_report/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,131 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import analysis"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-23 09:26:03,442 - waitress - INFO - Serving on http://0.0.0.0:10092\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-23 09:26:07,024 - analysis_report log - INFO - {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-23 09:27:07,135 - analysis_report log - INFO - {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    "%run analysis.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "a3b9a9ca-6c1a-40c1-a9c4-f3500fcba937",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "208"
-      ]
-     },
-     "execution_count": 1,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "args = {\n",
-    "    'mongodb_database':'db2',\n",
-    "    'train_table':'j00629_copy_statistics',\n",
-    "    'accuracy_table':'j00629_copy_statistics_predict_accuracy',\n",
-    "    'model_table':'models',\n",
-    "    'model_name':'lightgbm_model',\n",
-    "    'scatter_col_x':'globalr-1',\n",
-    "    'label':'realPower',\n",
-    "    'col_time':'dateTime'\n",
-    "}\n",
-    "analysis_report(args)"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
evaluation_processing/analysis_report/Dockerfile

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "analysis.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 9
evaluation_processing/analysis_report/requirements.txt

@@ -1,9 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-requests==2.32.3
-Flask==3.0.3
-waitress==3.0.0
-plotly==5.23.0
-matplotlib==3.7.5
-lightgbm==4.3.0

+ 0 - 131
evaluation_processing/analysis_report/test.ipynb

@@ -1,131 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import analysis"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-23 09:26:03,442 - waitress - INFO - Serving on http://0.0.0.0:10092\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-23 09:26:07,024 - analysis_report log - INFO - {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-23 09:27:07,135 - analysis_report log - INFO - {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'mongodb_database': 'db2', 'train_table': 'j00629_copy_statistics', 'accuracy_table': 'j00629_copy_statistics_predict_accuracy', 'model_table': 'models', 'model_name': 'lightgbm_model', 'scatter_col_x': 'globalr-1', 'label': 'realPower', 'col_time': 'dateTime'}\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    "%run analysis.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "a3b9a9ca-6c1a-40c1-a9c4-f3500fcba937",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "208"
-      ]
-     },
-     "execution_count": 1,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "args = {\n",
-    "    'mongodb_database':'db2',\n",
-    "    'train_table':'j00629_copy_statistics',\n",
-    "    'accuracy_table':'j00629_copy_statistics_predict_accuracy',\n",
-    "    'model_table':'models',\n",
-    "    'model_name':'lightgbm_model',\n",
-    "    'scatter_col_x':'globalr-1',\n",
-    "    'label':'realPower',\n",
-    "    'col_time':'dateTime'\n",
-    "}\n",
-    "analysis_report(args)"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 3 - 6
evaluation_processing/evaluation_accuracy/evaluation_accuracy.py → evaluation_processing/evaluation_accuracy.py

@@ -1,13 +1,10 @@
-import argparse
-import pandas as pd 
+import pandas as pd
 import numpy as np
 from pymongo import MongoClient
 import requests
-import json, time
+import json
 from datetime import datetime
-
-from flask import Flask,request,jsonify
-from waitress import serve
+from flask import Flask, request
 import time
 import logging
 import traceback

+ 0 - 16
evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "evaluation_accuracy.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 212
evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/evaluation_accuracy-checkpoint.py

@@ -1,212 +0,0 @@
-import argparse
-import pandas as pd 
-import numpy as np
-from pymongo import MongoClient
-import requests
-import json, time
-from datetime import datetime
-
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import logging
-import traceback
-app = Flask('evaluation_accuracy——service')
-url = 'http://49.4.78.194:17160/apiCalculate/calculate'
-'''
-准确率接口使用手顺:
-①入口方法为 calculate_acc
-② 按照参数传传值
-data含有C_TIME时间、realValue实际功率、ableValue可用功率(没有数值用实际功率替代)、forecastAbleValue预测功率
-opt为包含场站必要信息的字典,字段为:cap装机容量 province省份 formulaType公式类型 electricType电站类型 stationCode场站编码
-具体介绍参考接口文档
-③公式计算分为按天和按点两种,指定好opt.formulaType,即可设置公式类型,再在求取的每天或每个点的结果上进行平均,结果返回
-'''
-
-
-def wrap_json(df, opt):
-    """
-    包装json
-    :param df: 列名为 C_TIME realValue ableValue forecastAbleValue的DataFrame
-    :param opt: 参数字典
-    :return: json列表
-    """
-    d = opt['formulaType'].split('_')[0]
-    jata, dfs = [], []
-    if d == 'POINT':
-        df['time'] = df['C_TIME'].apply(datetime_to_timestamp)
-        for i, row in df.iterrows():
-            dfs.append(row.to_frame().T)
-    elif d == 'DAY':
-        df = df.copy()
-        # df['time'] = df['C_TIME'].apply(datetime_to_timestamp) int(round(time.mktime(df['C_TIME'].timetuple()))*1000)
-        # df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)
-        df['time'] = df['C_TIME'].apply(lambda x: datetime_to_timestamp(x))
-        # df['time'] = df.apply(lambda row: datetime_to_timestamp(row['C_TIME']), axis=1)
-
-        # df['C_TIME'] = df['C_TIME'].dt.strftime('%y%m%d')   # 转换成年月日
-        df.loc[:, 'C_TIME'] = df['C_TIME'].dt.strftime('%y%m%d')
-        for i, group in df.groupby('C_TIME'):
-            dfs.append(group)
-    outter_dict = {"electricCapacity": str(opt['cap']), "province": opt['province'], "formulaType": opt['formulaType'], "electricType":opt['electricType'], "stationCode": opt['stationCode']}
-    timestamp = int(time.mktime(datetime.now().timetuple()) * 1000 + datetime.now().microsecond / 1000.0)
-    inner_dict = {"genTime": str(timestamp)+"L", "capacity": str(opt['cap']), "openCapacity": str(opt['cap'])}
-    for df in dfs:
-        calculationInfoList = df.iloc[:, 1:].to_json(orient='records')
-        outter_dict['calculationInfoList'] = [dict(calculation, **inner_dict) for calculation in eval(calculationInfoList)]
-        jata.append(json.dumps(outter_dict))
-    return jata
-
-
-def send_reqest(url, jata):
-    """
-    发送请求
-    :param url: 请求地址
-    :param jata: Json数据
-    :return: 准确率
-    """
-    headers = {
-        'content-type': 'application/json;charset=UTF-8',
-        "Authorization": "dXNlcjoxMjM0NTY="
-    }
-    acc, number = 0, 0
-    for i in range(len(jata)):
-        res = requests.post(url, headers=headers, data=jata[i])
-        if res.json()['code'] == '500':
-            print("没通过考核标准", end=' ')
-            continue
-        number += 1
-        acc += float(res.json()['data'][:-1])
-    if number != 0:
-        acc /= number
-    else:
-        print("无法迭代计算准确率平均值,分母为0")
-    return acc
-
-
-def calculate_acc(data, opt):
-    """
-    准确率调用接口计算
-    :param data: 列名为 C_TIME realValue ableValue forecastAbleValue的DataFrame
-    :param opt: 参数字段
-    :return: 计算结果
-    """
-    jata = wrap_json(data, opt)
-    acc = send_reqest(url=url, jata=jata)
-    return acc
-
-
-def datetime_to_timestamp(dt):
-    return int(round(time.mktime(dt.timetuple()))*1000)
-
-
-
-def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    collection = db[mongodb_read_table]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
-    client.close()
-    return df
-    
-
-def insert_data_into_mongo(res_df,args):
-    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    if mongodb_write_table in db.list_collection_names():
-        db[mongodb_write_table].drop()
-        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
-    collection = db[mongodb_write_table]  # 集合名称
-    # 将 DataFrame 转为字典格式
-    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
-    # 插入到 MongoDB
-    collection.insert_many(data_dict)
-    print("data inserted successfully!")
-    
-
-# def compute_accuracy(df,args):
-#     col_time,col_rp,col_pp,formulaType = args['col_time'],args['col_rp'],args['col_pp'],args['formulaType'].split('_')[0]
-#     dates = []
-#     accuracy = []
-#     df = df[(~np.isnan(df[col_rp]))&(~np.isnan(df[col_pp]))]
-#     df = df[[col_time,col_rp,col_pp]].rename(columns={col_time:'C_TIME',col_rp:'realValue',col_pp:'forecastAbleValue'})
-#     df['ableValue'] = df['realValue']
-#     df['C_TIME'] = df['C_TIME'].apply(lambda x: datetime.strptime(x, "%Y-%m-%d %H:%M:%S"))
-#     if formulaType=='DAY':
-#         df['C_DATE'] = df['C_TIME'].apply(lambda x: x.strftime("%Y-%m-%d"))
-#         days_list = df['C_DATE'].unique().tolist()
-#         for day in days_list:
-#             df_tmp = df[df['C_DATE'] == day]
-#             dates.append(day)
-#             accuracy.append(calculate_acc(df_tmp, args))
-#     else:
-#         points = df['C_TIME'].unique().tolist()
-#         for point in points:
-#             df_tmp = df[df['C_TIME'] == point]
-#             dates.append(point)
-#             accuracy.append(calculate_acc(df_tmp, args))
-#     print("accuray compute successfully!")
-#     return pd.DataFrame({'date':dates,'accuracy':accuracy})
-
-# 定义 RMSE 和 MAE 计算函数
-def rmse(y_true, y_pred):
-    return np.sqrt(np.mean((y_true - y_pred) ** 2))
-
-def mae(y_true, y_pred):
-    return np.mean(np.abs(y_true - y_pred))
-    
-def compute_accuracy(df,args):
-    col_time,col_rp,col_pp = args['col_time'],args['col_rp'],args['col_pp']
-    df[col_time] = df[col_time].apply(lambda x:pd.to_datetime(x).strftime("%Y-%m-%d")) 
-    # 按日期分组并计算 RMSE 和 MAE
-
-    results = df.groupby(col_time).apply(
-        lambda group: pd.Series({
-            "RMSE": rmse(group[col_rp], group[col_pp]),
-            "MAE": mae(group[col_rp], group[col_pp])
-        })
-    ).reset_index()
-    return results
-    
-
-@app.route('/evaluation_accuracy', methods=['POST'])
-def evaluation_accuracy():
-    # 获取程序开始时间  
-    start_time = time.time()  
-    result = {}
-    success = 0
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print('args',args)
-        logger.info(args)
-        power_df = get_data_from_mongo(args)
-        acc_result = compute_accuracy(power_df,args)
-        insert_data_into_mongo(acc_result,args)
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-   
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    print("Program execution ends!")
-    return result
-    
-
-if __name__=="__main__":  
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("evaluation_accuracy log")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10091)
-    print("server start!")

+ 0 - 6
evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,6 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-requests==2.32.3
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 1506
evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,1506 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import algo_test"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'_id': ObjectId('66ebba82a3b7dbe82538e34a'), 'name': 'Alice', 'age': 25, 'city': 'Beijing'}\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 使用 subprocess 执行 .py 文件\n",
-    "result = subprocess.run(['python', 'algo_test.py'], capture_output=True, text=True)\n",
-    "\n",
-    "# 打印输出\n",
-    "print(result.stdout)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "!pip freeze > requirements.txt"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]\n"
-     ]
-    }
-   ],
-   "source": [
-    "'formulaType': 'DAY_SHORT_ACCURACY',\n",
-    "    'cap': '225',\n",
-    "    'province': 'E15',\n",
-    "    'electricType': 'E2',\n",
-    "    'stationCode': 'J00260'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 61,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(formulaType='DAY_SHORT_ACCURACY', cap='225', province='E15', electricType='E2', stationCode='J00260', col_time='C_TIME', col_rp='实际功率', col_pp='predict', mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP_records_predict', mongodb_write_table='J00260NWP_records_accuracy')\n",
-      "accuray compute successfully!\n",
-      "Collection 'J00260NWP_records_accuracy already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "D:\\jupyterProject\\jyProject\\algorithm_platform\\ evaluation\\accuracy.py:39: SettingWithCopyWarning: \n",
-      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
-      "Try using .loc[row_indexer,col_indexer] = value instead\n",
-      "\n",
-      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
-      "  df.loc[:, 'time'] = df['C_TIME'].apply(datetime_to_timestamp)\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"accuracy.py\",\n",
-    "    \"--formulaType\", \"DAY_SHORT_ACCURACY\",\n",
-    "    \"--cap\",\"225\",\n",
-    "    \"--province\",\"E15\",\n",
-    "    \"--electricType\",\"E2\",\n",
-    "    \"--stationCode\",\"J00260\",\n",
-    "    \"--col_time\",\"C_TIME\",\n",
-    "    \"--col_rp\",\"实际功率\",\n",
-    "    \"--col_pp\",\"predict\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_records_predict\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_records_accuracy\",\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "14a9feb4-5625-45d7-8e0f-6a8dea8c9f24",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run model_prediction_lightgbm  --mongodb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongodb_database \"algorithm_platform\"   --mongodb_read_table \"J00260NWP_records\"     --mongodb_model_table \"models\"    --model_name \"lightgbm_model\"     --mongodb_database \"algorithm_platform\"     --mongodb_write_table \"J00260NWP_records_predict\"      "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run lightgbm_model.py --numerical_features ','.join(['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向','NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向','NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向','NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向','NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射','NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'])  --categorical_features  ','.join([])  --label  \"实际功率\" --learning_rate  \"0.01\" --num_leaves \"31\"  --min_data_in_leaf  \"21\"  --mongodb_connection  \"mongodb://root:Jydl3377@192.168.1.33:27017\" --mongodb_database  \"algorithm_platform\" --mongodb_read_table  \"J00260NWP_records\" --mongodb_write_table  \"models\" --model_name \"lightgbm_model\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 33,
-   "id": "9ca17599-e453-479c-a9b3-b1d15f2d54de",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import lightgbm as lgb\n",
-    "import argparse\n",
-    "import pandas as pd \n",
-    "import numpy as np\n",
-    "from pymongo import MongoClient\n",
-    "import pickle\n",
-    "client = MongoClient(\"mongodb://root:Jydl3377@192.168.1.33:27017\")\n",
-    "db = client[\"algorithm_platform\"]\n",
-    "# collection = db[\"models\"]\n",
-    "# model_data = collection.find_one({\"model_name\": \"lightgbm_model\"})\n",
-    "# if model_data is not None:\n",
-    "#     # 假设模型存储在字段 'model' 中\n",
-    "#     model_binary = model_data['model']  # 确保这个字段是存储模型的二进制数据\n",
-    "\n",
-    "#     # 反序列化模型\n",
-    "#     model = pickle.loads(model_binary)\n",
-    "# model"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 62,
-   "id": "ff940fec-55fd-4cbd-99ef-5564c6632efb",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "90.50265625"
-      ]
-     },
-     "execution_count": 62,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "collection = db[\"J00260NWP_records_accuracy\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "df['accuracy'].mean()"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 42,
-   "id": "8c55f915-4db7-4859-b449-07b2891635bc",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>date</th>\n",
-       "      <th>accuracy</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>3</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270c</td>\n",
-       "      <td>2024-05-05</td>\n",
-       "      <td>92.48</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270d</td>\n",
-       "      <td>2024-05-06</td>\n",
-       "      <td>92.05</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>5</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270e</td>\n",
-       "      <td>2024-05-07</td>\n",
-       "      <td>90.81</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>6</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270f</td>\n",
-       "      <td>2024-05-08</td>\n",
-       "      <td>94.91</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>7</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2710</td>\n",
-       "      <td>2024-05-09</td>\n",
-       "      <td>84.49</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>...</th>\n",
-       "      <td>...</td>\n",
-       "      <td>...</td>\n",
-       "      <td>...</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>123</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2784</td>\n",
-       "      <td>2024-09-07</td>\n",
-       "      <td>91.89</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>124</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2785</td>\n",
-       "      <td>2024-09-08</td>\n",
-       "      <td>83.68</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>125</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2786</td>\n",
-       "      <td>2024-09-10</td>\n",
-       "      <td>91.89</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>126</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2787</td>\n",
-       "      <td>2024-09-11</td>\n",
-       "      <td>88.76</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>127</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2788</td>\n",
-       "      <td>2024-09-12</td>\n",
-       "      <td>86.05</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>125 rows × 3 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                          _id        date  accuracy\n",
-       "3    66f24cdb7783ad7f1a7a270c  2024-05-05     92.48\n",
-       "4    66f24cdb7783ad7f1a7a270d  2024-05-06     92.05\n",
-       "5    66f24cdb7783ad7f1a7a270e  2024-05-07     90.81\n",
-       "6    66f24cdb7783ad7f1a7a270f  2024-05-08     94.91\n",
-       "7    66f24cdb7783ad7f1a7a2710  2024-05-09     84.49\n",
-       "..                        ...         ...       ...\n",
-       "123  66f24cdb7783ad7f1a7a2784  2024-09-07     91.89\n",
-       "124  66f24cdb7783ad7f1a7a2785  2024-09-08     83.68\n",
-       "125  66f24cdb7783ad7f1a7a2786  2024-09-10     91.89\n",
-       "126  66f24cdb7783ad7f1a7a2787  2024-09-11     88.76\n",
-       "127  66f24cdb7783ad7f1a7a2788  2024-09-12     86.05\n",
-       "\n",
-       "[125 rows x 3 columns]"
-      ]
-     },
-     "execution_count": 42,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df[df['date']>='2024-05-05']"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 39,
-   "id": "7feaff6d-e41a-4bd7-b6fb-a63fc6900cca",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import argparse\n",
-    "import importlib\n",
-    "import acc\n",
-    "from datetime import datetime, timedelta\n",
-    "\n",
-    "collection = db[\"J00260NWP_records_predict\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "df.to_csv('J00260_predict.csv',encoding='gbk')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 64,
-   "id": "8a22f3e9-feff-438e-81e2-b5ceaa15ac48",
-   "metadata": {
-    "scrolled": true
-   },
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "90.50265625000002"
-      ]
-     },
-     "execution_count": 64,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import argparse\n",
-    "import importlib\n",
-    "import acc\n",
-    "from datetime import datetime, timedelta\n",
-    "\n",
-    "collection = db[\"J00260NWP_records_predict\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "\n",
-    "# 重新加载模块\n",
-    "importlib.reload(acc)\n",
-    "from acc import calculate_acc\n",
-    "\n",
-    "df_tmp = df[['C_TIME','实际功率','predict']].rename(columns={'实际功率':'realValue','predict':'forecastAbleValue'})\n",
-    "df_tmp = df_tmp[~np.isnan(df_tmp['realValue'])]\n",
-    "df_tmp['ableValue'] = df_tmp['realValue']\n",
-    "df_tmp['C_TIME'] = df_tmp['C_TIME'].apply(lambda x: datetime.strptime(x, \"%Y-%m-%d %H:%M:%S\"))\n",
-    "\n",
-    "cc = {\n",
-    "    'formulaType': 'DAY_SHORT_ACCURACY',\n",
-    "    'cap': '225',\n",
-    "    'province': 'E15',\n",
-    "    'electricType': 'E2',\n",
-    "    'stationCode': 'J00260' }\n",
-    "            \n",
-    "opt = argparse.Namespace(**cc)\n",
-    "\n",
-    "calculate_acc(df_tmp, opt)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 57,
-   "id": "abccb68a-cc63-4474-8167-ab1e01363ad2",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "      <th>predict</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>51</th>\n",
-       "      <td>66ecc86f1075358d129a1e72</td>\n",
-       "      <td>2024-05-05 21:30:00</td>\n",
-       "      <td>128.71</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.10</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.61</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6149</td>\n",
-       "      <td>58.2727</td>\n",
-       "      <td>...</td>\n",
-       "      <td>9.0536</td>\n",
-       "      <td>44.5345</td>\n",
-       "      <td>46.8773</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0082</td>\n",
-       "      <td>14.4073</td>\n",
-       "      <td>22.4573</td>\n",
-       "      <td>890.2109</td>\n",
-       "      <td>76.442233</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>52</th>\n",
-       "      <td>66ecc86f1075358d129a1e73</td>\n",
-       "      <td>2024-05-05 21:45:00</td>\n",
-       "      <td>129.84</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.34</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.70</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5280</td>\n",
-       "      <td>56.5700</td>\n",
-       "      <td>...</td>\n",
-       "      <td>8.3291</td>\n",
-       "      <td>43.2064</td>\n",
-       "      <td>45.5273</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0091</td>\n",
-       "      <td>14.1027</td>\n",
-       "      <td>23.0645</td>\n",
-       "      <td>890.3364</td>\n",
-       "      <td>75.284865</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>53</th>\n",
-       "      <td>66ecc86f1075358d129a1e74</td>\n",
-       "      <td>2024-05-05 22:00:00</td>\n",
-       "      <td>136.81</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>111.86</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>91.75</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5088</td>\n",
-       "      <td>55.0418</td>\n",
-       "      <td>...</td>\n",
-       "      <td>7.3591</td>\n",
-       "      <td>41.9909</td>\n",
-       "      <td>44.1800</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0100</td>\n",
-       "      <td>13.8064</td>\n",
-       "      <td>23.6636</td>\n",
-       "      <td>890.4555</td>\n",
-       "      <td>75.199564</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>3 rows × 35 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                         _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "51  66ecc86f1075358d129a1e72  2024-05-05 21:30:00  128.71       8.98  108.10   \n",
-       "52  66ecc86f1075358d129a1e73  2024-05-05 21:45:00  129.84       8.98  108.34   \n",
-       "53  66ecc86f1075358d129a1e74  2024-05-05 22:00:00  136.81       8.98  111.86   \n",
-       "\n",
-       "    实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-中云量  NWP-高云量  \\\n",
-       "51   -0.99  93.61       0.0       3.6149      58.2727  ...   9.0536  44.5345   \n",
-       "52   -0.99  92.70       0.0       3.5280      56.5700  ...   8.3291  43.2064   \n",
-       "53   -0.99  91.75       0.0       3.5088      55.0418  ...   7.3591  41.9909   \n",
-       "\n",
-       "    NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度    NWP-气压  \\\n",
-       "51  46.8773        0.0        0.0     0.0082  14.4073  22.4573  890.2109   \n",
-       "52  45.5273        0.0        0.0     0.0091  14.1027  23.0645  890.3364   \n",
-       "53  44.1800        0.0        0.0     0.0100  13.8064  23.6636  890.4555   \n",
-       "\n",
-       "      predict  \n",
-       "51  76.442233  \n",
-       "52  75.284865  \n",
-       "53  75.199564  \n",
-       "\n",
-       "[3 rows x 35 columns]"
-      ]
-     },
-     "execution_count": 57,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df[df['C_TIME'].str.contains('2024-05-05')]"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 56,
-   "id": "abf7687b-faf2-4b78-a9f2-44a2fea9daaa",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "      <th>predict</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>51</th>\n",
-       "      <td>66ecc86f1075358d129a1e72</td>\n",
-       "      <td>2024-05-05 21:30:00</td>\n",
-       "      <td>128.71</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.10</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.61</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6149</td>\n",
-       "      <td>58.2727</td>\n",
-       "      <td>...</td>\n",
-       "      <td>9.0536</td>\n",
-       "      <td>44.5345</td>\n",
-       "      <td>46.8773</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0082</td>\n",
-       "      <td>14.4073</td>\n",
-       "      <td>22.4573</td>\n",
-       "      <td>890.2109</td>\n",
-       "      <td>76.442233</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>52</th>\n",
-       "      <td>66ecc86f1075358d129a1e73</td>\n",
-       "      <td>2024-05-05 21:45:00</td>\n",
-       "      <td>129.84</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.34</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.70</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5280</td>\n",
-       "      <td>56.5700</td>\n",
-       "      <td>...</td>\n",
-       "      <td>8.3291</td>\n",
-       "      <td>43.2064</td>\n",
-       "      <td>45.5273</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0091</td>\n",
-       "      <td>14.1027</td>\n",
-       "      <td>23.0645</td>\n",
-       "      <td>890.3364</td>\n",
-       "      <td>75.284865</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>53</th>\n",
-       "      <td>66ecc86f1075358d129a1e74</td>\n",
-       "      <td>2024-05-05 22:00:00</td>\n",
-       "      <td>136.81</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>111.86</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>91.75</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5088</td>\n",
-       "      <td>55.0418</td>\n",
-       "      <td>...</td>\n",
-       "      <td>7.3591</td>\n",
-       "      <td>41.9909</td>\n",
-       "      <td>44.1800</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0100</td>\n",
-       "      <td>13.8064</td>\n",
-       "      <td>23.6636</td>\n",
-       "      <td>890.4555</td>\n",
-       "      <td>75.199564</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>3 rows × 35 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                         _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "51  66ecc86f1075358d129a1e72  2024-05-05 21:30:00  128.71       8.98  108.10   \n",
-       "52  66ecc86f1075358d129a1e73  2024-05-05 21:45:00  129.84       8.98  108.34   \n",
-       "53  66ecc86f1075358d129a1e74  2024-05-05 22:00:00  136.81       8.98  111.86   \n",
-       "\n",
-       "    实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-中云量  NWP-高云量  \\\n",
-       "51   -0.99  93.61       0.0       3.6149      58.2727  ...   9.0536  44.5345   \n",
-       "52   -0.99  92.70       0.0       3.5280      56.5700  ...   8.3291  43.2064   \n",
-       "53   -0.99  91.75       0.0       3.5088      55.0418  ...   7.3591  41.9909   \n",
-       "\n",
-       "    NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度    NWP-气压  \\\n",
-       "51  46.8773        0.0        0.0     0.0082  14.4073  22.4573  890.2109   \n",
-       "52  45.5273        0.0        0.0     0.0091  14.1027  23.0645  890.3364   \n",
-       "53  44.1800        0.0        0.0     0.0100  13.8064  23.6636  890.4555   \n",
-       "\n",
-       "      predict  \n",
-       "51  76.442233  \n",
-       "52  75.284865  \n",
-       "53  75.199564  \n",
-       "\n",
-       "[3 rows x 35 columns]"
-      ]
-     },
-     "execution_count": 56,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df[df['C_TIME'].str.contains('2024-05-05')]"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
evaluation_processing/evaluation_accuracy/Dockerfile

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9-slim
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "evaluation_accuracy.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 6
evaluation_processing/evaluation_accuracy/requirements.txt

@@ -1,6 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-requests==2.32.3
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 830
evaluation_processing/evaluation_accuracy/test.ipynb

@@ -1,830 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import algo_test"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'_id': ObjectId('66ebba82a3b7dbe82538e34a'), 'name': 'Alice', 'age': 25, 'city': 'Beijing'}\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 使用 subprocess 执行 .py 文件\n",
-    "result = subprocess.run(['python', 'algo_test.py'], capture_output=True, text=True)\n",
-    "\n",
-    "# 打印输出\n",
-    "print(result.stdout)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 14:20:47,541 - waitress - INFO - Serving on http://0.0.0.0:10091\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 14:21:19,377 - evaluation_accuracy log - INFO - {'formulaType': 'DAY_SHORT_ACCURACY', 'cap': '225', 'province': 'E15', 'electricType': 'E2', 'stationCode': 'J00260', 'col_time': 'C_TIME', 'col_rp': '实际功率', 'col_pp': 'predict', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_records_predict', 'mongodb_write_table': 'J00260NWP_records_accuracy'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'formulaType': 'DAY_SHORT_ACCURACY', 'cap': '225', 'province': 'E15', 'electricType': 'E2', 'stationCode': 'J00260', 'col_time': 'C_TIME', 'col_rp': '实际功率', 'col_pp': 'predict', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_records_predict', 'mongodb_write_table': 'J00260NWP_records_accuracy'}\n",
-      "accuray compute successfully!\n",
-      "Collection 'J00260NWP_records_accuracy already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 14:25:11,738 - evaluation_accuracy log - INFO - {'formulaType': 'DAY_SHORT_ACCURACY', 'cap': '225', 'province': 'E15', 'electricType': 'E2', 'stationCode': 'J00260', 'col_time': 'C_TIME', 'col_rp': '实际功率', 'col_pp': 'predict', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_records_predict', 'mongodb_write_table': 'J00260NWP_records_accuracy'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'formulaType': 'DAY_SHORT_ACCURACY', 'cap': '225', 'province': 'E15', 'electricType': 'E2', 'stationCode': 'J00260', 'col_time': 'C_TIME', 'col_rp': '实际功率', 'col_pp': 'predict', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_records_predict', 'mongodb_write_table': 'J00260NWP_records_accuracy'}\n",
-      "accuray compute successfully!\n",
-      "Collection 'J00260NWP_records_accuracy already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    "%run evaluation_accuracy.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]\n"
-     ]
-    }
-   ],
-   "source": [
-    "'formulaType': 'DAY_SHORT_ACCURACY',\n",
-    "    'cap': '225',\n",
-    "    'province': 'E15',\n",
-    "    'electricType': 'E2',\n",
-    "    'stationCode': 'J00260'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {
-    "scrolled": true
-   },
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(formulaType='DAY_SHORT_ACCURACY', cap='225', province='E15', electricType='E2', stationCode='J00260', col_time='C_TIME', col_rp='实际功率', col_pp='predict', mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP_records_predict', mongodb_write_table='J00260NWP_records_accuracy')\n",
-      "accuray compute successfully!\n",
-      "Collection 'J00260NWP_records_accuracy already exist, deleted successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"accuracy.py\",\n",
-    "    \"--formulaType\", \"DAY_SHORT_ACCURACY\",\n",
-    "    \"--cap\",\"225\",\n",
-    "    \"--province\",\"E15\",\n",
-    "    \"--electricType\",\"E2\",\n",
-    "    \"--stationCode\",\"J00260\",\n",
-    "    \"--col_time\",\"C_TIME\",\n",
-    "    \"--col_rp\",\"实际功率\",\n",
-    "    \"--col_pp\",\"predict\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_records_predict\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_records_accuracy\",\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "1cb1c745-0673-4dfa-968f-8985e788852a",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "\"--electricType\",\"E2\",\n",
-    "\"--stationCode\",\"J00260\",\n",
-    "\"--col_time\",\"C_TIME\",\n",
-    "\"--col_rp\",\"实际功率\",\n",
-    "\"--col_pp\",\"predict\",\n",
-    "\"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "\"--mongodb_database\", \"algorithm_platform\",\n",
-    "\"--mongodb_read_table\", \"J00260NWP_records_predict\",\n",
-    "\"--mongodb_write_table\", \"J00260NWP_records_accuracy\","
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "14a9feb4-5625-45d7-8e0f-6a8dea8c9f24",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run evaluation_accuracy  --formulaType \"DAY_SHORT_ACCURACY\"     --cap \"225\"   --province \"E15\"     --electricType \"E2\"    --stationCode \"J00260\"     --col_time \"C_TIME\"     --col_rp \"实际功率\"   --col_pp \"predict\"  --mongodb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"   --mongodb_database \"algorithm_platform\"   --mongodb_read_table \"J00260NWP_records_predict\"  --mongodb_write_table \"J00260NWP_records_accuracy\"        "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run evaluation_accuracy.py --numerical_features ','.join(['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向','NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向','NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向','NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向','NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射','NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'])  --categorical_features  ','.join([])  --label  \"实际功率\" --learning_rate  \"0.01\" --num_leaves \"31\"  --min_data_in_leaf  \"21\"  --mongodb_connection  \"mongodb://root:Jydl3377@192.168.1.33:27017\" --mongodb_database  \"algorithm_platform\" --mongodb_read_table  \"J00260NWP_records\" --mongodb_write_table  \"models\" --model_name \"lightgbm_model\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 7,
-   "id": "9ca17599-e453-479c-a9b3-b1d15f2d54de",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import lightgbm as lgb\n",
-    "import argparse\n",
-    "import pandas as pd \n",
-    "import numpy as np\n",
-    "from pymongo import MongoClient\n",
-    "import pickle\n",
-    "client = MongoClient(\"mongodb://root:Jydl3377@192.168.1.33:27017\")\n",
-    "db = client[\"algorithm_platform\"]\n",
-    "# collection = db[\"models\"]\n",
-    "# model_data = collection.find_one({\"model_name\": \"lightgbm_model\"})\n",
-    "# if model_data is not None:\n",
-    "#     # 假设模型存储在字段 'model' 中\n",
-    "#     model_binary = model_data['model']  # 确保这个字段是存储模型的二进制数据\n",
-    "\n",
-    "#     # 反序列化模型\n",
-    "#     model = pickle.loads(model_binary)\n",
-    "# model"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 8,
-   "id": "ff940fec-55fd-4cbd-99ef-5564c6632efb",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "90.50265625"
-      ]
-     },
-     "execution_count": 8,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "collection = db[\"J00260NWP_records_accuracy\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "df['accuracy'].mean()"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 42,
-   "id": "8c55f915-4db7-4859-b449-07b2891635bc",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>date</th>\n",
-       "      <th>accuracy</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>3</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270c</td>\n",
-       "      <td>2024-05-05</td>\n",
-       "      <td>92.48</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270d</td>\n",
-       "      <td>2024-05-06</td>\n",
-       "      <td>92.05</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>5</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270e</td>\n",
-       "      <td>2024-05-07</td>\n",
-       "      <td>90.81</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>6</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a270f</td>\n",
-       "      <td>2024-05-08</td>\n",
-       "      <td>94.91</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>7</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2710</td>\n",
-       "      <td>2024-05-09</td>\n",
-       "      <td>84.49</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>...</th>\n",
-       "      <td>...</td>\n",
-       "      <td>...</td>\n",
-       "      <td>...</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>123</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2784</td>\n",
-       "      <td>2024-09-07</td>\n",
-       "      <td>91.89</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>124</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2785</td>\n",
-       "      <td>2024-09-08</td>\n",
-       "      <td>83.68</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>125</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2786</td>\n",
-       "      <td>2024-09-10</td>\n",
-       "      <td>91.89</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>126</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2787</td>\n",
-       "      <td>2024-09-11</td>\n",
-       "      <td>88.76</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>127</th>\n",
-       "      <td>66f24cdb7783ad7f1a7a2788</td>\n",
-       "      <td>2024-09-12</td>\n",
-       "      <td>86.05</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>125 rows × 3 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                          _id        date  accuracy\n",
-       "3    66f24cdb7783ad7f1a7a270c  2024-05-05     92.48\n",
-       "4    66f24cdb7783ad7f1a7a270d  2024-05-06     92.05\n",
-       "5    66f24cdb7783ad7f1a7a270e  2024-05-07     90.81\n",
-       "6    66f24cdb7783ad7f1a7a270f  2024-05-08     94.91\n",
-       "7    66f24cdb7783ad7f1a7a2710  2024-05-09     84.49\n",
-       "..                        ...         ...       ...\n",
-       "123  66f24cdb7783ad7f1a7a2784  2024-09-07     91.89\n",
-       "124  66f24cdb7783ad7f1a7a2785  2024-09-08     83.68\n",
-       "125  66f24cdb7783ad7f1a7a2786  2024-09-10     91.89\n",
-       "126  66f24cdb7783ad7f1a7a2787  2024-09-11     88.76\n",
-       "127  66f24cdb7783ad7f1a7a2788  2024-09-12     86.05\n",
-       "\n",
-       "[125 rows x 3 columns]"
-      ]
-     },
-     "execution_count": 42,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df[df['date']>='2024-05-05']"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 39,
-   "id": "7feaff6d-e41a-4bd7-b6fb-a63fc6900cca",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import argparse\n",
-    "import importlib\n",
-    "import acc\n",
-    "from datetime import datetime, timedelta\n",
-    "\n",
-    "collection = db[\"J00260NWP_records_predict\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "df.to_csv('J00260_predict.csv',encoding='gbk')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 64,
-   "id": "8a22f3e9-feff-438e-81e2-b5ceaa15ac48",
-   "metadata": {
-    "scrolled": true
-   },
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "90.50265625000002"
-      ]
-     },
-     "execution_count": 64,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import argparse\n",
-    "import importlib\n",
-    "import acc\n",
-    "from datetime import datetime, timedelta\n",
-    "\n",
-    "collection = db[\"J00260NWP_records_predict\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "\n",
-    "# 重新加载模块\n",
-    "importlib.reload(acc)\n",
-    "from acc import calculate_acc\n",
-    "\n",
-    "df_tmp = df[['C_TIME','实际功率','predict']].rename(columns={'实际功率':'realValue','predict':'forecastAbleValue'})\n",
-    "df_tmp = df_tmp[~np.isnan(df_tmp['realValue'])]\n",
-    "df_tmp['ableValue'] = df_tmp['realValue']\n",
-    "df_tmp['C_TIME'] = df_tmp['C_TIME'].apply(lambda x: datetime.strptime(x, \"%Y-%m-%d %H:%M:%S\"))\n",
-    "\n",
-    "cc = {\n",
-    "    'formulaType': 'DAY_SHORT_ACCURACY',\n",
-    "    'cap': '225',\n",
-    "    'province': 'E15',\n",
-    "    'electricType': 'E2',\n",
-    "    'stationCode': 'J00260' }\n",
-    "            \n",
-    "opt = argparse.Namespace(**cc)\n",
-    "\n",
-    "calculate_acc(df_tmp, opt)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 57,
-   "id": "abccb68a-cc63-4474-8167-ab1e01363ad2",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "      <th>predict</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>51</th>\n",
-       "      <td>66ecc86f1075358d129a1e72</td>\n",
-       "      <td>2024-05-05 21:30:00</td>\n",
-       "      <td>128.71</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.10</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.61</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6149</td>\n",
-       "      <td>58.2727</td>\n",
-       "      <td>...</td>\n",
-       "      <td>9.0536</td>\n",
-       "      <td>44.5345</td>\n",
-       "      <td>46.8773</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0082</td>\n",
-       "      <td>14.4073</td>\n",
-       "      <td>22.4573</td>\n",
-       "      <td>890.2109</td>\n",
-       "      <td>76.442233</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>52</th>\n",
-       "      <td>66ecc86f1075358d129a1e73</td>\n",
-       "      <td>2024-05-05 21:45:00</td>\n",
-       "      <td>129.84</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.34</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.70</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5280</td>\n",
-       "      <td>56.5700</td>\n",
-       "      <td>...</td>\n",
-       "      <td>8.3291</td>\n",
-       "      <td>43.2064</td>\n",
-       "      <td>45.5273</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0091</td>\n",
-       "      <td>14.1027</td>\n",
-       "      <td>23.0645</td>\n",
-       "      <td>890.3364</td>\n",
-       "      <td>75.284865</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>53</th>\n",
-       "      <td>66ecc86f1075358d129a1e74</td>\n",
-       "      <td>2024-05-05 22:00:00</td>\n",
-       "      <td>136.81</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>111.86</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>91.75</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5088</td>\n",
-       "      <td>55.0418</td>\n",
-       "      <td>...</td>\n",
-       "      <td>7.3591</td>\n",
-       "      <td>41.9909</td>\n",
-       "      <td>44.1800</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0100</td>\n",
-       "      <td>13.8064</td>\n",
-       "      <td>23.6636</td>\n",
-       "      <td>890.4555</td>\n",
-       "      <td>75.199564</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>3 rows × 35 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                         _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "51  66ecc86f1075358d129a1e72  2024-05-05 21:30:00  128.71       8.98  108.10   \n",
-       "52  66ecc86f1075358d129a1e73  2024-05-05 21:45:00  129.84       8.98  108.34   \n",
-       "53  66ecc86f1075358d129a1e74  2024-05-05 22:00:00  136.81       8.98  111.86   \n",
-       "\n",
-       "    实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-中云量  NWP-高云量  \\\n",
-       "51   -0.99  93.61       0.0       3.6149      58.2727  ...   9.0536  44.5345   \n",
-       "52   -0.99  92.70       0.0       3.5280      56.5700  ...   8.3291  43.2064   \n",
-       "53   -0.99  91.75       0.0       3.5088      55.0418  ...   7.3591  41.9909   \n",
-       "\n",
-       "    NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度    NWP-气压  \\\n",
-       "51  46.8773        0.0        0.0     0.0082  14.4073  22.4573  890.2109   \n",
-       "52  45.5273        0.0        0.0     0.0091  14.1027  23.0645  890.3364   \n",
-       "53  44.1800        0.0        0.0     0.0100  13.8064  23.6636  890.4555   \n",
-       "\n",
-       "      predict  \n",
-       "51  76.442233  \n",
-       "52  75.284865  \n",
-       "53  75.199564  \n",
-       "\n",
-       "[3 rows x 35 columns]"
-      ]
-     },
-     "execution_count": 57,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df[df['C_TIME'].str.contains('2024-05-05')]"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 56,
-   "id": "abf7687b-faf2-4b78-a9f2-44a2fea9daaa",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "      <th>predict</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>51</th>\n",
-       "      <td>66ecc86f1075358d129a1e72</td>\n",
-       "      <td>2024-05-05 21:30:00</td>\n",
-       "      <td>128.71</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.10</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.61</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6149</td>\n",
-       "      <td>58.2727</td>\n",
-       "      <td>...</td>\n",
-       "      <td>9.0536</td>\n",
-       "      <td>44.5345</td>\n",
-       "      <td>46.8773</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0082</td>\n",
-       "      <td>14.4073</td>\n",
-       "      <td>22.4573</td>\n",
-       "      <td>890.2109</td>\n",
-       "      <td>76.442233</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>52</th>\n",
-       "      <td>66ecc86f1075358d129a1e73</td>\n",
-       "      <td>2024-05-05 21:45:00</td>\n",
-       "      <td>129.84</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>108.34</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.70</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5280</td>\n",
-       "      <td>56.5700</td>\n",
-       "      <td>...</td>\n",
-       "      <td>8.3291</td>\n",
-       "      <td>43.2064</td>\n",
-       "      <td>45.5273</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0091</td>\n",
-       "      <td>14.1027</td>\n",
-       "      <td>23.0645</td>\n",
-       "      <td>890.3364</td>\n",
-       "      <td>75.284865</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>53</th>\n",
-       "      <td>66ecc86f1075358d129a1e74</td>\n",
-       "      <td>2024-05-05 22:00:00</td>\n",
-       "      <td>136.81</td>\n",
-       "      <td>8.98</td>\n",
-       "      <td>111.86</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>91.75</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.5088</td>\n",
-       "      <td>55.0418</td>\n",
-       "      <td>...</td>\n",
-       "      <td>7.3591</td>\n",
-       "      <td>41.9909</td>\n",
-       "      <td>44.1800</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0100</td>\n",
-       "      <td>13.8064</td>\n",
-       "      <td>23.6636</td>\n",
-       "      <td>890.4555</td>\n",
-       "      <td>75.199564</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>3 rows × 35 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                         _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "51  66ecc86f1075358d129a1e72  2024-05-05 21:30:00  128.71       8.98  108.10   \n",
-       "52  66ecc86f1075358d129a1e73  2024-05-05 21:45:00  129.84       8.98  108.34   \n",
-       "53  66ecc86f1075358d129a1e74  2024-05-05 22:00:00  136.81       8.98  111.86   \n",
-       "\n",
-       "    实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-中云量  NWP-高云量  \\\n",
-       "51   -0.99  93.61       0.0       3.6149      58.2727  ...   9.0536  44.5345   \n",
-       "52   -0.99  92.70       0.0       3.5280      56.5700  ...   8.3291  43.2064   \n",
-       "53   -0.99  91.75       0.0       3.5088      55.0418  ...   7.3591  41.9909   \n",
-       "\n",
-       "    NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度    NWP-气压  \\\n",
-       "51  46.8773        0.0        0.0     0.0082  14.4073  22.4573  890.2109   \n",
-       "52  45.5273        0.0        0.0     0.0091  14.1027  23.0645  890.3364   \n",
-       "53  44.1800        0.0        0.0     0.0100  13.8064  23.6636  890.4555   \n",
-       "\n",
-       "      predict  \n",
-       "51  76.442233  \n",
-       "52  75.284865  \n",
-       "53  75.199564  \n",
-       "\n",
-       "[3 rows x 35 columns]"
-      ]
-     },
-     "execution_count": 56,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df[df['C_TIME'].str.contains('2024-05-05')]"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "a3b9a9ca-6c1a-40c1-a9c4-f3500fcba937",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "208"
-      ]
-     },
-     "execution_count": 1,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": []
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 5
main.py

@@ -1,5 +0,0 @@
-import os
-
-# 获取当前工作目录
-current_dir = os.getcwd()
-data_file_path = current_dir /current_dir/ 'current_dirt'

+ 2 - 6
models_processing/model_prediction_lightgbm/model_prediction_lightgbm.py → models_processing/model_predict/model_prediction_lightgbm.py

@@ -1,11 +1,7 @@
-import lightgbm as lgb
-import argparse
-import pandas as pd 
-import numpy as np
+import pandas as pd
 from pymongo import MongoClient
 import pickle
-from flask import Flask,request,jsonify
-from waitress import serve
+from flask import Flask,request
 import time
 import logging
 import traceback

+ 0 - 16
models_processing/model_prediction_lightgbm/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "model_prediction_lightgbm.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 99
models_processing/model_prediction_lightgbm/.ipynb_checkpoints/model_prediction_lightgbm-checkpoint.py

@@ -1,99 +0,0 @@
-import lightgbm as lgb
-import argparse
-import pandas as pd 
-import numpy as np
-from pymongo import MongoClient
-import pickle
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import logging
-import traceback
-
-app = Flask('model_prediction_lightgbm——service')
-
-
-def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table,timeBegin,timeEnd = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table'],args['timeBegin'],args['timeEnd']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    collection = db[mongodb_read_table]  # 集合名称
-    query = {"dateTime": {"$gte": timeBegin, "$lte": timeEnd}}
-    cursor = collection.find(query)
-    data = list(cursor)
-    df = pd.DataFrame(data)
-    # 4. 删除 _id 字段(可选)
-    if '_id' in df.columns:
-        df = df.drop(columns=['_id'])
-    client.close()
-    return df
-    
-
-def insert_data_into_mongo(res_df,args):
-    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    if mongodb_write_table in db.list_collection_names():
-        db[mongodb_write_table].drop()
-        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
-    collection = db[mongodb_write_table]  # 集合名称
-    # 将 DataFrame 转为字典格式
-    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
-    # 插入到 MongoDB
-    collection.insert_many(data_dict)
-    print("data inserted successfully!")
-    
-
-def model_prediction(df,args):
-    mongodb_connection,mongodb_database,mongodb_model_table,model_name = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_model_table'],args['model_name']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    collection = db[mongodb_model_table]
-    model_data = collection.find_one({"model_name": model_name})
-    if model_data is not None:
-        model_binary = model_data['model']  # 确保这个字段是存储模型的二进制数据
-        # 反序列化模型 
-        model = pickle.loads(model_binary)
-        df['predict'] = model.predict(df[model.feature_name()])
-        print("model predict result  successfully!")
-    return df
-
-
-@app.route('/model_prediction_lightgbm', methods=['POST'])
-def model_prediction_lightgbm():
-    # 获取程序开始时间  
-    start_time = time.time()  
-    result = {}
-    success = 0
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print('args',args)
-        logger.info(args)
-        power_df = get_data_from_mongo(args)
-        model = model_prediction(power_df,args)
-        insert_data_into_mongo(model,args)
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-   
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    print("Program execution ends!")
-    return result
-
-
-if __name__=="__main__":  
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("model_prediction_lightgbm log")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10090)
-    print("server start!")
-    

+ 0 - 7
models_processing/model_prediction_lightgbm/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,7 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-lightgbm==4.3.0
-scikit-learn==1.4.2
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 490
models_processing/model_prediction_lightgbm/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,490 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import algo_test"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'_id': ObjectId('66ebba82a3b7dbe82538e34a'), 'name': 'Alice', 'age': 25, 'city': 'Beijing'}\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 使用 subprocess 执行 .py 文件\n",
-    "result = subprocess.run(['python', 'algo_test.py'], capture_output=True, text=True)\n",
-    "\n",
-    "# 打印输出\n",
-    "print(result.stdout)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "!pip freeze > requirements.txt"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]\n"
-     ]
-    }
-   ],
-   "source": [
-    "parser.add_argument('--mongodb_connection', type=str, required=True, help=\"mongodb连接\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_database', type=str, required=True, help=\"mongodb数据库名\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_read_table', type=str, required=True, help=\"mongodb数据库读取表\")# tmp_one\n",
-    "parser.add_argument('--mongodb_model_table', type=str, required=True, help=\"mongodb读取模型集合\")# tmp_one\n",
-    "parser.add_argument('--model_name', type=str, required=True, help=\"保存模型名\")# tmp_one\n",
-    "#出参\n",
-    "parser.add_argument('--mongodb_write_table', type=str, required=True, help=\"mongodb数据库存储集合\")# tmp_one"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 62,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(numerical_features=['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向', 'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向', 'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向', 'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向', 'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射', 'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'], categorical_features=[], label='实际功率', learning_rate=0.01, num_leaves=31, min_data_in_leaf=21, mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP_records', mongodb_write_table='models', model_name='lightgbm_model')\n",
-      "df:************                         _id               C_TIME  ...   NWP-湿度    NWP-气压\n",
-      "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  ...  23.4918  892.3327\n",
-      "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  ...  24.0436  892.3809\n",
-      "\n",
-      "[2 rows x 34 columns]\n",
-      "Starting training...\n",
-      "[LightGBM] [Info] Auto-choosing col-wise multi-threading, the overhead of testing was 0.000981 seconds.\n",
-      "You can set `force_col_wise=true` to remove the overhead.\n",
-      "[LightGBM] [Info] Total Bins 6885\n",
-      "[LightGBM] [Info] Number of data points in the train set: 7770, number of used features: 27\n",
-      "[LightGBM] [Info] Start training from score 47.616663\n",
-      "Training completed!\n",
-      "Collection 'models already exist, deleted successfully!\n",
-      "model inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"model_prediction.py\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_records\",\n",
-    "    \"--mongodb_model_table\", \"models\",\n",
-    "    \"--model_name\",\"lightgbm_model\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_records_predict\",\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "14a9feb4-5625-45d7-8e0f-6a8dea8c9f24",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run lightgbm_model.py   --numerical_features \"2024-05-01\"     --categorical_features \"2024-09-20\"   --label \"J00260\"     --learning_rate \"C_TIME\"    --num_leaves \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP_machines\"     --mongondb_write_table \"J00260NWP_records\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run lightgbm_model.py --numerical_features ','.join(['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向','NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向','NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向','NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向','NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射','NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'])  --categorical_features  ','.join([])  --label  \"实际功率\" --learning_rate  \"0.01\" --num_leaves \"31\"  --min_data_in_leaf  \"21\"  --mongodb_connection  \"mongodb://root:Jydl3377@192.168.1.33:27017\" --mongodb_database  \"algorithm_platform\" --mongodb_read_table  \"J00260NWP_records\" --mongodb_write_table  \"models\" --model_name \"lightgbm_model\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "9ca17599-e453-479c-a9b3-b1d15f2d54de",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "<lightgbm.basic.Booster at 0x16ab35646d0>"
-      ]
-     },
-     "execution_count": 2,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import lightgbm as lgb\n",
-    "import argparse\n",
-    "import pandas as pd \n",
-    "import numpy as np\n",
-    "from pymongo import MongoClient\n",
-    "import pickle\n",
-    "client = MongoClient(\"mongodb://root:Jydl3377@192.168.1.33:27017\")\n",
-    "db = client[\"algorithm_platform\"]\n",
-    "collection = db[\"models\"]\n",
-    "model_data = collection.find_one({\"model_name\": \"lightgbm_model\"})\n",
-    "if model_data is not None:\n",
-    "    # 假设模型存储在字段 'model' 中\n",
-    "    model_binary = model_data['model']  # 确保这个字段是存储模型的二进制数据\n",
-    "\n",
-    "    # 反序列化模型\n",
-    "    model = pickle.loads(model_binary)\n",
-    "model"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "ff940fec-55fd-4cbd-99ef-5564c6632efb",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-低云量</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>66ecc86f1075358d129a1d56</td>\n",
-       "      <td>2024-05-02 22:30:00</td>\n",
-       "      <td>130.05</td>\n",
-       "      <td>9.63</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.52</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6477</td>\n",
-       "      <td>202.7945</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0173</td>\n",
-       "      <td>20.2918</td>\n",
-       "      <td>20.3927</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>14.0818</td>\n",
-       "      <td>23.4918</td>\n",
-       "      <td>892.3327</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>66ecc86f1075358d129a1d57</td>\n",
-       "      <td>2024-05-02 22:45:00</td>\n",
-       "      <td>130.51</td>\n",
-       "      <td>9.72</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.24</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.9228</td>\n",
-       "      <td>202.6482</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0191</td>\n",
-       "      <td>20.3009</td>\n",
-       "      <td>20.3864</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>13.8264</td>\n",
-       "      <td>24.0436</td>\n",
-       "      <td>892.3809</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>2 rows × 34 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  130.05       9.63  104.76   \n",
-       "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  130.51       9.72  104.76   \n",
-       "\n",
-       "   实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-低云量  NWP-中云量  \\\n",
-       "0   -0.99  92.52       0.0       3.6477     202.7945  ...      0.0   0.0173   \n",
-       "1   -0.99  93.24       0.0       3.9228     202.6482  ...      0.0   0.0191   \n",
-       "\n",
-       "   NWP-高云量  NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度  \\\n",
-       "0  20.2918  20.3927        0.0        0.0        0.0  14.0818  23.4918   \n",
-       "1  20.3009  20.3864        0.0        0.0        0.0  13.8264  24.0436   \n",
-       "\n",
-       "     NWP-气压  \n",
-       "0  892.3327  \n",
-       "1  892.3809  \n",
-       "\n",
-       "[2 rows x 34 columns]"
-      ]
-     },
-     "execution_count": 3,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "\n",
-    "collection = db[\"J00260NWP_records\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "df.head(2)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "7feaff6d-e41a-4bd7-b6fb-a63fc6900cca",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "df['predict'] = model.predict(df[model.feature_name()])"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "id": "8a22f3e9-feff-438e-81e2-b5ceaa15ac48",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "      <th>predict</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>66ecc86f1075358d129a1d56</td>\n",
-       "      <td>2024-05-02 22:30:00</td>\n",
-       "      <td>130.05</td>\n",
-       "      <td>9.63</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.52</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6477</td>\n",
-       "      <td>202.7945</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0173</td>\n",
-       "      <td>20.2918</td>\n",
-       "      <td>20.3927</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>14.0818</td>\n",
-       "      <td>23.4918</td>\n",
-       "      <td>892.3327</td>\n",
-       "      <td>77.728147</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>66ecc86f1075358d129a1d57</td>\n",
-       "      <td>2024-05-02 22:45:00</td>\n",
-       "      <td>130.51</td>\n",
-       "      <td>9.72</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.24</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.9228</td>\n",
-       "      <td>202.6482</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0191</td>\n",
-       "      <td>20.3009</td>\n",
-       "      <td>20.3864</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>13.8264</td>\n",
-       "      <td>24.0436</td>\n",
-       "      <td>892.3809</td>\n",
-       "      <td>84.568199</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>2 rows × 35 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  130.05       9.63  104.76   \n",
-       "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  130.51       9.72  104.76   \n",
-       "\n",
-       "   实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-中云量  NWP-高云量  \\\n",
-       "0   -0.99  92.52       0.0       3.6477     202.7945  ...   0.0173  20.2918   \n",
-       "1   -0.99  93.24       0.0       3.9228     202.6482  ...   0.0191  20.3009   \n",
-       "\n",
-       "   NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度    NWP-气压  \\\n",
-       "0  20.3927        0.0        0.0        0.0  14.0818  23.4918  892.3327   \n",
-       "1  20.3864        0.0        0.0        0.0  13.8264  24.0436  892.3809   \n",
-       "\n",
-       "     predict  \n",
-       "0  77.728147  \n",
-       "1  84.568199  \n",
-       "\n",
-       "[2 rows x 35 columns]"
-      ]
-     },
-     "execution_count": 6,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df.head(2)"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
models_processing/model_prediction_lightgbm/Dockerfile

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "model_prediction_lightgbm.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 7
models_processing/model_prediction_lightgbm/requirements.txt

@@ -1,7 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-lightgbm==4.3.0
-scikit-learn==1.4.2
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 537
models_processing/model_prediction_lightgbm/test.ipynb

@@ -1,537 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import algo_test"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'_id': ObjectId('66ebba82a3b7dbe82538e34a'), 'name': 'Alice', 'age': 25, 'city': 'Beijing'}\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 使用 subprocess 执行 .py 文件\n",
-    "result = subprocess.run(['python', 'algo_test.py'], capture_output=True, text=True)\n",
-    "\n",
-    "# 打印输出\n",
-    "print(result.stdout)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "!pip freeze > requirements.txt"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]\n"
-     ]
-    }
-   ],
-   "source": [
-    "parser.add_argument('--mongodb_connection', type=str, required=True, help=\"mongodb连接\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_database', type=str, required=True, help=\"mongodb数据库名\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_read_table', type=str, required=True, help=\"mongodb数据库读取表\")# tmp_one\n",
-    "parser.add_argument('--mongodb_model_table', type=str, required=True, help=\"mongodb读取模型集合\")# tmp_one\n",
-    "parser.add_argument('--model_name', type=str, required=True, help=\"保存模型名\")# tmp_one\n",
-    "#出参\n",
-    "parser.add_argument('--mongodb_write_table', type=str, required=True, help=\"mongodb数据库存储集合\")# tmp_one"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 9,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP_records', mongodb_model_table='models', model_name='lightgbm_model', mongodb_write_table='J00260NWP_records_predict')\n",
-      "model predict result  successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"model_prediction.py\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_records\",\n",
-    "    \"--mongodb_model_table\", \"models\",\n",
-    "    \"--model_name\",\"lightgbm_model\",\n",
-    "    \"--mongodb_write_table\", \"J00260NWP_records_predict\",\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "14a9feb4-5625-45d7-8e0f-6a8dea8c9f24",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run model_prediction_lightgbm  --mongodb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongodb_database \"algorithm_platform\"   --mongodb_read_table \"J00260NWP_records\"     --mongodb_model_table \"models\"    --model_name \"lightgbm_model\"     --mongodb_database \"algorithm_platform\"     --mongodb_write_table \"J00260NWP_records_predict\"      "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run lightgbm_model.py --numerical_features ','.join(['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向','NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向','NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向','NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向','NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射','NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'])  --categorical_features  ','.join([])  --label  \"实际功率\" --learning_rate  \"0.01\" --num_leaves \"31\"  --min_data_in_leaf  \"21\"  --mongodb_connection  \"mongodb://root:Jydl3377@192.168.1.33:27017\" --mongodb_database  \"algorithm_platform\" --mongodb_read_table  \"J00260NWP_records\" --mongodb_write_table  \"models\" --model_name \"lightgbm_model\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "6d13761d-3ba7-441c-903d-db293ab23223",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 15:58:04,711 - waitress - INFO - Serving on http://0.0.0.0:10090\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 16:00:49,195 - model_prediction_lightgbm log - INFO - {'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_statistics', 'mongodb_model_table': 'models', 'mongodb_write_table': 'j00629_copy_statistics_predict', 'model_name': 'lightgbm_model', 'timeBegin': '2024-09-01 00:00:00', 'timeEnd': '2024-09-04 23:45:00'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_statistics', 'mongodb_model_table': 'models', 'mongodb_write_table': 'j00629_copy_statistics_predict', 'model_name': 'lightgbm_model', 'timeBegin': '2024-09-01 00:00:00', 'timeEnd': '2024-09-04 23:45:00'}\n",
-      "model predict result  successfully!\n",
-      "data inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 16:42:24,465 - model_prediction_lightgbm log - INFO - {'formulaType': 'DAY_SHORT_ACCURACY', 'cap': '225', 'province': 'E46', 'electricType': 'E1', 'stationCode': 'J00629', 'col_time': 'dateTime', 'col_rp': \"'realPower'\", 'col_pp': 'predict', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_statistics_predict', 'mongodb_write_table': 'j00629_copy_statistics_predict_accuracy'}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'formulaType': 'DAY_SHORT_ACCURACY', 'cap': '225', 'province': 'E46', 'electricType': 'E1', 'stationCode': 'J00629', 'col_time': 'dateTime', 'col_rp': \"'realPower'\", 'col_pp': 'predict', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_statistics_predict', 'mongodb_write_table': 'j00629_copy_statistics_predict_accuracy'}\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    " %run model_prediction_lightgbm.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "id": "9ca17599-e453-479c-a9b3-b1d15f2d54de",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "<lightgbm.basic.Booster at 0x16ab35646d0>"
-      ]
-     },
-     "execution_count": 2,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "import lightgbm as lgb\n",
-    "import argparse\n",
-    "import pandas as pd \n",
-    "import numpy as np\n",
-    "from pymongo import MongoClient\n",
-    "import pickle\n",
-    "client = MongoClient(\"mongodb://root:Jydl3377@192.168.1.33:27017\")\n",
-    "db = client[\"algorithm_platform\"]\n",
-    "collection = db[\"models\"]\n",
-    "model_data = collection.find_one({\"model_name\": \"lightgbm_model\"})\n",
-    "if model_data is not None:\n",
-    "    # 假设模型存储在字段 'model' 中\n",
-    "    model_binary = model_data['model']  # 确保这个字段是存储模型的二进制数据\n",
-    "\n",
-    "    # 反序列化模型\n",
-    "    model = pickle.loads(model_binary)\n",
-    "model"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 10,
-   "id": "ff940fec-55fd-4cbd-99ef-5564c6632efb",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "      <th>predict</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>66ecc86f1075358d129a1d56</td>\n",
-       "      <td>2024-05-02 22:30:00</td>\n",
-       "      <td>130.05</td>\n",
-       "      <td>9.63</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.52</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6477</td>\n",
-       "      <td>202.7945</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0173</td>\n",
-       "      <td>20.2918</td>\n",
-       "      <td>20.3927</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>14.0818</td>\n",
-       "      <td>23.4918</td>\n",
-       "      <td>892.3327</td>\n",
-       "      <td>77.728147</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>66ecc86f1075358d129a1d57</td>\n",
-       "      <td>2024-05-02 22:45:00</td>\n",
-       "      <td>130.51</td>\n",
-       "      <td>9.72</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.24</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.9228</td>\n",
-       "      <td>202.6482</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0191</td>\n",
-       "      <td>20.3009</td>\n",
-       "      <td>20.3864</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>13.8264</td>\n",
-       "      <td>24.0436</td>\n",
-       "      <td>892.3809</td>\n",
-       "      <td>84.568199</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>2 rows × 35 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  130.05       9.63  104.76   \n",
-       "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  130.51       9.72  104.76   \n",
-       "\n",
-       "   实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-中云量  NWP-高云量  \\\n",
-       "0   -0.99  92.52       0.0       3.6477     202.7945  ...   0.0173  20.2918   \n",
-       "1   -0.99  93.24       0.0       3.9228     202.6482  ...   0.0191  20.3009   \n",
-       "\n",
-       "   NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度    NWP-气压  \\\n",
-       "0  20.3927        0.0        0.0        0.0  14.0818  23.4918  892.3327   \n",
-       "1  20.3864        0.0        0.0        0.0  13.8264  24.0436  892.3809   \n",
-       "\n",
-       "     predict  \n",
-       "0  77.728147  \n",
-       "1  84.568199  \n",
-       "\n",
-       "[2 rows x 35 columns]"
-      ]
-     },
-     "execution_count": 10,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "\n",
-    "collection = db[\"J00260NWP_records_predict\"]  # 集合名称\n",
-    "data_from_db = collection.find()  # 这会返回一个游标(cursor)\n",
-    "# 将游标转换为列表,并创建 pandas DataFrame\n",
-    "df = pd.DataFrame(list(data_from_db))\n",
-    "df.head(2)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "7feaff6d-e41a-4bd7-b6fb-a63fc6900cca",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "df['predict'] = model.predict(df[model.feature_name()])"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "id": "8a22f3e9-feff-438e-81e2-b5ceaa15ac48",
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>_id</th>\n",
-       "      <th>C_TIME</th>\n",
-       "      <th>理论功率</th>\n",
-       "      <th>第1个设备轮毂风速</th>\n",
-       "      <th>实际功率</th>\n",
-       "      <th>实时环境数据</th>\n",
-       "      <th>预测功率</th>\n",
-       "      <th>NWP预测总辐射</th>\n",
-       "      <th>NWP-10米预测风速</th>\n",
-       "      <th>NWP-10米预测风向</th>\n",
-       "      <th>...</th>\n",
-       "      <th>NWP-中云量</th>\n",
-       "      <th>NWP-高云量</th>\n",
-       "      <th>NWP-总云量</th>\n",
-       "      <th>NWP-晴空总辐射</th>\n",
-       "      <th>NWP-法相直辐射</th>\n",
-       "      <th>NWP-总降水强度</th>\n",
-       "      <th>NWP-温度</th>\n",
-       "      <th>NWP-湿度</th>\n",
-       "      <th>NWP-气压</th>\n",
-       "      <th>predict</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>66ecc86f1075358d129a1d56</td>\n",
-       "      <td>2024-05-02 22:30:00</td>\n",
-       "      <td>130.05</td>\n",
-       "      <td>9.63</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>92.52</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.6477</td>\n",
-       "      <td>202.7945</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0173</td>\n",
-       "      <td>20.2918</td>\n",
-       "      <td>20.3927</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>14.0818</td>\n",
-       "      <td>23.4918</td>\n",
-       "      <td>892.3327</td>\n",
-       "      <td>77.728147</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>66ecc86f1075358d129a1d57</td>\n",
-       "      <td>2024-05-02 22:45:00</td>\n",
-       "      <td>130.51</td>\n",
-       "      <td>9.72</td>\n",
-       "      <td>104.76</td>\n",
-       "      <td>-0.99</td>\n",
-       "      <td>93.24</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>3.9228</td>\n",
-       "      <td>202.6482</td>\n",
-       "      <td>...</td>\n",
-       "      <td>0.0191</td>\n",
-       "      <td>20.3009</td>\n",
-       "      <td>20.3864</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>0.0</td>\n",
-       "      <td>13.8264</td>\n",
-       "      <td>24.0436</td>\n",
-       "      <td>892.3809</td>\n",
-       "      <td>84.568199</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>2 rows × 35 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "                        _id               C_TIME    理论功率  第1个设备轮毂风速    实际功率  \\\n",
-       "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  130.05       9.63  104.76   \n",
-       "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  130.51       9.72  104.76   \n",
-       "\n",
-       "   实时环境数据   预测功率  NWP预测总辐射  NWP-10米预测风速  NWP-10米预测风向  ...  NWP-中云量  NWP-高云量  \\\n",
-       "0   -0.99  92.52       0.0       3.6477     202.7945  ...   0.0173  20.2918   \n",
-       "1   -0.99  93.24       0.0       3.9228     202.6482  ...   0.0191  20.3009   \n",
-       "\n",
-       "   NWP-总云量  NWP-晴空总辐射  NWP-法相直辐射  NWP-总降水强度   NWP-温度   NWP-湿度    NWP-气压  \\\n",
-       "0  20.3927        0.0        0.0        0.0  14.0818  23.4918  892.3327   \n",
-       "1  20.3864        0.0        0.0        0.0  13.8264  24.0436  892.3809   \n",
-       "\n",
-       "     predict  \n",
-       "0  77.728147  \n",
-       "1  84.568199  \n",
-       "\n",
-       "[2 rows x 35 columns]"
-      ]
-     },
-     "execution_count": 6,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "df.head(2)"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 6 - 6
models_processing/model_training_lighgbm/model_training_lightgbm.py → models_processing/model_train/model_training_lightgbm.py

@@ -1,20 +1,18 @@
 import lightgbm as lgb
-import argparse
 import pandas as pd 
 import numpy as np
 from pymongo import MongoClient
 import pickle
 from sklearn.model_selection import train_test_split
-from sklearn.metrics import mean_squared_error,mean_absolute_error,r2_score
-from flask import Flask,request,jsonify
-from waitress import serve
+from sklearn.metrics import mean_squared_error,mean_absolute_error
+from flask import Flask,request
 import time
-import logging
 import traceback
+import logging
 
 app = Flask('model_training_lightgbm——service')
 def get_data_from_mongo(args):
-     mongodb_connection,mongodb_database,mongodb_read_table,timeBegin,timeEnd = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table'],args['timeBegin'],args['timeEnd']
+    mongodb_connection,mongodb_database,mongodb_read_table,timeBegin,timeEnd = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table'],args['timeBegin'],args['timeEnd']
     client = MongoClient(mongodb_connection)
     # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
     db = client[mongodb_database]
@@ -86,12 +84,14 @@ def build_model(df,args):
     print('Training completed!')
     return model_data
 
+
 def str_to_list(arg):
     if arg == '':
         return []
     else:
         return arg.split(',')
 
+
 @app.route('/model_training_lightgbm', methods=['POST'])
 def model_training_lightgbm():
     # 获取程序开始时间  

+ 0 - 16
models_processing/model_training_lighgbm/.ipynb_checkpoints/Dockerfile-checkpoint

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "model_training_lightgbm.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 130
models_processing/model_training_lighgbm/.ipynb_checkpoints/model_training_lightgbm-checkpoint.py

@@ -1,130 +0,0 @@
-import lightgbm as lgb
-import argparse
-import pandas as pd 
-import numpy as np
-from pymongo import MongoClient
-import pickle
-from sklearn.model_selection import train_test_split
-from sklearn.metrics import mean_squared_error,mean_absolute_error,r2_score
-from flask import Flask,request,jsonify
-from waitress import serve
-import time
-import logging
-import traceback
-
-app = Flask('model_training_lightgbm——service')
-def get_data_from_mongo(args):
-     mongodb_connection,mongodb_database,mongodb_read_table,timeBegin,timeEnd = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table'],args['timeBegin'],args['timeEnd']
-    client = MongoClient(mongodb_connection)
-    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
-    db = client[mongodb_database]
-    collection = db[mongodb_read_table]  # 集合名称
-    query = {"dateTime": {"$gte": timeBegin, "$lte": timeEnd}}
-    cursor = collection.find(query)
-    data = list(cursor)
-    df = pd.DataFrame(data)
-    # 4. 删除 _id 字段(可选)
-    if '_id' in df.columns:
-        df = df.drop(columns=['_id'])
-    client.close()
-    return df
-    
-
-def insert_model_into_mongo(model_data,args):
-    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
-    client = MongoClient(mongodb_connection)
-    db = client[mongodb_database]
-    if mongodb_write_table in db.list_collection_names():
-        db[mongodb_write_table].drop()
-        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
-    collection = db[mongodb_write_table]  # 集合名称
-    collection.insert_one(model_data)
-    print("model inserted successfully!")
-
-
-def build_model(df,args):
-    np.random.seed(42)
-    #lightgbm预测下
-    numerical_features,categorical_features,label,model_name,num_boost_round,model_params = str_to_list(args['numerical_features']),str_to_list(args['categorical_features']),args['label'],args['model_name'],int(args['num_boost_round']),eval(args['model_params'])
-    features = numerical_features+categorical_features
-    print("features:************",features)
-    # 拆分数据为训练集和测试集
-    X_train, X_test, y_train, y_test = train_test_split(df[features], df[label], test_size=0.2, random_state=42)
-    # 创建LightGBM数据集
-    lgb_train = lgb.Dataset(X_train, y_train,categorical_feature=categorical_features)
-    lgb_eval = lgb.Dataset(X_test, y_test, reference=lgb_train)
-    # 设置参数
-    params = {
-        'objective': 'regression',
-        'metric': 'rmse',
-        'boosting_type': 'gbdt',
-        'verbose':1
-    }
-
-    merged_param = params | model_params
-    # 训练模型
-    print('Starting training...')
-    gbm = lgb.train(merged_param,
-                    lgb_train,
-                    num_boost_round=num_boost_round,
-                    valid_sets=[lgb_train, lgb_eval],
-                    )
-    y_pred = gbm.predict(X_test, num_iteration=gbm.best_iteration)
-
-    # 评估
-    mse = mean_squared_error(y_test, y_pred)
-    rmse = np.sqrt(mse)
-    mae = mean_absolute_error(y_test, y_pred)
-    print(f'The test rmse is: {rmse},"The test mae is:"{mae}')
-    
-    # 序列化模型
-    model_bytes = pickle.dumps(gbm)
-    model_data = {
-                'model_name': model_name,
-                'model': model_bytes,     #将模型字节流存入数据库
-        }
-    print('Training completed!')
-    return model_data
-
-def str_to_list(arg):
-    if arg == '':
-        return []
-    else:
-        return arg.split(',')
-
-@app.route('/model_training_lightgbm', methods=['POST'])
-def model_training_lightgbm():
-    # 获取程序开始时间  
-    start_time = time.time()  
-    result = {}
-    success = 0
-    print("Program starts execution!")
-    try:
-        args = request.values.to_dict()
-        print('args',args)
-        logger.info(args)
-        power_df = get_data_from_mongo(args)
-        model = build_model(power_df,args)
-        insert_model_into_mongo(model,args)
-        success = 1
-    except Exception as e:
-        my_exception = traceback.format_exc()
-        my_exception.replace("\n","\t")
-        result['msg'] = my_exception
-    end_time = time.time() 
-   
-    result['success'] = success
-    result['args'] = args
-    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
-    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
-    print("Program execution ends!")
-    return result
-
-
-if __name__=="__main__":  
-    print("Program starts execution!")
-    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("model_training_lightgbm log")
-    from waitress import serve
-    serve(app, host="0.0.0.0", port=10089)
-    print("server start!")

+ 0 - 7
models_processing/model_training_lighgbm/.ipynb_checkpoints/requirements-checkpoint.txt

@@ -1,7 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-lightgbm==4.3.0
-scikit-learn==1.4.2
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 179
models_processing/model_training_lighgbm/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -1,179 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import algo_test"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'_id': ObjectId('66ebba82a3b7dbe82538e34a'), 'name': 'Alice', 'age': 25, 'city': 'Beijing'}\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 使用 subprocess 执行 .py 文件\n",
-    "result = subprocess.run(['python', 'algo_test.py'], capture_output=True, text=True)\n",
-    "\n",
-    "# 打印输出\n",
-    "print(result.stdout)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "!pip freeze > requirements.txt"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]\n"
-     ]
-    }
-   ],
-   "source": [
-    "parser.add_argument('--numerical_features', type=str, required=True, help=\"数值型特征\") \n",
-    "parser.add_argument('--categorical_features', type=str, required=True, help=\"类别型特征\")\n",
-    "parser.add_argument('--learning_rate', type=float, required=True, help=\"学习率\")\n",
-    "parser.add_argument('--num_leaves', type=int, required=True, help=\"叶子节点数\")\n",
-    "parser.add_argument('--min_data_in_leaf', type=int, required=True, help=\"叶子节点最小数据量\")# mongodb://root:Jydl3377@192.168.1.33:27017\n",
-    "parser.add_argument('--mongodb_connection', type=str, required=True, help=\"mongodb连接\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_database', type=str, required=True, help=\"mongodb数据库名\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_read_table', type=str, required=True, help=\"mongodb数据库读取表\")# tmp_one"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 62,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(numerical_features=['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向', 'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向', 'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向', 'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向', 'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射', 'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'], categorical_features=[], label='实际功率', learning_rate=0.01, num_leaves=31, min_data_in_leaf=21, mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP_records', mongodb_write_table='models', model_name='lightgbm_model')\n",
-      "df:************                         _id               C_TIME  ...   NWP-湿度    NWP-气压\n",
-      "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  ...  23.4918  892.3327\n",
-      "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  ...  24.0436  892.3809\n",
-      "\n",
-      "[2 rows x 34 columns]\n",
-      "Starting training...\n",
-      "[LightGBM] [Info] Auto-choosing col-wise multi-threading, the overhead of testing was 0.000981 seconds.\n",
-      "You can set `force_col_wise=true` to remove the overhead.\n",
-      "[LightGBM] [Info] Total Bins 6885\n",
-      "[LightGBM] [Info] Number of data points in the train set: 7770, number of used features: 27\n",
-      "[LightGBM] [Info] Start training from score 47.616663\n",
-      "Training completed!\n",
-      "Collection 'models already exist, deleted successfully!\n",
-      "model inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"lightgbm_model.py\",\n",
-    "    \"--numerical_features\", ','.join(['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向','NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', \n",
-    "                             'NWP-70米预测风向','NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向','NWP-150米预测风速', 'NWP-150米预测风向', \n",
-    "                             'NWP-170米预测风速', 'NWP-170米预测风向','NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射','NWP-总降水强度', \n",
-    "                             'NWP-温度', 'NWP-湿度', 'NWP-气压']),\n",
-    "    \"--categorical_features\", ','.join([]),\n",
-    "    \"--label\", \"实际功率\",\n",
-    "    \"--learning_rate\", \"0.01\",\n",
-    "    \"--num_leaves\", \"31\",\n",
-    "    \"--min_data_in_leaf\", \"21\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_records\",\n",
-    "    \"--mongodb_write_table\", \"models\",\n",
-    "    \"--model_name\",\"lightgbm_model\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "14a9feb4-5625-45d7-8e0f-6a8dea8c9f24",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run processing_limit_power_by_records   --timeBegin \"2024-05-01\"     --timeEnd \"2024-09-20\"   --station_code \"J00260\"     --col_time \"C_TIME\"    --mongondb_connection \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP_machines\"     --mongondb_write_table \"J00260NWP_records\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 0 - 16
models_processing/model_training_lighgbm/Dockerfile

@@ -1,16 +0,0 @@
-# 使用官方 Python 镜像作为基础镜像
-FROM 192.168.1.36:5000/python:3.9
-ENV LANG=en_US.UTF-8
-# 设置工作目录
-WORKDIR /app
-
-# 复制当前目录内容到工作目录
-COPY . /app
-
-# 安装依赖项(如果有)
-RUN set -ex \
-    && pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-# 设置 ENTRYPOINT 为 Python 脚本
-ENTRYPOINT ["python", "model_training_lightgbm.py"]
-# 执行 Python 脚本
-CMD []

+ 0 - 7
models_processing/model_training_lighgbm/requirements.txt

@@ -1,7 +0,0 @@
-pymongo==4.9.1
-pandas==2.1.4
-numpy==1.26.4
-lightgbm==4.3.0
-scikit-learn==1.4.2
-Flask==3.0.3
-waitress==3.0.0

+ 0 - 334
models_processing/model_training_lighgbm/test.ipynb

@@ -1,334 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "660798fa-cf08-4cfd-b553-c6d750d7e7ad",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import algo_test"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "id": "ff42670b-301d-4ee1-8da2-6a658fc5f286",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'_id': ObjectId('66ebba82a3b7dbe82538e34a'), 'name': 'Alice', 'age': 25, 'city': 'Beijing'}\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 使用 subprocess 执行 .py 文件\n",
-    "result = subprocess.run(['python', 'algo_test.py'], capture_output=True, text=True)\n",
-    "\n",
-    "# 打印输出\n",
-    "print(result.stdout)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "b47d615a-5953-43c0-9289-387d5c823a7a",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 16:09:24,040 - waitress - INFO - Serving on http://0.0.0.0:10090\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 16:11:05,381 - model_training_lightgbm log - INFO - {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度, NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ''}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度, NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ''}\n",
-      "features:************ ['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向', 'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向', 'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向', 'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向', 'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射', 'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', ' NWP-气压']\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 16:11:46,517 - model_training_lightgbm log - INFO - {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度,NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ''}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度,NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ''}\n",
-      "features:************ ['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向', 'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向', 'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向', 'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向', 'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射', 'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压']\n",
-      "Starting training...\n",
-      "Training completed!\n",
-      "Collection 'models already exist, deleted successfully!\n",
-      "model inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 16:11:57,030 - model_training_lightgbm log - INFO - {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度,NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ' '}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度,NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ' '}\n",
-      "features:************ ['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向', 'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向', 'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向', 'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向', 'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射', 'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压', ' ']\n",
-      "Program execution ends!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 16:12:20,633 - model_training_lightgbm log - INFO - {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度,NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': \"''\"}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'numerical_features': 'NWP预测总辐射,NWP-10米预测风速,NWP-10米预测风向,NWP-30米预测风速,NWP-30米预测风向,NWP-50米预测风速,NWP-50米预测风向,NWP-70米预测风速,NWP-70米预测风向,NWP-90米预测风速,NWP-90米预测风向,NWP-110米预测风速,NWP-110米预测风向,NWP-150米预测风速,NWP-150米预测风向,NWP-170米预测风速,NWP-170米预测风向,NWP-低云量,NWP-中云量,NWP-高云量,NWP-总云量,NWP-晴空总辐射,NWP-法相直辐射,NWP-总降水强度,NWP-温度,NWP-湿度,NWP-气压', 'label': '实际功率', 'learning_rate': '0.01', 'num_leaves': '31', 'min_data_in_leaf': '21', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'col_pp': 'predict', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': \"''\"}\n",
-      "features:************ ['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向', 'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向', 'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向', 'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向', 'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射', 'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压', \"''\"]\n",
-      "Program execution ends!\n",
-      "server start!\n"
-     ]
-    }
-   ],
-   "source": [
-    " %run model_training_lightgbm.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]\n"
-     ]
-    }
-   ],
-   "source": [
-    "parser.add_argument('--numerical_features', type=str, required=True, help=\"数值型特征\") \n",
-    "parser.add_argument('--categorical_features', type=str, required=True, help=\"类别型特征\")\n",
-    "parser.add_argument('--learning_rate', type=float, required=True, help=\"学习率\")\n",
-    "parser.add_argument('--num_leaves', type=int, required=True, help=\"叶子节点数\")\n",
-    "parser.add_argument('--min_data_in_leaf', type=int, required=True, help=\"叶子节点最小数据量\")# mongodb://root:Jydl3377@192.168.1.33:27017\n",
-    "parser.add_argument('--mongodb_connection', type=str, required=True, help=\"mongodb连接\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_database', type=str, required=True, help=\"mongodb数据库名\")# algorithm_platform\n",
-    "parser.add_argument('--mongodb_read_table', type=str, required=True, help=\"mongodb数据库读取表\")# tmp_one"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 62,
-   "id": "acc6aa2a-0f1d-43f3-985d-cd37c4a5ac6e",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Output:\n",
-      "Program starts execution!\n",
-      "args: Namespace(numerical_features=['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向', 'NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向', 'NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向', 'NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向', 'NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射', 'NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'], categorical_features=[], label='实际功率', learning_rate=0.01, num_leaves=31, min_data_in_leaf=21, mongodb_connection='mongodb://root:Jydl3377@192.168.1.33:27017', mongodb_database='algorithm_platform', mongodb_read_table='J00260NWP_records', mongodb_write_table='models', model_name='lightgbm_model')\n",
-      "df:************                         _id               C_TIME  ...   NWP-湿度    NWP-气压\n",
-      "0  66ecc86f1075358d129a1d56  2024-05-02 22:30:00  ...  23.4918  892.3327\n",
-      "1  66ecc86f1075358d129a1d57  2024-05-02 22:45:00  ...  24.0436  892.3809\n",
-      "\n",
-      "[2 rows x 34 columns]\n",
-      "Starting training...\n",
-      "[LightGBM] [Info] Auto-choosing col-wise multi-threading, the overhead of testing was 0.000981 seconds.\n",
-      "You can set `force_col_wise=true` to remove the overhead.\n",
-      "[LightGBM] [Info] Total Bins 6885\n",
-      "[LightGBM] [Info] Number of data points in the train set: 7770, number of used features: 27\n",
-      "[LightGBM] [Info] Start training from score 47.616663\n",
-      "Training completed!\n",
-      "Collection 'models already exist, deleted successfully!\n",
-      "model inserted successfully!\n",
-      "Program execution ends!\n",
-      "\n",
-      "Error:\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "import subprocess\n",
-    "\n",
-    "# 构建命令\n",
-    "command = [\n",
-    "    \"python\", \"lightgbm_model.py\",\n",
-    "    \"--numerical_features\", ','.join(['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向','NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', \n",
-    "                             'NWP-70米预测风向','NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向','NWP-150米预测风速', 'NWP-150米预测风向', \n",
-    "                             'NWP-170米预测风速', 'NWP-170米预测风向','NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射','NWP-总降水强度', \n",
-    "                             'NWP-温度', 'NWP-湿度', 'NWP-气压']),\n",
-    "    \"--categorical_features\", ','.join([]),\n",
-    "    \"--label\", \"实际功率\",\n",
-    "    \"--learning_rate\", \"0.01\",\n",
-    "    \"--num_leaves\", \"31\",\n",
-    "    \"--min_data_in_leaf\", \"21\",\n",
-    "    \"--mongodb_connection\", \"mongodb://root:Jydl3377@192.168.1.33:27017\",\n",
-    "    \"--mongodb_database\", \"algorithm_platform\",\n",
-    "    \"--mongodb_read_table\", \"J00260NWP_records\",\n",
-    "    \"--mongodb_write_table\", \"models\",\n",
-    "    \"--model_name\",\"lightgbm_model\"\n",
-    "]\n",
-    "\n",
-    "# 使用 subprocess.run 来执行命令\n",
-    "result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
-    "\n",
-    "# 输出结果和错误信息\n",
-    "print(\"Output:\")\n",
-    "print(result.stdout)\n",
-    "print(\"Error:\")\n",
-    "print(result.stderr)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "14a9feb4-5625-45d7-8e0f-6a8dea8c9f24",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run lightgbm_model.py   --numerical_features \"2024-05-01\"     --categorical_features \"2024-09-20\"   --label \"J00260\"     --learning_rate \"C_TIME\"    --num_leaves \"mongodb://root:Jydl3377@192.168.1.33:27017\"     --mongondb_database \"algorithm_platform\"     --mongondb_read_table \"J00260NWP_machines\"     --mongondb_write_table \"J00260NWP_records\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "c0d791f8-12d8-4ab9-b561-b474e2a739f0",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "docker run lightgbm_model.py --numerical_features ','.join(['NWP预测总辐射', 'NWP-10米预测风速', 'NWP-10米预测风向', 'NWP-30米预测风速', 'NWP-30米预测风向','NWP-50米预测风速', 'NWP-50米预测风向', 'NWP-70米预测风速', 'NWP-70米预测风向','NWP-90米预测风速', 'NWP-90米预测风向', 'NWP-110米预测风速', 'NWP-110米预测风向','NWP-150米预测风速', 'NWP-150米预测风向', 'NWP-170米预测风速', 'NWP-170米预测风向','NWP-低云量', 'NWP-中云量', 'NWP-高云量', 'NWP-总云量', 'NWP-晴空总辐射', 'NWP-法相直辐射','NWP-总降水强度', 'NWP-温度', 'NWP-湿度', 'NWP-气压'])  --categorical_features  ','.join([])  --label  \"实际功率\" --learning_rate  \"0.01\" --num_leaves \"31\"  --min_data_in_leaf  \"21\"  --mongodb_connection  \"mongodb://root:Jydl3377@192.168.1.33:27017\" --mongodb_database  \"algorithm_platform\" --mongodb_read_table  \"J00260NWP_records\" --mongodb_write_table  \"models\" --model_name \"lightgbm_model\""
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "8bdd9bd2-4373-4465-b20a-de574fb29436",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 14:54:47,009 - waitress - INFO - Serving on http://0.0.0.0:10089\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n"
-     ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-11-21 14:54:51,021 - model_training_lightgbm log - INFO - {'numerical_features': 'temperature2,direction10,speed10,mcc,solarZenith,dniCalcd,humidity2,hcc,clearskyGhi,lcc,tcc,surfacePressure,tpr,radiation', 'label': 'realPower', 'model_params': \"{'num_leaves': 31,         'learning_rate': 0.1,         'min_data_in_leaf': 21}\", 'num_boost_round': '500', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_statistics', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ''}\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Program starts execution!\n",
-      "args {'numerical_features': 'temperature2,direction10,speed10,mcc,solarZenith,dniCalcd,humidity2,hcc,clearskyGhi,lcc,tcc,surfacePressure,tpr,radiation', 'label': 'realPower', 'model_params': \"{'num_leaves': 31,         'learning_rate': 0.1,         'min_data_in_leaf': 21}\", 'num_boost_round': '500', 'mongodb_database': 'db2', 'mongodb_read_table': 'j00629_copy_statistics', 'mongodb_write_table': 'models', 'model_name': 'lightgbm_model', 'categorical_features': ''}\n",
-      "features:************ ['temperature2', 'direction10', 'speed10', 'mcc', 'solarZenith', 'dniCalcd', 'humidity2', 'hcc', 'clearskyGhi', 'lcc', 'tcc', 'surfacePressure', 'tpr', 'radiation']\n",
-      "Starting training...\n",
-      "The test rmse is: 7.095613313100767,\"The test mae is:\"3.0062923664706886\n",
-      "Training completed!\n",
-      "Collection 'models already exist, deleted successfully!\n",
-      "model inserted successfully!\n",
-      "Program execution ends!\n"
-     ]
-    }
-   ],
-   "source": [
-    " %run model_training_lightgbm.py"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "id": "5ae69d4d-fa6e-4a26-95a4-232b55e469b8",
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'a': 1, 'b': 3, 'c': 4}\n"
-     ]
-    }
-   ],
-   "source": [
-    "temperature2,direction10,speed10,mcc,solarZenith,dniCalcd,humidity2,hcc,clearskyGhi,lcc,tcc,surfacePressure,tpr,radiation"
-   ]
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python (panddlets)",
-   "language": "python",
-   "name": "panddlets"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.19"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 13 - 0
requirements.txt

@@ -0,0 +1,13 @@
+pymongo==4.7.3
+pandas==1.3.5
+SQLAlchemy==1.4.46
+PyMySQL==1.1.1
+Flask==2.2.5
+waitress==2.1.2
+numpy==1.19.5
+matplotlib==3.5.3
+requests==2.31.0
+numpy== 1.19.5
+scikit-learn== 1.0.2
+plotly==5.18.0
+lightgbm==4.5.0

+ 24 - 0
run_all.py

@@ -0,0 +1,24 @@
+import subprocess
+
+# 定义要启动的应用及其路径和端口
+services = [
+    ("data_processing/processing_limit_power/processing_limit_power_by_agcavc.py", 10086),
+    ("data_processing/processing_limit_power/processing_limit_power_by_machines.py", 10087),
+    ("data_processing/processing_limit_power/processing_limit_power_by_records.py", 10088),
+    ("data_processing/processing_limit_power/processing_limit_power_by_statistics_light.py", 10085),
+    ("evaluation_processing/analysis.py", 10092),
+    ("evaluation_processing/evaluation_accuracy.py", 10091),
+    ("models_processing/model_train/model_training_lightgbm.py", 10089),
+    ("models_processing/model_predict/model_prediction_lightgbm.py", 10090),
+]
+
+# 启动所有服务
+processes = []
+for service, port in services:
+    print(f"Starting {service} on port {port}")
+    p = subprocess.Popen(["python", service])
+    processes.append(p)
+
+# 等待所有进程结束
+for p in processes:
+    p.wait()

+ 15 - 0
test_unit/test_agc_avc.py

@@ -0,0 +1,15 @@
+import subprocess
+
+# 构建命令
+command = [
+
+]
+
+# 使用 subprocess.run 来执行命令
+result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
+
+# 输出结果和错误信息
+print("Output:")
+print(result.stdout)
+print("Error:")
+print(result.stderr)

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů