def handle(self, *args, **options):
        """
        Read lines from the given file, inserting the therm values in to the
        time series named by the file as data.

        The format of the lines in the file is:

            2013 08 18 16 17 73.94

        '2013.08.18T16:17 73.94 degrees F' in local time.

        NOTE: we do several readings a minute, but we do not store a seconds
              value so we need to average the values for the same minute
              together for a single value.

        Arguments:
        - `*args`: Expect one argument that is the name of the file.
        - `**options`:
        """
        file_name = os.path.basename(args[0])
        tz = pytz.timezone('US/Pacific')

        # Create our time series if it does not already exist.  If it does
        # exist, empty it out (because for the most part we are loading
        # and re-loading the same data.)
        #
        try:
            t = TimeSeries.objects.get(name=file_name)
            t.data.all().delete()
        except TimeSeries.DoesNotExist, e:
            t = TimeSeries(name=file_name)
            t.save()
Example #2
0
 def setUp(self, ):
     """
     Setup our basic timeseries object
     """
     t = TimeSeries(name="test")
     t.save()
     for x,y in TS_DATA_01:
         t.insert(y,x)
     return