def calculate_bounds(self): """ Calculate the time_range, depth_range, bbox, and size of this collection. Will scan all data. Ensures that .size, .bbox and .time_range return non-null. If the collection already knows its bbox; time_range; and/or size, they are recomputed. """ # tell all contained profiles to calculate their bounds list([x.calculate_bounds() for x in self._elements]) # @TODO size is just number of timesteps? self.size = len(self._elements) # bbox is just this point self.bbox = MultiPoint([self.location, self.location]).envelope time_set = set() list(map(time_set.add, AsaList.flatten([p.time for p in self._elements]))) self.time_range = sorted(list(time_set)) depth_set = set() list(map(depth_set.add, AsaList.flatten([p.depth_range for p in self._elements]))) self.depth_range = sorted(list(depth_set))
def calculate_bounds(self): """ Calculate the time_range, bbox, and size of this collection. Will scan all data. Ensures that .size, .bbox and .time_range return non-null. If the collection already knows its bbox; time_range; and/or size, they are recomputed. """ single_point_collection = PointCollection(elements=list(AsaList.flatten(self))) single_point_collection.calculate_bounds() self.bbox = single_point_collection.bbox self.time_range = single_point_collection.time_range self.depth_range = single_point_collection.depth_range self._point_size = single_point_collection.size self.size = len(self._elements)
def calculate_bounds(self): """ Calculate the time_range, bbox, and size of this collection. Will scan all data. Ensures that .size, .bbox and .time_range return non-null. If the collection already knows its bbox; time_range; and/or size, they are recomputed. """ single_point_collection = PointCollection( elements=list(AsaList.flatten(self))) single_point_collection.calculate_bounds() self.bbox = single_point_collection.bbox self.time_range = single_point_collection.time_range self.depth_range = single_point_collection.depth_range self._point_size = single_point_collection.size self.size = len(self._elements)
def flatten(self): """ Returns a Generator of Points that are part of this collection """ return AsaList.flatten(self)