anweiguo 8 ماه پیش
والد
کامیت
6f7a4cdd69
19فایلهای تغییر یافته به همراه2684 افزوده شده و 293 حذف شده
  1. 1313 32
      Untitled.ipynb
  2. 8 10
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/processing_limit_power_by_agcavc-checkpoint.py
  3. 405 4
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/test-checkpoint.ipynb
  4. 8 10
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/processing_limit_power_by_agcavc.py
  5. 324 15
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/test.ipynb
  6. 2 2
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/processing_limit_power_by_records-checkpoint.py
  7. 2 2
      data_processing/processing_limit_power/processing_limit_power_by_records/processing_limit_power_by_records.py
  8. 4 5
      data_processing/processing_limit_power/processing_limit_power_by_records/test.ipynb
  9. 12 5
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/processing_limit_power_by_statistics_light-checkpoint.py
  10. 12 5
      data_processing/processing_limit_power/processing_limit_power_by_statistics/processing_limit_power_by_statistics_light.py
  11. 395 56
      data_processing/processing_limit_power/processing_limit_power_by_statistics/test.ipynb
  12. 45 25
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/evaluation_accuracy-checkpoint.py
  13. 45 25
      evaluation_processing/evaluation_accuracy/evaluation_accuracy.py
  14. 10 7
      models_processing/model_prediction_lightgbm/.ipynb_checkpoints/model_prediction_lightgbm-checkpoint.py
  15. 10 7
      models_processing/model_prediction_lightgbm/model_prediction_lightgbm.py
  16. 19 4
      models_processing/model_prediction_lightgbm/test.ipynb
  17. 23 11
      models_processing/model_training_lighgbm/.ipynb_checkpoints/model_training_lightgbm-checkpoint.py
  18. 23 11
      models_processing/model_training_lighgbm/model_training_lightgbm.py
  19. 24 57
      models_processing/model_training_lighgbm/test.ipynb

+ 1313 - 32
Untitled.ipynb

@@ -2,58 +2,1339 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 15,
+   "execution_count": 8,
    "id": "8e82214d-6c64-433d-800f-2dde5f4a18bc",
    "metadata": {},
    "outputs": [
     {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "import pandas as pd \n",
-      "import numpy as np\n",
-      "\n",
-      "def method_a():\n",
-      "    print(\"method_a print hello world!\")\n"
-     ]
+     "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",
-    "with open('D://jupyterProject//jyProject//algorithm_platform//docker_bulid//method_a.py', 'r') as file:\n",
-    "    data = file.read()\n",
+    "# 显示所有行(可选)\n",
+    "pd.set_option('display.max_rows', None)\n",
     "\n",
-    "print(data)"
+    "# 连接 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": 2,
+   "execution_count": 11,
    "id": "2d45d74a-1157-4226-9aec-a11e39b1e143",
    "metadata": {},
    "outputs": [
     {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "method_a print hello world!\n",
-      "None\n"
-     ]
+     "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": [
-    "# file2.py\n",
-    "import sys\n",
-    "import os\n",
-    "\n",
-    "# 将 file1.py 所在目录添加到 Python 路径\n",
-    "sys.path.append(os.path.abspath(\"D://jupyterProject//jyProject//algorithm_platform//docker_bulid\"))\n",
-    "\n",
-    "# 导入 file1.py 中的方法\n",
-    "import method_a\n",
-    "\n",
-    "# 使用 file1 中的方法\n",
-    "print(method_a.method_a())"
+    "df[df['dateTime'].str.contains('2024-06-04')][['dateTime','dq','realPowerAvg','realPower']].sort_values(by='dateTime')"
    ]
   }
  ],

+ 8 - 10
data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/processing_limit_power_by_agcavc-checkpoint.py

@@ -8,13 +8,13 @@ import time
 import logging
 import traceback
 app = Flask('processing_limit_power_by_agcavc——service')
-@app.route('/hello', methods=['GET'])
+@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 = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -26,7 +26,7 @@ def get_data_from_mongo(args):
     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']
+    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():
@@ -41,19 +41,17 @@ def insert_data_into_mongo(res_df,args):
 
 #1.AGC/AVC信号判断限电(有的场站准 有的不准) 1种方法  数据库数据有问题 暂时用不了
 def  agc_avc_judgement(power_df,args):
