def calcweather(frm, periodo, place, destino): plant = ['Sao Pedro', 'Juazeiro', 'Sol do Futuro'] df_fin = frm df_fin = Weatherstation.readframe(df_fin) df_fin = df_fin.fillna(0.00) df_fin.rename(columns={'Date': 'timestamp'}, inplace=True) del df_fin['Time'] direct = steagsupports_factory.sheetdestination( destino, periodo, place) namestamp = f'{plant[place - 1]}-data-{periodo}-Weather station' sheetname = r'{}\{}.csv'.format(direct, namestamp) df_fin.to_csv(sheetname, index=False) print('Arquivo "{}" salvo com sucesso!!!'.format(namestamp))
def calcinverter(frm, periodo, place, destino): df = frm.fillna(0.00) column = df.columns.values lista_plant = Inverter.organizetuplainverter(column) files = steagsupports_factory.sheetdestination(destino, periodo, place) numberinv = 0 for i in lista_plant: columnfilter = [column[0], column[1], i[0], i[1]] df_fin = df.filter(items=columnfilter) df_fin = Inverter.readframe(df_fin) df_fin = df_fin[[column[0], i[0], i[1]]] df_fin.rename(columns={'Date': 'timestamp', i[0]: 'ACTIVE POWER', i[1]: 'COMS STATUS'}, inplace=True) namesfile = Inverter.stamp(periodo, i[0], place, 'Inverter') sheetname = r'{}\{}.csv'.format(files, namesfile) df_fin.to_csv(sheetname, index=False) numberinv += 1 print('Arquivo "{}" salvo com sucesso!!!'.format(namesfile))
def calcstrings(frm, periodo, place, destino): df = frm.fillna(0.00) column = df.columns.values files = steagsupports_factory.sheetdestination(destino, periodo, place) for i in range(2, len(column)): columnfilter = [column[0], column[1], column[i]] df_fin = df.filter(items=columnfilter) df_fin = Strings.readframe(df_fin) df_fin = df_fin[[column[0], column[i]]] df_fin[column[i]] = df_fin[[column[i]]].astype(float) labelcolumn = Strings.labelstampstring(place, column[i]) df_fin.rename(columns={ 'Date': 'timestamp', column[i]: labelcolumn }, inplace=True) namesfile = Strings.stamp2(periodo, column[i], place, 'String') sheetname = r'{}\{}.csv'.format(files, namesfile) df_fin.to_csv(sheetname, index=False) print('Arquivo "{}" salvo com sucesso!!!'.format(namesfile))
def calcstringsbox(frm, periodo, place, destino): df = frm.fillna(0.00) column = df.columns.values lista_plant = Stringbox.organizetuplastringsbox(column) files = steagsupports_factory.sheetdestination(destino, periodo, place) for i in lista_plant: columnfilter = [column[0], column[1], i[1], i[2], i[0]] df_fin = df.filter(items=columnfilter) df_fin = Stringbox.readframe(df_fin) df_fin = df_fin[[column[0], i[1], i[2], i[0]]] df_fin.rename(columns={ 'Date': 'timestamp', i[1]: 'Current', i[2]: 'Power', i[0]: 'COMS STATUS' }, inplace=True) namesfile = Stringbox.stamp1(periodo, i[0], place, 'String box') sheetname = r'{}\{}.csv'.format(files, namesfile) df_fin.to_csv(sheetname, index=False) print('Arquivo "{}" salvo com sucesso!!!'.format(namesfile))