更新 SCADA 数据导入函数
This commit is contained in:
@@ -4602,7 +4602,7 @@ def import_multicolumn_data_from_file(
|
||||
)
|
||||
|
||||
def convert_to_iso(timestr):
|
||||
# 假设原格式为 '2025/8/3 0:00'
|
||||
# 假设原格式为 '2025-08-03 00:00:00'
|
||||
dt = datetime.strptime(timestr, "%Y-%m-%d %H:%M:%S")
|
||||
return dt.isoformat()
|
||||
|
||||
@@ -4627,8 +4627,8 @@ def import_multicolumn_data_from_file(
|
||||
.tag("description", None)
|
||||
.tag("device_ID", scada_id)
|
||||
.field("monitored_value", raw_value)
|
||||
.field("datacleaning_value", 0.0)
|
||||
.field("simulation_value", 0.0)
|
||||
# .field("datacleaning_value", 0.0)
|
||||
# .field("simulation_value", 0.0)
|
||||
.time(iso_time, WritePrecision.S)
|
||||
)
|
||||
points_to_write.append(point)
|
||||
@@ -4649,9 +4649,9 @@ def import_multicolumn_data_from_file(
|
||||
.tag("date", iso_time.split("T")[0])
|
||||
.tag("description", "None")
|
||||
.tag("device_ID", scada_id)
|
||||
.field("monitored_value", 0.0)
|
||||
# .field("monitored_value", 0.0)
|
||||
.field("datacleaning_value", datacleaning_value)
|
||||
.field("simulation_value", 0.0)
|
||||
# .field("simulation_value", 0.0)
|
||||
.time(iso_time, WritePrecision.S)
|
||||
)
|
||||
points_to_write.append(point)
|
||||
@@ -4708,24 +4708,24 @@ def import_multicolumn_data_from_dict(
|
||||
# 如果是原始数据,写入monitored_value
|
||||
point = (
|
||||
Point("SCADA")
|
||||
.tag("date", time_str.split("T")[0])
|
||||
.tag("date", datetime.fromisoformat(time_str).date().isoformat())
|
||||
.tag("description", None)
|
||||
.tag("device_ID", device_id)
|
||||
.field("monitored_value", float_value)
|
||||
.field("datacleaning_value", 0.0)
|
||||
.field("simulation_value", 0.0)
|
||||
# .field("datacleaning_value", 0.0)
|
||||
# .field("simulation_value", 0.0)
|
||||
.time(time_str, WritePrecision.S)
|
||||
)
|
||||
else:
|
||||
# 如果是清洗数据,写入datacleaning_value
|
||||
point = (
|
||||
Point("SCADA")
|
||||
.tag("date", time_str.split("T")[0])
|
||||
.tag("date", datetime.fromisoformat(time_str).date().isoformat())
|
||||
.tag("description", "None")
|
||||
.tag("device_ID", device_id)
|
||||
.field("monitored_value", 0.0)
|
||||
# .field("monitored_value", 0.0)
|
||||
.field("datacleaning_value", float_value)
|
||||
.field("simulation_value", 0.0)
|
||||
# .field("simulation_value", 0.0)
|
||||
.time(time_str, WritePrecision.S)
|
||||
)
|
||||
points_to_write.append(point)
|
||||
|
||||
2
main.py
2
main.py
@@ -4154,7 +4154,7 @@ async def fastapi_scada_device_data_cleaning(
|
||||
elif device_type == "pipe_flow":
|
||||
cleaned_value_df = api_ex.Fdataclean.clean_flow_data_dict(value_df)
|
||||
|
||||
# 添加 time 列到首列
|
||||
# 添加 time 列到首列
|
||||
cleaned_value_df = pd.DataFrame(cleaned_value_df)
|
||||
# 只选择以 '_cleaned' 结尾的清洗数据列
|
||||
cleaned_columns = [
|
||||
|
||||
Reference in New Issue
Block a user