-    timeBegin,timeEnd,col_time,user,password,host,port,database,avc_table = args['timeBegin'], args['timeEnd'],args['col_time'],args['user'],args['password'],args['host'],args['port'],args['database'],args['agc_avc_table']
+    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()
-    str_sql = f"mysql+pymysql://{user}:{password}@{host}:{port}/{database}"
-  
-    engine = create_engine(str_sql)
+    engine = create_engine(mysql_connection)
     # 定义SQL查询  
-    df = pd.read_sql_query(f"select C_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['C_TIME'] = pd.to_datetime(df['C_TIME']).dt.strftime('%Y-%m-%d %H:%M:%S')
+    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()
@@ -99,7 +97,7 @@ def processing_limit_power_by_agcavc():
 if __name__=="__main__":
     print("Program starts execution!")
     logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("new_leads_classification")
+    logger = logging.getLogger("processing_limit_power_by_agcavc")
     from waitress import serve
     serve(app, host="0.0.0.0", port=10086)
     print("server start!")

+ 405 - 4
data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/test-checkpoint.ipynb

@@ -5,18 +5,141 @@
    "execution_count": null,
    "id": "752c3ab3-cdef-47b0-9d9a-805348d30d6e",
    "metadata": {},
-   "outputs": [],
+   "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": null,
+   "execution_count": 2,
    "id": "3537b980-9596-4204-967c-28122d03cb0d",
    "metadata": {},
-   "outputs": [],
-   "source": []
+   "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",
@@ -180,6 +303,284 @@
     "}\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": {

+ 8 - 10
data_processing/processing_limit_power/processing_limit_power_by_agcavc/processing_limit_power_by_agcavc.py

@@ -8,13 +8,13 @@ import time
 import logging
 import traceback
 app = Flask('processing_limit_power_by_agcavc——service')
-@app.route('/hello', methods=['GET'])
+@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 = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -26,7 +26,7 @@ def get_data_from_mongo(args):
     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']
+    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():
@@ -41,19 +41,17 @@ def insert_data_into_mongo(res_df,args):
 
 #1.AGC/AVC信号判断限电(有的场站准 有的不准) 1种方法  数据库数据有问题 暂时用不了
 def  agc_avc_judgement(power_df,args):
-    timeBegin,timeEnd,col_time,user,password,host,port,database,avc_table = args['timeBegin'], args['timeEnd'],args['col_time'],args['user'],args['password'],args['host'],args['port'],args['database'],args['agc_avc_table']
+    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()
-    str_sql = f"mysql+pymysql://{user}:{password}@{host}:{port}/{database}"
-  
-    engine = create_engine(str_sql)
+    engine = create_engine(mysql_connection)
     # 定义SQL查询  
-    df = pd.read_sql_query(f"select C_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['C_TIME'] = pd.to_datetime(df['C_TIME']).dt.strftime('%Y-%m-%d %H:%M:%S')
+    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()
@@ -99,7 +97,7 @@ def processing_limit_power_by_agcavc():
 if __name__=="__main__":
     print("Program starts execution!")
     logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-    logger = logging.getLogger("new_leads_classification")
+    logger = logging.getLogger("processing_limit_power_by_agcavc")
     from waitress import serve
     serve(app, host="0.0.0.0", port=10086)
     print("server start!")

+ 324 - 15
data_processing/processing_limit_power/processing_limit_power_by_agcavc/test.ipynb

@@ -10,7 +10,7 @@
      "name": "stderr",
      "output_type": "stream",
      "text": [
-      "2024-09-26 11:00:17,560 - waitress - INFO - Serving on http://0.0.0.0:10086\n"
+      "2024-11-21 09:07:30,205 - waitress - INFO - Serving on http://0.0.0.0:10086\n"
      ]
     },
     {
@@ -24,7 +24,7 @@
      "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"
+      "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"
      ]
     },
     {
@@ -32,16 +32,68 @@
      "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",
+      "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",
-      "Collection 'J00260NWP_agcavc already exist, deleted successfully!\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"
      ]
@@ -254,23 +306,280 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 20,
+   "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": [
-       "71"
+       "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": 20,
+     "execution_count": 2,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "16+15+17+23"
+    "df.columns"
    ]
   }
  ],

+ 2 - 2
data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/processing_limit_power_by_records-checkpoint.py

@@ -10,7 +10,7 @@ import traceback
 app = Flask('processing_limit_power_by_records——service')
 
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -23,7 +23,7 @@ def get_data_from_mongo(args):
     
 
 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']
+    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():

+ 2 - 2
data_processing/processing_limit_power/processing_limit_power_by_records/processing_limit_power_by_records.py

