Skip to content

Commit

Permalink
Add battery props to formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartySchwarz committed Sep 23, 2021
1 parent 33e7d3d commit a506ddc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions marmot/marmot_h5_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,24 @@ def df_process_abatement(self):
df[0] = pd.to_numeric(df[0], downcast='float')
return df

def df_process_batterie(self):
"""
Method for formatting data which comes form the PLEXOS Batteries Class
Returns
-------
df : pd.DataFrame
Processed Output, single value column with multiindex.
"""
df = self.df.droplevel(level=["band", "property"])
df = pd.DataFrame(data=df.values.reshape(-1), index=df.index)
df_col = list(df.index.names) # Gets names of all columns in df and places in list
df_col.insert(0, df_col.pop(df_col.index("timestamp"))) # move timestamp to start of df
df = df.reorder_levels(df_col, axis=0)
df[0] = pd.to_numeric(df[0], downcast='float')
return df

class MarmotFormat(SetupLogger):
"""Main module class to be instantiated to run the formatter.
Expand Down

0 comments on commit a506ddc

Please sign in to comment.