Exemplo n.º 1
0
    def parse(self):
        data = self.data[0]
        if not data or 'values' not in data:
            raise NoData
        bd = data['beginDate']
        ed = data['endDate']
        dates = fill_date_range(bd, ed, date_format='%Y-%m-%d %H:%M:%S')
        vals = as_list(data['values'])
        flags = as_list(data['flags'])

        self.data = [{
            'date': date,
            'value': val,
            'flag': flag
        } for date, val, flag in zip(dates, vals, flags)]
Exemplo n.º 2
0
    def parse(self):
        data = self.data[0]
        if not data or 'values' not in data:
            raise NoData
        bd = data['beginDate']
        ed = data['endDate']
        dates = fill_date_range(bd, ed, date_format='%Y-%m-%d %H:%M:%S')
        vals = as_list(data['values'])
        flags = as_list(data['flags'])

        self.data = [{
            'date': date,
            'value': val,
            'flag': flag
        } for date, val, flag in zip(dates, vals, flags)]
Exemplo n.º 3
0
 def load(self):
     super(HourlyDataIO, self).load()
     if self.data and 'values' in self.data[0]:
         self.data = [
             asdict(row)
             for row in as_list(self.data[0]['values'])
         ]
     else:
         raise NoData
Exemplo n.º 4
0
 def load(self):
     if self.debug:
         self.print_debug()
     params = self.params
     fn = getattr(server, self.data_function)
     self.data = simplify(fn(**params))
     if self.data == {}:
         self.data = []
     else:
         self.data = as_list(self.data)
Exemplo n.º 5
0
 def load(self):
     super(HourlyDataIO, self).load()
     d = {
     }  # since mutiple triplets can be used, then go through each station
     for data in self.data:
         stationTriplet = data['stationTriplet']
         if data and 'values' in data:
             data = [asdict(row) for row in as_list(data['values'])]
         else:
             data = []
         d[stationTriplet] = data
     self.data = d
Exemplo n.º 6
0
 def load(self):
     if self.debug:
         self.print_debug()
     params = self.params
     fn = getattr(get_server(), self.data_function)
     self.data = fn(**params)
     if len(self.data) == 0:
         self.data = []
     else:
         self.data = as_list(self.data)
         if isinstance(self.data[0], SudsObject):
             parse = asdict
         else:
             parse = str
         self.data = [parse(row) for row in self.data]
Exemplo n.º 7
0
 def load(self):
     if self.debug:
         self.print_debug()
     params = self.params
     fn = getattr(get_server(), self.data_function)
     self.data = fn(**params)
     if len(self.data) == 0:
         self.data = []
     else:
         self.data = as_list(self.data)
         if isinstance(self.data[0], SudsObject):
             parse = asdict
         else:
             parse = str
         self.data = [parse(row) for row in self.data]
Exemplo n.º 8
0
 def load(self):
     super(HourlyDataIO, self).load()
     if self.data and 'values' in self.data[0]:
         self.data = as_list(self.data[0]['values'])
     else:
         raise NoData
Exemplo n.º 9
0
 def load(self):
     super(HourlyDataIO, self).load()
     if self.data and 'values' in self.data[0]:
         self.data = as_list(self.data[0]['values'])
     else:
         raise NoData