@@ -10,7 +10,7 @@ import traceback
 app = Flask('processing_limit_power_by_records——service')
 
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -23,7 +23,7 @@ def get_data_from_mongo(args):
     
 
 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']
+    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():

+ 4 - 5
data_processing/processing_limit_power/processing_limit_power_by_records/test.ipynb

@@ -69,7 +69,7 @@
      "name": "stderr",
      "output_type": "stream",
      "text": [
-      "2024-09-26 11:45:04,387 - waitress - INFO - Serving on http://0.0.0.0:10088\n"
+      "2024-11-21 10:48:21,957 - waitress - INFO - Serving on http://0.0.0.0:10088\n"
      ]
     },
     {
@@ -83,7 +83,7 @@
      "name": "stderr",
      "output_type": "stream",
      "text": [
-      "2024-09-26 11:45:09,115 - processing_limit_power_by_machines log - INFO - {'timeBegin': '2024-05-01', 'timeEnd': '2024-09-20', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_machines', 'mongodb_write_table': 'J00260NWP_records', 'station_code': 'J00260', 'col_time': 'C_TIME'}\n"
+      "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"
      ]
     },
     {
@@ -91,9 +91,8 @@
      "output_type": "stream",
      "text": [
       "Program starts execution!\n",
-      "args {'timeBegin': '2024-05-01', 'timeEnd': '2024-09-20', 'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_machines', 'mongodb_write_table': 'J00260NWP_records', 'station_code': 'J00260', 'col_time': 'C_TIME'}\n",
-      "根据限电记录清洗,2024-05-01至2024-09-20,限电时长共计0.0小时\n",
-      "Collection 'J00260NWP_records already exist, deleted successfully!\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"
      ]

+ 12 - 5
data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/processing_limit_power_by_statistics_light-checkpoint.py

@@ -9,6 +9,8 @@ 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'])
@@ -17,7 +19,7 @@ def hello():
 
 
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -29,7 +31,7 @@ def get_data_from_mongo(args):
     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']
+    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():
@@ -52,10 +54,15 @@ def light_statistics_judgement(df_power,args):
     """
 
     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]))] 
+    
     X = df_power[[col_radiance]].values
     y = df_power[col_power].values
-    
+    print(X)
     # 创建线性回归模型并拟合
     model = LinearRegression()
     model.fit(X, y)
@@ -80,8 +87,8 @@ def light_statistics_judgement(df_power,args):
     # df_power.plot.scatter(x=col_radiance, y=col_power, c='c')
     #过滤掉限电点
     new_df_power = df_power[df_power['is_limit'] == False]    
-    print(f"未清洗限电前,总共有:{len(df_power)}条数据")
-    print(f"清除限电后保留的点有:{len(new_df_power)}, 占比:{round(len(new_df_power) / len(df_power), 2)}")
+    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)
 
 

+ 12 - 5
data_processing/processing_limit_power/processing_limit_power_by_statistics/processing_limit_power_by_statistics_light.py

@@ -9,6 +9,8 @@ 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'])
@@ -17,7 +19,7 @@ def hello():
 
 
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -29,7 +31,7 @@ def get_data_from_mongo(args):
     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']
+    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():
@@ -52,10 +54,15 @@ def light_statistics_judgement(df_power,args):
     """
 
     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]))] 
+    
     X = df_power[[col_radiance]].values
     y = df_power[col_power].values
-    
+    print(X)
     # 创建线性回归模型并拟合
     model = LinearRegression()
     model.fit(X, y)
@@ -80,8 +87,8 @@ def light_statistics_judgement(df_power,args):
     # df_power.plot.scatter(x=col_radiance, y=col_power, c='c')
     #过滤掉限电点
     new_df_power = df_power[df_power['is_limit'] == False]    
-    print(f"未清洗限电前,总共有:{len(df_power)}条数据")
-    print(f"清除限电后保留的点有:{len(new_df_power)}, 占比:{round(len(new_df_power) / len(df_power), 2)}")
+    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)
 
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 395 - 56
data_processing/processing_limit_power/processing_limit_power_by_statistics/test.ipynb


+ 45 - 25
evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/evaluation_accuracy-checkpoint.py

@@ -102,7 +102,7 @@ def datetime_to_timestamp(dt):
 
 
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -115,7 +115,7 @@ def get_data_from_mongo(args):
     
 
 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']
+    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():
@@ -129,30 +129,50 @@ def insert_data_into_mongo(res_df,args):
     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,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})
