def load(path, index_keys, filterkeys=None, matchtype="and"):
        """
        load stored json file (with dump() created) and return TimeseriesArrayStats object

        parameters:
        path <str> path to search for stored json file, the filename is automatically created from given index_keys
        index_keys <tuple> list of index_keys

        returns:
        <TimeseriesArray>
        """
        # logging.info("index_keys: %s", index_keys)
        infilename = os.path.join(path, TimeseriesArrayStats.get_dumpfilename(index_keys))
        try:
            fh = open(infilename, "rb")
            indata = json.load(fh)
        except StandardError as exc:
            logging.exception(exc)
            logging.error("something went wrong while loading %s", infilename)
            raise exc
        # logging.info("loaded JSON data: %s", indata)
        tsastats = TimeseriesArrayStats.__new__(TimeseriesArrayStats)
        tsastats.__index_keynames = tuple(indata["index_keys"])
        tsastats.__value_keynames = tuple(indata["value_keys"])
        tsastats.__stats = {}
        # for filename in indata["tsstat_filenames"]:
        for key, filename in tsastats.get_load_filenames(path, index_keys, filterkeys, matchtype).items():
            # logging.info("loading TimeseriesStats object from %s", fullfilename)
            filehandle = open(filename, "rb")
            tsastats.__stats[key] = TimeseriesStats.load(filehandle)
            filehandle.close()
        return tsastats
 def from_json(jsondata):
     indata = json.loads(jsondata)
     tsastats = TimeseriesArrayStats.__new__(TimeseriesArrayStats)
     tsastats.__index_keynames = indata[0]
     tsastats.__value_keynames = indata[1]
     tsastats.__stats = {}
     for key, tsstats in indata[2]:
         # from json there are only list, but these are not hashable,
         # so convert key to tuple
         tsastats.__stats[tuple(key)] = TimeseriesStats.from_json(tsstats)
     return tsastats