示例#1
0
    def from_until_sample(self, start, end, sample_period=None, skip=None, fields=None):
        """ retrieve service from start to end date as numpy array. 

        start : starttime in FJD
        end   : end time in FJD 

        keyword arguments:

        sample_period : time(in days) into which the request should be splitted --> skip
        skip   : number of periods, which should be skipped during request
        fields : list of field names to be requested [default: all fields]
        """
        if not sample_period is None:
            sample_boundaries = np.arange(start, end, sample_period)
        else:
            sample_boundaries = np.array([start, end])

        

        samples_start = sample_boundaries[0:-1:skip]
        samples_end = sample_boundaries[1::skip]
        dict_list = []
        for _start, _end in zip(samples_start, samples_end):
            start_stop_dict = {  "Time":{
                                         "$gte": float(_start), 
                                         "$lt": float(_end)}}
            dict_list.append(start_stop_dict)

        if not fields is None:
            cursor = self.__collection.find({"$or": dict_list }, fields=fields)
        else:
            cursor = self.__collection.find({"$or": dict_list })

        return tools.cursor_to_structured_array(cursor)
示例#2
0
 def from_until(self, start, end):
     """ retrieve field from start to end date as numpy array.
     """
     cursor = self.__collection.find({"Time": {"$gte": start, "$lt": end}})
     return tools.cursor_to_structured_array(cursor)