-
+    col_time,col_rp,col_pp = args['col_time'],args['col_rp'],args['col_pp']
+    df['datetime'] = df[col_time].apply(lambda x:pd.to_datetime(x).strftime("%Y-%m-%d")) 
+    # 按日期分组并计算 RMSE 和 MAE
+
+    results = df.groupby('datetime').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():

+ 45 - 25
evaluation_processing/evaluation_accuracy/evaluation_accuracy.py

@@ -102,7 +102,7 @@ def datetime_to_timestamp(dt):
 
 
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]
@@ -115,7 +115,7 @@ def get_data_from_mongo(args):
     
 
 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']
+    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():
@@ -129,30 +129,50 @@ def insert_data_into_mongo(res_df,args):
     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,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})
-
+    col_time,col_rp,col_pp = args['col_time'],args['col_rp'],args['col_pp']
+    df['datetime'] = df[col_time].apply(lambda x:pd.to_datetime(x).strftime("%Y-%m-%d")) 
+    # 按日期分组并计算 RMSE 和 MAE
+
+    results = df.groupby('datetime').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():

+ 10 - 7
models_processing/model_prediction_lightgbm/.ipynb_checkpoints/model_prediction_lightgbm-checkpoint.py

@@ -13,22 +13,25 @@ import traceback
 app = Flask('model_prediction_lightgbm——service')
 
 
-
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
+    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 = args['mongodb_connection'],args['mongodb_database'],args['mongodb_write_table']
+    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():
@@ -43,7 +46,7 @@ def insert_data_into_mongo(res_df,args):
     
 
 def model_prediction(df,args):
-    mongodb_connection,mongodb_database,mongodb_model_table,model_name = args['mongodb_connection'],args['mongodb_database'],args['mongodb_model_table'],args['model_name']
+    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]

+ 10 - 7
models_processing/model_prediction_lightgbm/model_prediction_lightgbm.py

@@ -13,22 +13,25 @@ import traceback
 app = Flask('model_prediction_lightgbm——service')
 
 
-
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+    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]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
+    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 = args['mongodb_connection'],args['mongodb_database'],args['mongodb_write_table']
+    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():
@@ -43,7 +46,7 @@ def insert_data_into_mongo(res_df,args):
     
 
 def model_prediction(df,args):
-    mongodb_connection,mongodb_database,mongodb_model_table,model_name = args['mongodb_connection'],args['mongodb_database'],args['mongodb_model_table'],args['model_name']
+    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]

+ 19 - 4
models_processing/model_prediction_lightgbm/test.ipynb

@@ -145,7 +145,7 @@
      "name": "stderr",
      "output_type": "stream",
      "text": [
-      "2024-09-26 11:55:37,911 - waitress - INFO - Serving on http://0.0.0.0:10089\n"
+      "2024-11-21 15:58:04,711 - waitress - INFO - Serving on http://0.0.0.0:10090\n"
      ]
     },
     {
@@ -159,7 +159,7 @@
      "name": "stderr",
      "output_type": "stream",
      "text": [
-      "2024-09-26 11:57:14,162 - model_prediction_lightgbm log - INFO - {'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'J00260NWP_records_predict', 'mongodb_model_table': 'models', 'model_name': 'lightgbm_model'}\n"
+      "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"
      ]
     },
     {
@@ -167,12 +167,27 @@
      "output_type": "stream",
      "text": [
       "Program starts execution!\n",
-      "args {'mongodb_connection': 'mongodb://root:Jydl3377@192.168.1.33:27017', 'mongodb_database': 'algorithm_platform', 'mongodb_read_table': 'J00260NWP_records', 'mongodb_write_table': 'J00260NWP_records_predict', 'mongodb_model_table': 'models', 'model_name': 'lightgbm_model'}\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",
-      "Collection 'J00260NWP_records_predict already exist, deleted 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": [

+ 23 - 11
models_processing/model_training_lighgbm/.ipynb_checkpoints/model_training_lightgbm-checkpoint.py

@@ -5,6 +5,7 @@ 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
@@ -13,20 +14,24 @@ import traceback
 
 app = Flask('model_training_lightgbm——service')
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+     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]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
+    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 = args['mongodb_connection'],args['mongodb_database'],args['mongodb_write_table']
+    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():
@@ -40,7 +45,7 @@ def insert_model_into_mongo(model_data,args):
 def build_model(df,args):
     np.random.seed(42)
     #lightgbm预测下
-    numerical_features,categorical_features,label,model_name,learning_rate,num_leaves,min_data_in_leaf = str_to_list(args['numerical_features']),str_to_list(args['categorical_features']),args['label'],args['model_name'],args['learning_rate'],args['num_leaves'],args['min_data_in_leaf']
+    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)
     # 拆分数据为训练集和测试集
@@ -53,17 +58,24 @@ def build_model(df,args):
         'objective': 'regression',
         'metric': 'rmse',
         'boosting_type': 'gbdt',
-        'num_leaves': num_leaves,
-        'learning_rate': learning_rate,
-        'min_data_in_leaf': min_data_in_leaf,  # 叶子节点最小数据量
+        'verbose':1
     }
