David 5 months ago
parent
commit
fc1445fa57
55 changed files with 625 additions and 7120 deletions
  1. 205 0
      data_processing/processing_limit_power/logs.py
  2. 0 0
      data_processing/processing_limit_power/processing_limit_power_by_agcavc.py
  3. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/Dockerfile-checkpoint
  4. 0 106
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/processing_limit_power_by_agcavc-checkpoint.py
  5. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/requirements-checkpoint.txt
  6. 0 607
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/.ipynb_checkpoints/test-checkpoint.ipynb
  7. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/Dockerfile
  8. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/requirements.txt
  9. 0 607
      data_processing/processing_limit_power/processing_limit_power_by_agcavc/test.ipynb
  10. 0 0
      data_processing/processing_limit_power/processing_limit_power_by_machines.py
  11. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/Dockerfile-checkpoint
  12. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/Untitled-checkpoint.ipynb
  13. 0 97
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/processing_limit_power_by_machines-checkpoint.py
  14. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/requirements-checkpoint.txt
  15. 0 216
      data_processing/processing_limit_power/processing_limit_power_by_machines/.ipynb_checkpoints/test-checkpoint.ipynb
  16. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_machines/Dockerfile
  17. 0 89
      data_processing/processing_limit_power/processing_limit_power_by_machines/Untitled.ipynb
  18. 0 6
      data_processing/processing_limit_power/processing_limit_power_by_machines/requirements.txt
  19. 0 294
      data_processing/processing_limit_power/processing_limit_power_by_machines/test.ipynb
  20. 0 0
      data_processing/processing_limit_power/processing_limit_power_by_records.py
  21. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/Dockerfile-checkpoint
  22. 0 94
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/processing_limit_power_by_records-checkpoint.py
  23. 0 5
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/requirements-checkpoint.txt
  24. 0 295
      data_processing/processing_limit_power/processing_limit_power_by_records/.ipynb_checkpoints/test-checkpoint.ipynb
  25. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_records/Dockerfile
  26. 0 5
      data_processing/processing_limit_power/processing_limit_power_by_records/requirements.txt
  27. 0 339
      data_processing/processing_limit_power/processing_limit_power_by_records/test.ipynb
  28. 192 0
      data_processing/processing_limit_power/processing_limit_power_by_solar.py
  29. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/Dockerfile-checkpoint
  30. 0 135
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/processing_limit_power_by_statistics_light-checkpoint.py
  31. 0 8
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/requirements-checkpoint.txt
  32. 0 298
      data_processing/processing_limit_power/processing_limit_power_by_statistics/.ipynb_checkpoints/test-checkpoint.ipynb
  33. 0 16
      data_processing/processing_limit_power/processing_limit_power_by_statistics/Dockerfile
  34. 0 8
      data_processing/processing_limit_power/processing_limit_power_by_statistics/requirements.txt
  35. 0 598
      data_processing/processing_limit_power/processing_limit_power_by_statistics/test.ipynb
  36. 0 0
      data_processing/processing_limit_power/processing_limit_power_by_statistics_light.py
  37. 228 0
      data_processing/processing_limit_power/processing_limit_power_by_wind.py
  38. 0 10
      data_processing/processing_limit_power/processing_limit_power_by_wind/processing_limit_power_by_wind.py
  39. 0 0
      evaluation_processing/analysis.py
  40. 0 16
      evaluation_processing/analysis_report/.ipynb_checkpoints/Dockerfile-checkpoint
  41. 0 247
      evaluation_processing/analysis_report/.ipynb_checkpoints/analysis-checkpoint.py
  42. 0 9
      evaluation_processing/analysis_report/.ipynb_checkpoints/requirements-checkpoint.txt
  43. 0 131
      evaluation_processing/analysis_report/.ipynb_checkpoints/test-checkpoint.ipynb
  44. 0 16
      evaluation_processing/analysis_report/Dockerfile
  45. BIN
      evaluation_processing/analysis_report/__pycache__/analysis.cpython-39.pyc
  46. 0 9
      evaluation_processing/analysis_report/requirements.txt
  47. 0 131
      evaluation_processing/analysis_report/test.ipynb
  48. 0 0
      evaluation_processing/evaluation_accuracy.py
  49. 0 16
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/Dockerfile-checkpoint
  50. 0 212
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/evaluation_accuracy-checkpoint.py
  51. 0 6
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/requirements-checkpoint.txt
  52. 0 1506
      evaluation_processing/evaluation_accuracy/.ipynb_checkpoints/test-checkpoint.ipynb
  53. 0 16
      evaluation_processing/evaluation_accuracy/Dockerfile
  54. 0 6
      evaluation_processing/evaluation_accuracy/requirements.txt
  55. 0 830
      evaluation_processing/evaluation_accuracy/test.ipynb

