In [1]:
from paramiko import SSHClient, SSHConfig
import os
import sys
sys.path.append('../../')
import datetime
import calendar
from xml.dom import minidom
from lxml import etree
In [2]:
from disaggregator import GreenButtonDatasetAdapter as gbda
In [3]:
from disaggregator import appliance
In [4]:
reload(appliance)
Out[4]:
In [5]:
import get_files
In [6]:
reload(get_files)
Out[6]:
In [ ]:
f = get_files.get()
In [95]:
fi = f[0].read()
In [96]:
fi
Out[96]:
In [51]:
file_strings=[t+'\n </IntervalBlock>\n </content>\n </entry>\n</feed>' for t in file_strings]
In [42]:
xml_string = file_strings[1]
xmldoc = minidom.parseString(xml_string)
In [43]:
trace = gbda.get_trace_from_xml(file_strings[1])
In [53]:
traces = [gbda.get_trace_from_xml(t) for t in file_strings]
In [54]:
traces[0].metadata
Out[54]:
In [101]:
trace.series.index.month
Out[101]:
In [60]:
def get_month_info(year,month):
day_one = calendar.monthrange(year,month)[0]
day_last = calendar.monthrange(year,month)[1]
range_start = datetime.datetime(year,month,day_one,0,0)
range_end = datetime.datetime(year,month,day_last,0,0)
good_traces = []
for t in traces:
rng = [dt.to_datetime() for dt in t.series.index]
if range_start in rng and range_end in rng:
good_traces.append(t)
return good_traces
In [61]:
gt = get_month_info(2014,6)