+
+    merged_param = params | model_params
     # 训练模型
     print('Starting training...')
-    gbm = lgb.train(params,
+    gbm = lgb.train(merged_param,
                     lgb_train,
-                    num_boost_round=500,
+                    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)

+ 23 - 11
models_processing/model_training_lighgbm/model_training_lightgbm.py

@@ -5,6 +5,7 @@ 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
@@ -13,20 +14,24 @@ import traceback
 
 app = Flask('model_training_lightgbm——service')
 def get_data_from_mongo(args):
-    mongodb_connection,mongodb_database,mongodb_read_table = args['mongodb_connection'],args['mongodb_database'],args['mongodb_read_table']
+     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]  # 集合名称
-    data_from_db = collection.find()  # 这会返回一个游标(cursor)
-    # 将游标转换为列表,并创建 pandas DataFrame
-    df = pd.DataFrame(list(data_from_db))
+    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 = args['mongodb_connection'],args['mongodb_database'],args['mongodb_write_table']
+    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():
@@ -40,7 +45,7 @@ def insert_model_into_mongo(model_data,args):
 def build_model(df,args):
     np.random.seed(42)
     #lightgbm预测下
-    numerical_features,categorical_features,label,model_name,learning_rate,num_leaves,min_data_in_leaf = str_to_list(args['numerical_features']),str_to_list(args['categorical_features']),args['label'],args['model_name'],args['learning_rate'],args['num_leaves'],args['min_data_in_leaf']
+    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)
     # 拆分数据为训练集和测试集
@@ -53,17 +58,24 @@ def build_model(df,args):
         'objective': 'regression',
         'metric': 'rmse',
         'boosting_type': 'gbdt',
-        'num_leaves': num_leaves,
-        'learning_rate': learning_rate,
-        'min_data_in_leaf': min_data_in_leaf,  # 叶子节点最小数据量
+        'verbose':1
     }
+
+    merged_param = params | model_params
     # 训练模型
     print('Starting training...')
-    gbm = lgb.train(params,
+    gbm = lgb.train(merged_param,
                     lgb_train,
-                    num_boost_round=500,
+                    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)

+ 24 - 57
models_processing/model_training_lighgbm/test.ipynb

@@ -246,7 +246,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": null,
    "id": "8bdd9bd2-4373-4465-b20a-de574fb29436",
    "metadata": {},
    "outputs": [
@@ -254,7 +254,7 @@
      "name": "stderr",
      "output_type": "stream",
      "text": [
-      "2024-09-26 13:52:11,278 - waitress - INFO - Serving on http://0.0.0.0:10090\n"
+      "2024-11-21 14:54:47,009 - waitress - INFO - Serving on http://0.0.0.0:10089\n"
      ]
     },
     {
@@ -268,24 +268,7 @@
      "name": "stderr",
      "output_type": "stream",
      "text": [
-      "2024-09-26 13:52:13,894 - 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-气压'\", '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"
-     ]
-    },
-    {
-     "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-气压'\", '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",
-      "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 13:52:57,749 - 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-气压', '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"
+      "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"
      ]
     },
     {
@@ -293,53 +276,37 @@
      "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-气压', '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",
-      "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 13:53:10,595 - 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-气压', '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"
-     ]
-    },
-    {
-     "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-气压', '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",
-      "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",
+      "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"
      ]
-    },
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "2024-09-26 13:54:25,780 - 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-气压', '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"
-     ]
-    },
+    }
+   ],
+   "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": [
-      "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-气压', '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",
-      "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",
-      "server start!\n"
+      "{'a': 1, 'b': 3, 'c': 4}\n"
      ]
     }
    ],
    "source": [
-    " %run model_training_lightgbm.py"
+    "temperature2,direction10,speed10,mcc,solarZenith,dniCalcd,humidity2,hcc,clearskyGhi,lcc,tcc,surfacePressure,tpr,radiation"
    ]
   }
  ],

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است