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,6 +198,11 @@ class MultiPointData(MultiData):
self.style_params = style_params or {}
def __getitem__(self, index):
:param index:
int or list or array of ints
if np.isscalar(index):
lon = self.lons[index]
lat = self.lats[index]
z = self.z[index]
......@@ -206,6 +211,16 @@ class MultiPointData(MultiData):
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,
def from_points(cls, point_list):
Supports Markdown
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