Commit 33eeb4be authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Allowed 'index' argument of __getitem__ method to be integer list or array.

git-svn-id: 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent 99b23456
...@@ -198,14 +198,29 @@ class MultiPointData(MultiData): ...@@ -198,14 +198,29 @@ class MultiPointData(MultiData):
self.style_params = style_params or {} self.style_params = style_params or {}
def __getitem__(self, index): def __getitem__(self, index):
lon = self.lons[index] """
lat = self.lats[index] :param index:
z = self.z[index] int or list or array of ints
value = self._get_value_at_index(index) """
label = self._get_label_at_index(index) if np.isscalar(index):
style_params = self._get_style_params_at_index(index) lon = self.lons[index]
return PointData(lon, lat, z=z, value=value, label=label, lat = self.lats[index]
style_params=style_params) z = self.z[index]
value = self._get_value_at_index(index)
label = self._get_label_at_index(index)
style_params = self._get_style_params_at_index(index)
return PointData(lon, lat, z=z, value=value, label=label,
idxs = np.asarray(index)
lons = self.lons[idxs]
lats = self.lats[idxs]
z = [self.z[index] for index in idxs]
values = self._get_values_at_indexes(idxs)
labels = self._get_labels_at_indexes(idxs)
style_params = self._get_style_params_at_indexes(idxs)
return MultiPointData(lons, lats, z=z, values=values, labels=labels,
@classmethod @classmethod
def from_points(cls, point_list): def from_points(cls, point_list):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment