|
@@ -6,6 +6,7 @@ import pymysql
|
|
|
from sqlalchemy import create_engine
|
|
|
import pytz
|
|
|
from getdata.data_cleaning import cleaning, rm_duplicated
|
|
|
+import utils.savedata
|
|
|
current_path = os.path.dirname(__file__)
|
|
|
dataloc = current_path + '/data/'
|
|
|
weatherloc = [1]
|
|
@@ -139,7 +140,7 @@ class DataBase(object):
|
|
|
NWP = cleaning(NWP, 'NWP')
|
|
|
# NWP = self.split_time(NWP)
|
|
|
NWP['C_TIME'] = NWP['C_TIME'].dt.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
- saveData("NWP.csv", NWP)
|
|
|
+ utils.saveData("NWP.csv", NWP)
|
|
|
print("导出nwp数据")
|
|
|
return NWP
|
|
|
|
|
@@ -168,7 +169,7 @@ class DataBase(object):
|
|
|
weather = self.exec_sql(weather_sql, engine)
|
|
|
weather['C_TIME'] = pd.to_datetime(weather['C_TIME'])
|
|
|
# weather = self.split_time(weather)
|
|
|
- saveData("/weather-{}.csv".format(i), weather)
|
|
|
+ utils.saveData("/weather-{}.csv".format(i), weather)
|
|
|
print("环境监测仪{}导出数据".format(i))
|
|
|
|
|
|
def get_process_power(self):
|
|
@@ -196,7 +197,7 @@ class DataBase(object):
|
|
|
binary_map = {b'\x00': 0, b'\x01': 1}
|
|
|
powers['C_IS_RATIONING_BY_AUTO_CONTROL'] = powers['C_IS_RATIONING_BY_AUTO_CONTROL'].map(binary_map)
|
|
|
powers = rm_duplicated(powers)
|
|
|
- saveData("power.csv", powers)
|
|
|
+ utils.saveData("power.csv", powers)
|
|
|
|
|
|
def get_process_dq(self):
|
|
|
"""
|
|
@@ -214,7 +215,7 @@ class DataBase(object):
|
|
|
# dq.drop('C_FORECAST_HOW_LONG_AGO', axis=1, inplace=True)
|
|
|
dq = cleaning(dq, 'dq', cols=['C_FP_VALUE'])
|
|
|
dq['C_TIME'] = dq['C_TIME'].dt.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
- saveData("dq.csv", dq)
|
|
|
+ utils.saveData("dq.csv", dq)
|
|
|
print("导出dq数据")
|
|
|
|
|
|
def get_process_cdq(self):
|
|
@@ -232,7 +233,7 @@ class DataBase(object):
|
|
|
cdq = cleaning(cdq, 'cdq', cols=['C_ABLE_VALUE'], dup=False)
|
|
|
# cdq = cdq[cdq['C_FORECAST_HOW_LONG_AGO'] == int(str(self.opt.predict_point)[1:])]
|
|
|
cdq['C_TIME'] = cdq['C_TIME'].dt.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
- saveData("cdq.csv", cdq)
|
|
|
+ utils.saveData("cdq.csv", cdq)
|
|
|
|
|
|
def indep_process(self):
|
|
|
"""
|
|
@@ -243,7 +244,7 @@ class DataBase(object):
|
|
|
for i in weatherloc:
|
|
|
weather = readData("/weather-{}.csv".format(i))
|
|
|
weather = cleaning(weather, 'weather', cols=['C_GLOBALR', 'C_DIRECTR', 'C_DIFFUSER', 'C_RH', 'C_AIRT', 'C_P', 'C_WS', 'C_WD'])
|
|
|
- saveData("/weather-{}-process.csv".format(i), weather)
|
|
|
+ utils.saveData("/weather-{}-process.csv".format(i), weather)
|
|
|
|
|
|
def data_process(self):
|
|
|
"""
|