+ 205 - 0
data_processing/processing_limit_power/logs.py

@@ -0,0 +1,205 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# time: 2023/3/4 22:28
+# file: myLog.py
+# author: David
+# company: shenyang JY
+
+"""
+1. 信息流以控制台和文件形式打印
+2. 文件保存以启动日期为文件名
+3. 控制台INFO,文件DEBUG
+"""
+import codecs
+from pathlib import Path
+import logging, logging.handlers, time, os, re
+from logging.handlers import BaseRotatingHandler
+
+
+class DailyRotatingFileHandler(BaseRotatingHandler):
+    """
+    同`logging.TimedRotatingFileHandler`类似,不过这个handler:
+    - 可以支持多进程
+    - 只支持自然日分割
+    - 暂不支持UTC
+    """
+
+    def __init__(self, filename, backupCount=0, encoding=None, delay=False, utc=False, **kwargs):
+        self.backup_count = backupCount
+        self.utc = utc
+        self.suffix = "%Y-%m-%d"
+        self.base_log_path = Path(filename)
+        self.base_filename = self.base_log_path.name
+        self.current_filename = self._compute_fn()
+        self.current_log_path = self._compute_lp()
+        BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay)
+
+    def shouldRollover(self, record):
+        """
+        判断是否该滚动日志,如果当前时间对应的日志文件名与当前打开的日志文件名不一致,则需要滚动日志
+        """
+        if self.current_filename != self._compute_fn():
+            # 日期变了,计算新的日志文件
+            self.current_filename = self._compute_fn()
+            return True
+        elif os.path.getsize(self.current_log_path) > 10485760:     # 判断文件是否大于10MB字节数
+            # 超过10M了,计算新的日志文件
+            seg = int(self.current_filename.split(".")[-2]) + 1
+            self.current_filename = self._compute_fn(seg=seg)
+            return True
+        return False
+
+    def doRollover(self):
+        """
+        滚动日志
+        """
+        # 关闭旧的日志文件
+        if self.stream:
+            self.stream.close()
+            self.stream = None
+
+        # self.current_log_path = self.base_log_path.with_name(self.current_filename)
+        self.current_log_path = self._compute_lp()
+        # 打开新的日志文件
+        if not self.delay:
+            self.stream = self._open()
+
+        # 删除过期日志
+        # self.delete_expired_files()
+
+    def _compute_lp(self):
+        """
+        计算当前时间对应日志的路径
+        """
+        current_log_path = self.base_log_path.parent / time.strftime(self.suffix, time.localtime())
+        if not os.path.exists(current_log_path):
+            os.mkdir(current_log_path)
+        return current_log_path / self.current_filename
+
+    def _compute_fn(self, seg=0):
+        """
+        计算当前时间对应的日志文件名
+        """
+
+        return "limit-power" + "." + time.strftime(self.suffix, time.localtime()) + '.' + str(seg) +'.log'
+
+    def _open(self):
+        """
+        打开新的日志文件,同时更新base_filename指向的软链,修改软链不会对日志记录产生任何影响
+        """
+        if self.encoding is None:
+            stream = open(str(self.current_log_path), self.mode)
+        else:
+            stream = codecs.open(str(self.current_log_path), self.mode, self.encoding)
+
+        # # 删除旧的软链
+        # if self.base_log_path.exists():
+        #     try:
+        #         # 如果base_log_path不是软链或者指向的日志文件不对,则先删除该软链
+        #         if not self.base_log_path.is_symlink() or os.readlink(self.base_log_path) != self.current_log_path:
+        #             os.remove(self.base_log_path)
+        #     except OSError:
+        #         pass
+        #
+        # # 建立新的软链
+        # try:
+        #     os.symlink(self.current_log_path, str(self.base_log_path))
+        # except OSError:
+        #     pass
+        return stream
+
+    def delete_expired_files(self):
+        """
+        删除过期的日志
+        """
+        if self.backup_count <= 0:
+            return
+
+        file_names = os.listdir(str(self.base_log_path.parent))
+        result = []
+        prefix = self.base_filename + "."
+        plen = len(prefix)
+        for file_name in file_names:
+            if re.match(r"^\d{4}-\d{2}-\d{2}(\.\w+)?$", file_name):
+                result.append(file_name)
+        if len(result) < self.backup_count:
+            result = []
+        else:
+            result.sort()
+            result = result[:len(result) - self.backup_count]
+        import shutil
+        for file_name in result:
+            path = self.base_log_path.with_name(file_name)
+            if os.path.isdir(path):
+                shutil.rmtree(path)
+
+
+class Log(object):
+    def __init__(self):
+        # 定义对应的程序模块名name,默认为root
+        self.logger = logging.getLogger()
+        # 设置输出的等级
+        LEVELS = {'NOSET': logging.NOTSET,
+                  'DEBUG': logging.DEBUG,
+                  'INFO': logging.INFO,
+                  'WARNING': logging.WARNING,
+                  'ERROR': logging.ERROR,
+                  'CRITICAL': logging.CRITICAL}
+
+        # 必须设置,这里如果不显示设置,默认过滤掉warning之前的所有级别的信息
+        self.logger.setLevel(LEVELS['DEBUG'])
+
+        # 仅为matplotlib设置更高的日志等级(ERROR)
+        matplotlib_logger = logging.getLogger('matplotlib')
+        matplotlib_logger.setLevel(logging.ERROR)
+
+        # 日志输出格式
+        self.formatter = logging.Formatter(
+            '%(asctime)s - %(filename)s - %(levelname)s - %(message)s - %(funcName)s')  # 输出日志格式
+
+        # 创建一个handler, 向文件logname输出日志信息
+        # fh = logging.FileHandler(self.logname, 'a', encoding='utf-8')
+        # midnight:表示日志文件再每天半夜时分滚动
+        # interval: 间隔单位的个数,指等待多少个when的时间后 Logger会自动重建新闻继续进行日志记录
+        # backupCount:表示日志文件的保留个数,假如为30,保留最近30天的日志文件
+        # fh = logging.handlers.TimedRotatingFileHandler(self.getLogName(), when='midnight', interval=1, backupCount=30, encoding='utf-8')
+        # fh.suffix = "%Y-%m-%d"
+        # # fh.extMatch = r"^\d{4}-\d{2}-\d{2}"
+        # # 设置日志等级
+        # fh.setLevel(LEVELS['INFO'])
+        # # 设置handler的格式对象
+        # fh.setFormatter(self.formatter)
+        filename = self.getLogName()
+        dr_fh = DailyRotatingFileHandler(filename, backupCount=100, encoding='utf-8')
+        dr_fh.setFormatter(self.formatter)
+        # 将handler增加到logger中
+        self.logger.addHandler(dr_fh)
+
+        # 创建一个StreamHandler,用于输出到控制台
+        ch = logging.StreamHandler()
+        ch.setLevel(LEVELS['INFO'])
+        ch.setFormatter(self.formatter)
+        self.logger.addHandler(ch)
+
+        # # 关闭打开的文件
+        dr_fh.close()
+
+    def getLogName(self):
+        # log_path是存放日志的路径
+        # lib_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'logs'))
+        lib_path = Path(os.path.dirname(__file__)).parent / 'logs'
+        self.logger.info("日志输出路径为:{}".format(lib_path))
+        # 如果不存在这个logs文件夹,就自动创建一个
+        if not os.path.exists(lib_path):
+            os.mkdir(lib_path)
+        return lib_path / 'limit_power_link.log'
+
+
+
+if __name__ == "__main__":
+    logger = Log()
+    logger.info("this is info")
+    logger.debug("this is debug")
+    logger.error("this is error")
+    logger.warning("this is warning")
+    logger.critical("critical")

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


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

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

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

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

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

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

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

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

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_agcavc/Dockerfile

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

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

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

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

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

+ 0 - 0
data_processing/processing_limit_power/processing_limit_power_by_machines/processing_limit_power_by_machines.py → data_processing/processing_limit_power/processing_limit_power_by_machines.py


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

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

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

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

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

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

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

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

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

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

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_machines/Dockerfile

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

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

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

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

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

File diff suppressed because it is too large
+ 0 - 294
data_processing/processing_limit_power/processing_limit_power_by_machines/test.ipynb


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


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

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

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

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

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

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

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

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

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_records/Dockerfile

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

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

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

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

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

+ 192 - 0
data_processing/processing_limit_power/processing_limit_power_by_solar.py

@@ -0,0 +1,192 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+# @FileName  :processing_limit_power_by_solar.py
+# @Time      :2024/12/3 18:40
+# @Author    :David
+# @Company: shenyang JY
+
+import os, time
+import pandas as pd
+import numpy as np
+from pymongo import MongoClient
+from flask import request, app
+from logs import Log
+import matplotlib.pyplot as plt
+import traceback
+current_path = os.path.dirname(__file__)
+parent_path = os.path.dirname(current_path)
+
+def get_data_from_mongo(args):
+    mongodb_connection,mongodb_database,mongodb_read_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table']
+    client = MongoClient(mongodb_connection)
+    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
+    db = client[mongodb_database]
+    collection = db[mongodb_read_table]  # 集合名称
+    data_from_db = collection.find()  # 这会返回一个游标(cursor)
+    # 将游标转换为列表,并创建 pandas DataFrame
+    df = pd.DataFrame(list(data_from_db))
+    client.close()
+    return df
+
+def insert_data_into_mongo(res_df,args):
+    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
+    client = MongoClient(mongodb_connection)
+    db = client[mongodb_database]
+    if mongodb_write_table in db.list_collection_names():
+        db[mongodb_write_table].drop()
+        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
+    collection = db[mongodb_write_table]  # 集合名称
+    # 将 DataFrame 转为字典格式
+    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
+    # 插入到 MongoDB
+    collection.insert_many(data_dict)
+    print("data inserted successfully!")
+
+@app.route('/processing_limit_power_by_solar', methods=['POST', 'GET'])
+def processing_limit_power_by_solar():
+    # 获取程序开始时间
+    start_time = time.time()
+    result = {}
+    success = 0
+    print("Program starts execution!")
+    try:
+        logger = Log().logger
+        args = request.values.to_dict()
+        weather_power = get_data_from_mongo(args)
+        lp = LimitPower(logger, args, weather_power)
+        weather_power = lp.clean_limited_power('')
+        print('args', args)
+        logger.info(args)
+        insert_data_into_mongo(weather_power, args)
+        success = 1
+    except Exception as e:
+        my_exception = traceback.format_exc()
+        my_exception.replace("\n", "\t")
+        result['msg'] = my_exception
+    end_time = time.time()
+
+    result['success'] = success
+    result['args'] = args
+    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
+    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
+    print("Program execution ends!")
+    return result
+
+class LimitPower(object):
+    def __init__(self, logger, args, weather_power):
+        self.logger = logger
+        self.args = args
+        self.weather_power = weather_power
+
+    def segment_statis(self):
+        """
+        对总辐射-实际功率进行分段处理,获取分度的中位点,四分位间距和斜率
+        :return: glob_rp 总辐射分段
+        """
+        segs = [x for x in range(50, 2000, 100)]    # 对辐照度以100为间隔进行分段
+        xs = [segs[i-1]+x if i>0 else 25 for i, x in enumerate([50 for _ in segs])]  # 分段的中间点
+        glob_rp = {}       # dict: key 辐照度分段中间点 value 分段内的实际功率
+        for index, row in self.weather_power.iterrows():
+            glob_ = row[self.args.usable_power["env"]]
+            rp = row['C_REAL_VALUE']
+            for i, seg in enumerate(segs):
+                if glob_ <= seg and not (i > 0 and rp < 1):
+                    glob_rp.setdefault(xs[i], []).append(rp)
+                    break
+        for i, x in enumerate(xs):
+            rps = glob_rp.get(x)
+            if rps is None:
+                glob_rp = {k: v for k, v in glob_rp.items() if k not in xs[xs.index(x):]}
+                break
+            x_l = xs[i-1] if i > 0 else 0
+            q2_l = glob_rp[xs[i-1]][0] if i > 0 else 0
+            q1 = np.percentile(rps, self.args.usable_power['down_fractile'])     # 实际功率下四分位点
+            q2 = np.percentile(rps, 50)  # 实际功率中位点
+            q3 = np.percentile(rps, self.args.usable_power['up_fractile'])     # 实际功率上四分位点
+            iqr = q3 -q1    # 四分位间距
+            k1 = round(q2/x, 5)  # 整体斜率
+            k2 = round((q2-q2_l)/(x-x_l), 5)    # 趋势斜率,相对上一个中位点
+            glob_rp[x] = [q2, iqr, k1, k2]   # 更新dict
+        return glob_rp
+
+    def mapping_relation(self, glob_rp):
+        """
+        拟合分段处理后的斜率和偏移量
+        :param glob_rp: 总辐射分段
+        :return: k_final 斜率 bias 实际功率的分布宽度, glob_rp 总辐射分段
+        """
+        ks, iqrs, delete_x, tag_x = [], [], [], []   # ks所有分段斜率集合,iqrs所有分段间距集合,delete_x删除的x坐标集合
+        for x, values in glob_rp.items():
+            k1 = values[-2]
+            k2 = values[-1]
+            iqrs.append(values[-3])
+            if k1 > 0 and k2 > 0:   # 清除趋势小于等于0的斜率
+                ks.append(k1)
+                tag_x.append(x)
+            else:
+                delete_x.append(x)
+                # print("删除的斜率:", k1, k2)
+        bias = round(np.median(iqrs), 3)  # 中位点
+        # print("++++1", ks)
+        mean = np.mean(ks)  # 均值
+        std = np.std(ks)    # 标准差
+        ks = np.array(ks)
+        z_score = (ks-mean)/std # z均值
+        # print("----", z_score)
+        outliers = np.abs(z_score) > self.args.usable_power['outliers_threshold']    # 超过阈值为离群点
+        ks = ks[~outliers]  # 消除离群点
+        delete_x1 = list(np.array(tag_x)[outliers]) # 清除大于阈值的离群点
+        k_final = round(np.mean(ks), 5)  # 对清洗后的斜率做平均
+        # print("++++2:", ks)
+        delete_x.extend(delete_x1)
+        self.logger.info("拟合可用功率,删除的斜率:" + ' '.join([str(x) for x in delete_x]))
+        glob_rp = {k: v for k, v in glob_rp.items() if k not in delete_x}   # 清洗后剩下的分段点位
+        return k_final, bias, glob_rp
+
+    def filter_unlimited_power(self, zfs, real_power, k, b):
+        """
+        预测可用功主方法
+        :param zfs: 要预测可用功率的总辐射
+        :param k: 斜率
+        :param b: 偏移量
+        :return: 预测的可用功率
+        """
+        high = k*zfs+b/2 if k*zfs+b/2 < self.args.cap else self.args.cap
+        low = k*zfs-b/2 if k*zfs-b/2 > 0 else 0
+        if low <= real_power <= high:
+            return True
+        else:
+            return False
+
+    def clean_limited_power(self, name, is_repair=False):
+        if is_repair is True:
+            glob_rp = self.segment_statis()
+            k_final, bias, glob_rp = self.mapping_relation(glob_rp)
+            self.args.usable_power['k'] = float(k_final)
+            self.args.usable_power['bias'] = float(bias)
+        new_weather_power = []
+        for index, row in self.weather_power.iterrows():
+            zfs = row[self.args.usable_power["env"]]
+            rp = row['C_REAL_VALUE']
+            if self.filter_unlimited_power(zfs, rp, self.args.usable_power['k'], self.args.usable_power['bias'] * self.args.usable_power['coe']):
+                row['c'] = 'red'
+                new_weather_power.append(row)
+            else:
+                row['c'] = 'blue'
+                new_weather_power.append(row)
+        new_weather_power = pd.concat(new_weather_power, axis=1).T
+        new_weather_power.plot.scatter(x=self.args.usable_power["env"], y='C_REAL_VALUE', c='c')
+        plt.savefig(parent_path + '/figs/测光法{}.png'.format(name))
+        new_weather_power = new_weather_power[new_weather_power['c'] == 'red']
+        number = len(new_weather_power)
+        self.logger.info("测光法-未清洗限电前,总共有:{}条数据".format(len(self.weather_power)))
+        self.logger.info("测光法-清除限电后保留的点有:" + str(number) + " 占比:" + str(round(number / len(self.weather_power), 2)))
+        return new_weather_power.loc[:, ['C_TIME', 'C_REAL_VALUE', 'C_ABLE_VALUE']]
+
+
+if __name__ == '__main__':
+    power = pd.read_csv('2023-12-01至2023-12-23实际功率导出文件.csv', date_parser=['时间'])
+    weather = pd.read_csv('2023-12-01至2023-12-23气象站数据导出文件.csv', date_parser=['时间'])
+    weather_power = pd.merge(weather, power, on='时间')  # 联立数据
+    # glob_rp = segment_statis(weather_power)
+    # k_final, bias, glob_rp = mapping_relation(glob_rp)

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

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

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

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

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

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

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

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

+ 0 - 16
data_processing/processing_limit_power/processing_limit_power_by_statistics/Dockerfile

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

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

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

File diff suppressed because it is too large
+ 0 - 598
data_processing/processing_limit_power/processing_limit_power_by_statistics/test.ipynb


+ 0 - 0
data_processing/processing_limit_power/processing_limit_power_by_statistics/processing_limit_power_by_statistics_light.py → data_processing/processing_limit_power/processing_limit_power_by_statistics_light.py


+ 228 - 0
data_processing/processing_limit_power/processing_limit_power_by_wind.py

@@ -0,0 +1,228 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+# @FileName  :processing_limit_power_by_wind.py
+# @Time      :2024/12/3 14:32
+# @Author    :David
+# @Company: shenyang JY
+
+import os, time
+import pandas as pd
+import numpy as np
+from pymongo import MongoClient
+from flask import request, app
+from logs import Log
+import matplotlib.pyplot as plt
+import pickle, traceback
+current_path = os.path.dirname(__file__)
+parent_path = os.path.dirname(current_path)
+
+def get_data_from_mongo(args):
+    mongodb_connection,mongodb_database,mongodb_read_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_read_table']
+    client = MongoClient(mongodb_connection)
+    # 选择数据库(如果数据库不存在,MongoDB 会自动创建)
+    db = client[mongodb_database]
+    collection = db[mongodb_read_table]  # 集合名称
+    data_from_db = collection.find()  # 这会返回一个游标(cursor)
+    # 将游标转换为列表,并创建 pandas DataFrame
+    df = pd.DataFrame(list(data_from_db))
+    client.close()
+    return df
+
+def insert_data_into_mongo(res_df,args):
+    mongodb_connection,mongodb_database,mongodb_write_table = "mongodb://root:sdhjfREWFWEF23e@192.168.1.43:30000/",args['mongodb_database'],args['mongodb_write_table']
+    client = MongoClient(mongodb_connection)
+    db = client[mongodb_database]
+    if mongodb_write_table in db.list_collection_names():
+        db[mongodb_write_table].drop()
+        print(f"Collection '{mongodb_write_table} already exist, deleted successfully!")
+    collection = db[mongodb_write_table]  # 集合名称
+    # 将 DataFrame 转为字典格式
+    data_dict = res_df.to_dict("records")  # 每一行作为一个字典
+    # 插入到 MongoDB
+    collection.insert_many(data_dict)
+    print("data inserted successfully!")
+
+@app.route('/processing_limit_power_by_wind', methods=['POST', 'GET'])
+def processing_limit_power_by_agcavc():
+    # 获取程序开始时间
+    start_time = time.time()
+    result = {}
+    success = 0
+    print("Program starts execution!")
+    try:
+        logger = Log().logger
+        args = request.values.to_dict()
+        weather_power = get_data_from_mongo(args)
+        lp = LimitPower(logger, args, weather_power)
+        weather_power = lp.clean_limited_power('')
+        print('args', args)
+        logger.info(args)
+        insert_data_into_mongo(weather_power, args)
+        success = 1
+    except Exception as e:
+        my_exception = traceback.format_exc()
+        my_exception.replace("\n", "\t")
+        result['msg'] = my_exception
+    end_time = time.time()
+
+    result['success'] = success
+    result['args'] = args
+    result['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_time))
+    result['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(end_time))
+    print("Program execution ends!")
+    return result
+
+class LimitPower(object):
+    def __init__(self, logger, args, weather_power):
+        self.logger = logger
+        self.args = args
+        self.weather_power = weather_power
+        self.step = self.args.usable_power['step']
+        self.segs = np.array([x * self.step for x in range(1, 50)])  # 对风速以50为间隔进行分段
+        self.xs = np.array([self.segs[i - 1] + x if i > 0 else self.step / 2 for i, x in
+              enumerate([self.step / 2 for _ in self.segs])])  # 分段的中间点
+        self.polynomial = None
+        self.width = 0
+        self.max_ws = 50
+
+    def segment_statis(self):
+        """
+        对机头风速-实际功率进行分段处理,获取分度的中位点,四分位间距和斜率
+        :return: glob_rp 总辐射分段
+        """
+        glob_rp = {}       # dict: key 辐照度分段中间点 value 分段内的实际功率
+        for index, row in self.weather_power.iterrows():
+            ws_ = row[self.opt.usable_power["env"]]
+            rp = row['C_REAL_VALUE']
+            for i, seg in enumerate(self.segs):
+                if ws_ <= seg:
+                    glob_rp.setdefault(self.xs[i], []).append(rp)
+                    break
+        rms = []
+        for i, x in enumerate(self.xs):
+            rps = glob_rp.get(x)
+            if rps is None:
+                continue
+            rps = np.array(rps)
+            up = self.opt.usable_power['up_fractile']
+            down = self.opt.usable_power['down_fractile']
+            offset = 0
+            while True:
+                index = i-1 if i > 0 else 0
+                while (self.xs[index] in rms or self.xs[index] not in glob_rp) and index >0:
+                    index -= 1
+                x_l = self.xs[index] if index > 0 else 0
+                q2_l = glob_rp[self.xs[index]][0] if index > 0 else 0
+                down = down + offset
+                if down > up:
+                    rms.append(x)
+                    self.logger.info("删除的坐标点为:{}".format(x))
+                    break
+                q1 = np.percentile(rps, down)   # 下四分位点
+                q2 = round(np.percentile(rps, down+(up-down)/2), 3) # 中位点
+                q3 = np.percentile(rps, up)     # 上四分为点
+                # q2 = np.around(np.mean(rps[(rps >= q1) & (rps <= q3)]), 3)
+                iqr = q3 - q1  # 四分位间距
+                k2 = round((q2-q2_l)/(x-x_l), 3)    # 趋势斜率
+
+                # std = np.around(np.std(rps[(rps >= q1) & (rps <= q3)]), 3)
+                # mean = np.around(np.mean(rps), 3)  # 实际功率均值
+                # std = np.around(np.std(rps), 3)  # 实际功率标准差
+                # print("看看q2={},mean={}".format(q2, mean))
+                if k2 >= 0:
+                    glob_rp[x] = [q2, iqr]   # 更新dict
+                    break
+                else:
+                    offset += 1
+        glob_rp = {k: glob_rp[k] for k in glob_rp.keys() if k not in rms}
+        glob_rp = {k: glob_rp[k] for k in sorted(glob_rp.keys())}
+        return glob_rp
+
+    def mapping_relation(self, glob_rp):
+        degree = self.args.usable_power['degree']
+        xs = list(glob_rp.keys())
+        ys = [y[0] for y in glob_rp.values()]
+        self.width = np.median(np.array([y[1] for y in glob_rp.values()]))
+        coefficients = np.polyfit(xs, ys, degree)
+        self.polynomial = np.poly1d(coefficients)
+        self.max_ws = max(xs)
+        # y_fit = self.polynomial(xs)
+        # plt.scatter(xs, ys, label='Data', color='red')
+        # plt.plot(xs, y_fit, label='Fitted polynomial', color='blue')
+        # plt.plot(xs, y_fit+self.width/2, label='up polynomial', color='purple')
+        # plt.plot(xs, y_fit-self.width/2, label='down polynomial', color='green')
+        # plt.legend()
+        # plt.xlabel('x')
+        # plt.ylabel('y')
+        # plt.title(f'Polynomial Fit (degree {degree})')
+        # plt.show()
+
+    def saveVar(self, path, data):
+        os.makedirs(os.path.dirname(path), exist_ok=True)
+        with open(path, 'wb') as file:
+            pickle.dump(data, file)
+
+    def filter_unlimited_power(self, ws, real_power):
+        """
+        预测可用功主方法
+        :param zfs: 要预测可用功率的总辐射
+        :param k: 斜率
+        :param b: 偏移量
+        :return: 预测的可用功率
+        """
+        # coe = self.opt.usable_power['outliers_threshold']
+        # seg = self.xs[np.argmax(self.segs >= ws)]
+        up_offset = self.args.usable_power['up_offset']
+        down_offset = self.args.usable_power['down_offset']
+        high = self.polynomial(ws) + self.width/up_offset if self.polynomial(ws) + self.width/up_offset < self.opt.cap else self.opt.cap
+        low = self.polynomial(ws) - self.width/down_offset if self.polynomial(ws) - self.width/down_offset > 0 else 0
+        if low <= real_power <= high:
+            return True
+        else:
+            return False
+
+    def clean_limited_power(self, name):
+        glob_rp = self.segment_statis()
+        self.mapping_relation(glob_rp)
+        new_weather_power, number = [], 0
+        # fig, ax = plt.subplots()
+        for index, row in self.weather_power.iterrows():
+            zfs = row[self.args.usable_power["env"]]
+            rp = row['C_REAL_VALUE']
+            if zfs < 0 or rp < 0:
+                continue
+            if self.filter_unlimited_power(zfs, rp) and zfs <= self.max_ws:
+                row['c'] = 'red'
+                new_weather_power.append(row)
+            else:
+                row['c'] = 'blue'
+                new_weather_power.append(row)
+        new_weather_power = pd.concat(new_weather_power, axis=1).T
+        new_weather_power.plot.scatter(x=self.args.usable_power["env"], y='C_REAL_VALUE', c='c')
+        plt.savefig(parent_path + '/figs/测风法{}.png'.format(name))
+        new_weather_power = new_weather_power[new_weather_power['c'] == 'red']
+        number = len(new_weather_power)
+        self.logger.info("未清洗限电前,总共有:{}条数据".format(len(self.weather_power)))
+        self.logger.info("清除限电后保留的点有:" + str(number) + " 占比:" + str(round(number / len(self.weather_power), 2)))
+        return new_weather_power.loc[:, ['C_TIME', 'C_REAL_VALUE', 'C_ABLE_VALUE', self.args.usable_power['env']]]
+
+
+if __name__ == '__main__':
+    from logs import Log
+    log = Log().logger
+    args = {}
+    # 实例化配置类
+    power = pd.read_csv('./data/power.csv')
+    weather = pd.read_csv('./data/tower-1-process.csv')
+    weather_power = pd.merge(weather, power, on='C_TIME')  # 联立数据
+    lp = LimitPower(log, args, weather_power)
+    # glob_rp = lp.segment_statis()
+    # lp.mapping_relation(glob_rp)
+    lp.clean_limited_power('测试1')
+    # glob_rp = {k: glob_rp[k] for k in sorted(glob_rp.keys())}
+    # keys = list(glob_rp.keys())
+    # values = [v[0] for v in glob_rp.values()]
+    # import matplotlib.pyplot as plt
+    # fig, ax = plt.subplots()
+    # ax.plot(keys, values)
+    # plt.show()

+ 0 - 10
data_processing/processing_limit_power/processing_limit_power_by_wind/processing_limit_power_by_wind.py

@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-# -*- coding:utf-8 -*-
-# @FileName  :processing_limit_power_by_wind.py
-# @Time      :2024/12/3 14:32
-# @Author    :David
-# @Company: shenyang JY
- 
- 
-if __name__ == "__main__":
-    run_code = 0

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


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

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

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

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

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

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

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

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

+ 0 - 16
evaluation_processing/analysis_report/Dockerfile

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

BIN
evaluation_processing/analysis_report/__pycache__/analysis.cpython-39.pyc


+ 0 - 9
evaluation_processing/analysis_report/requirements.txt

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

+ 0 - 131
evaluation_processing/analysis_report/test.ipynb

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

+ 0 - 0
evaluation_processing/evaluation_accuracy/evaluation_accuracy.py → evaluation_processing/evaluation_accuracy.py


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

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

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

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

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

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

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

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

+ 0 - 16
evaluation_processing/evaluation_accuracy/Dockerfile

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

+ 0 - 6
evaluation_processing/evaluation_accuracy/requirements.txt

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

+ 0 - 830
evaluation_processing/evaluation_accuracy/test.ipynb

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

Some files were not shown because too many files changed in this diff