{"action":"created","comment":{"url":"https://api.github.com/repos/xray/xray/pulls/comments/35367867","id":35367867,"diff_hunk":"@@ -1028,6 +1029,82 @@ def sel(self, method=None, **indexers):\n         return self.isel(**indexing.remap_label_indexers(self, indexers,\n                                                          method=method))\n \n+    def isel_points(self, dim='points', **indexers):\n+        \"\"\"Returns a new dataset with each array indexed pointwise along the\n+        specified dimension(s).\n+\n+        This method selects pointwise values from each array and is akin to\n+        the NumPy indexing behavior of `arr[[0, 1], [0, 1]]`, except this\n+        method does not require knowing the order of each array's dimensions.\n+\n+        Parameters\n+        ----------\n+        dim : str or DataArray or pandas.Index, optinal\n+            Name of the dimension to concatenate along. This can either be a\n+            new dimension name, in which case it is added along axis=0, or an\n+            existing dimension name, in which case the location of the\n+            dimension is unchanged. If dimension is provided as a DataArray or\n+            Index, its name is used as the dimension to concatenate along and\n+            the values are added as a coordinate. Existing dimension names are\n+            not valid choices.\n+        **indexers : {dim: indexer, ...}\n+            Keyword arguments with names matching dimensions and values given\n+            by array-like objects. All indexers must be the same length and\n+            1 dimensional.\n+\n+        Returns\n+        -------\n+        obj : Dataset\n+            A new Dataset with the same contents as this dataset, except each\n+            array and dimension is indexed by the appropriate indexers. With\n+            pointwise indexing, the new Dataset will always be a copy of the\n+            original.\n+\n+        See Also\n+        --------\n+        Dataset.sel\n+        DataArray.isel\n+        DataArray.sel\n+        DataArray.isel_points\n+        \"\"\"\n+        indexer_dims = set(indexers)\n+\n+        def relevant_keys(mapping):\n+            return [k for k, v in mapping.items()\n+                    if any(d in indexer_dims for d in v.dims)]\n+\n+        data_vars = relevant_keys(self.data_vars)\n+        coords = relevant_keys(self.coords)\n+\n+        # all the indexers should be iterables\n+        keys = indexers.keys()\n+        indexers = [(k, np.asarray(v)) for k, v in iteritems(indexers)]\n+        # Check that indexers are valid dims, integers, and 1D\n+        for k, v in indexers:\n+            if k not in self.dims:\n+                raise ValueError(\"dimension %s does not exist\" % k)\n+            if v.dtype.kind != 'i':\n+                raise TypeError('Indexers must be integers')\n+            if v.ndim != 1:\n+                raise ValueError('Indexers must be 1 dimensional')\n+\n+        # all the indexers should have the same length\n+        lengths = set(len(v) for k, v in indexers)\n+        if len(lengths) > 1:\n+            raise ValueError('All indexers must be the same length')\n+\n+        # Existing dimensions are not valid choices for the dim argument\n+        if dim in self.dims:","path":"xray/core/dataset.py","position":85,"original_position":85,"commit_id":"bf0915b11555dbe68cfacf68c0f18d43e75a4887","original_commit_id":"bf0915b11555dbe68cfacf68c0f18d43e75a4887","user":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"body":"Indeed.  Happy to write that test. However, I'm actually having trouble picturing the use case here. Do you have an example? ","created_at":"2015-07-23T20:32:57Z","updated_at":"2015-07-23T20:32:57Z","html_url":"https://github.com/xray/xray/pull/481#discussion_r35367867","pull_request_url":"https://api.github.com/repos/xray/xray/pulls/481","_links":{"self":{"href":"https://api.github.com/repos/xray/xray/pulls/comments/35367867"},"html":{"href":"https://github.com/xray/xray/pull/481#discussion_r35367867"},"pull_request":{"href":"https://api.github.com/repos/xray/xray/pulls/481"}}},"pull_request":{"url":"https://api.github.com/repos/xray/xray/pulls/481","id":40324635,"html_url":"https://github.com/xray/xray/pull/481","diff_url":"https://github.com/xray/xray/pull/481.diff","patch_url":"https://github.com/xray/xray/pull/481.patch","issue_url":"https://api.github.com/repos/xray/xray/issues/481","number":481,"state":"open","locked":false,"title":"Add pointwise indexing via isel_points method","user":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"body":"This provides behavior equivalent to numpy slicing with multiple lists.\r\n\r\nExample\r\n-------\r\n\r\n```python\r\n>>> da = xray.DataArray(np.arange(56).reshape((7, 8)), dims=['x', 'y'])\r\n>>> da\r\n<xray.DataArray (x: 7, y: 8)>\r\narray([[ 0,  1,  2,  3,  4,  5,  6,  7],\r\n       [ 8,  9, 10, 11, 12, 13, 14, 15],\r\n       [16, 17, 18, 19, 20, 21, 22, 23],\r\n       [24, 25, 26, 27, 28, 29, 30, 31],\r\n       [32, 33, 34, 35, 36, 37, 38, 39],\r\n       [40, 41, 42, 43, 44, 45, 46, 47],\r\n       [48, 49, 50, 51, 52, 53, 54, 55]])\r\nCoordinates:\r\n  * x        (x) int64 0 1 2 3 4 5 6\r\n  * y        (y) int64 0 1 2 3 4 5 6 7\r\n>>> da.isel_points(x=[0, 1, 6], y=[0, 1, 0])\r\n<xray.DataArray (points: 3)>\r\narray([ 0,  9, 48])\r\nCoordinates:\r\n    y        (points) int64 0 1 0\r\n    x        (points) int64 0 1 6\r\n  * points   (points) int64 0 1 2\r\n```\r\n\r\nrelated: #475","created_at":"2015-07-20T05:41:36Z","updated_at":"2015-07-23T20:32:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"244e69ade88ed91dab8b871b9af2ba73cab6e065","assignee":null,"milestone":{"url":"https://api.github.com/repos/xray/xray/milestones/14","html_url":"https://github.com/xray/xray/milestones/0.6","labels_url":"https://api.github.com/repos/xray/xray/milestones/14/labels","id":1213895,"number":14,"title":"0.6","description":"","creator":{"login":"shoyer","id":1217238,"avatar_url":"https://avatars.githubusercontent.com/u/1217238?v=3","gravatar_id":"","url":"https://api.github.com/users/shoyer","html_url":"https://github.com/shoyer","followers_url":"https://api.github.com/users/shoyer/followers","following_url":"https://api.github.com/users/shoyer/following{/other_user}","gists_url":"https://api.github.com/users/shoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoyer/subscriptions","organizations_url":"https://api.github.com/users/shoyer/orgs","repos_url":"https://api.github.com/users/shoyer/repos","events_url":"https://api.github.com/users/shoyer/events{/privacy}","received_events_url":"https://api.github.com/users/shoyer/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2015-07-18T05:12:09Z","updated_at":"2015-07-21T01:24:08Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/xray/xray/pulls/481/commits","review_comments_url":"https://api.github.com/repos/xray/xray/pulls/481/comments","review_comment_url":"https://api.github.com/repos/xray/xray/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xray/xray/issues/481/comments","statuses_url":"https://api.github.com/repos/xray/xray/statuses/bf0915b11555dbe68cfacf68c0f18d43e75a4887","head":{"label":"jhamman:feature/isel_points","ref":"feature/isel_points","sha":"bf0915b11555dbe68cfacf68c0f18d43e75a4887","user":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"repo":{"id":17182939,"name":"xray","full_name":"jhamman/xray","owner":{"login":"jhamman","id":2443309,"avatar_url":"https://avatars.githubusercontent.com/u/2443309?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamman","html_url":"https://github.com/jhamman","followers_url":"https://api.github.com/users/jhamman/followers","following_url":"https://api.github.com/users/jhamman/following{/other_user}","gists_url":"https://api.github.com/users/jhamman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamman/subscriptions","organizations_url":"https://api.github.com/users/jhamman/orgs","repos_url":"https://api.github.com/users/jhamman/repos","events_url":"https://api.github.com/users/jhamman/events{/privacy}","received_events_url":"https://api.github.com/users/jhamman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhamman/xray","description":"Objects for holding self describing scientific data in python.","fork":true,"url":"https://api.github.com/repos/jhamman/xray","forks_url":"https://api.github.com/repos/jhamman/xray/forks","keys_url":"https://api.github.com/repos/jhamman/xray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhamman/xray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhamman/xray/teams","hooks_url":"https://api.github.com/repos/jhamman/xray/hooks","issue_events_url":"https://api.github.com/repos/jhamman/xray/issues/events{/number}","events_url":"https://api.github.com/repos/jhamman/xray/events","assignees_url":"https://api.github.com/repos/jhamman/xray/assignees{/user}","branches_url":"https://api.github.com/repos/jhamman/xray/branches{/branch}","tags_url":"https://api.github.com/repos/jhamman/xray/tags","blobs_url":"https://api.github.com/repos/jhamman/xray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhamman/xray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhamman/xray/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhamman/xray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhamman/xray/statuses/{sha}","languages_url":"https://api.github.com/repos/jhamman/xray/languages","stargazers_url":"https://api.github.com/repos/jhamman/xray/stargazers","contributors_url":"https://api.github.com/repos/jhamman/xray/contributors","subscribers_url":"https://api.github.com/repos/jhamman/xray/subscribers","subscription_url":"https://api.github.com/repos/jhamman/xray/subscription","commits_url":"https://api.github.com/repos/jhamman/xray/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhamman/xray/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhamman/xray/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhamman/xray/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhamman/xray/contents/{+path}","compare_url":"https://api.github.com/repos/jhamman/xray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhamman/xray/merges","archive_url":"https://api.github.com/repos/jhamman/xray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhamman/xray/downloads","issues_url":"https://api.github.com/repos/jhamman/xray/issues{/number}","pulls_url":"https://api.github.com/repos/jhamman/xray/pulls{/number}","milestones_url":"https://api.github.com/repos/jhamman/xray/milestones{/number}","notifications_url":"https://api.github.com/repos/jhamman/xray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhamman/xray/labels{/name}","releases_url":"https://api.github.com/repos/jhamman/xray/releases{/id}","created_at":"2014-02-25T18:09:57Z","updated_at":"2015-04-07T17:39:11Z","pushed_at":"2015-07-23T14:29:57Z","git_url":"git://github.com/jhamman/xray.git","ssh_url":"git@github.com:jhamman/xray.git","clone_url":"https://github.com/jhamman/xray.git","svn_url":"https://github.com/jhamman/xray","homepage":null,"size":4477,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xray:master","ref":"master","sha":"1faf1b2cbf0cbed1d1b62b71df4aec8dbe63bb99","user":{"login":"xray","id":7505795,"avatar_url":"https://avatars.githubusercontent.com/u/7505795?v=3","gravatar_id":"","url":"https://api.github.com/users/xray","html_url":"https://github.com/xray","followers_url":"https://api.github.com/users/xray/followers","following_url":"https://api.github.com/users/xray/following{/other_user}","gists_url":"https://api.github.com/users/xray/gists{/gist_id}","starred_url":"https://api.github.com/users/xray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xray/subscriptions","organizations_url":"https://api.github.com/users/xray/orgs","repos_url":"https://api.github.com/users/xray/repos","events_url":"https://api.github.com/users/xray/events{/privacy}","received_events_url":"https://api.github.com/users/xray/received_events","type":"Organization","site_admin":false},"repo":{"id":13221727,"name":"xray","full_name":"xray/xray","owner":{"login":"xray","id":7505795,"avatar_url":"https://avatars.githubusercontent.com/u/7505795?v=3","gravatar_id":"","url":"https://api.github.com/users/xray","html_url":"https://github.com/xray","followers_url":"https://api.github.com/users/xray/followers","following_url":"https://api.github.com/users/xray/following{/other_user}","gists_url":"https://api.github.com/users/xray/gists{/gist_id}","starred_url":"https://api.github.com/users/xray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xray/subscriptions","organizations_url":"https://api.github.com/users/xray/orgs","repos_url":"https://api.github.com/users/xray/repos","events_url":"https://api.github.com/users/xray/events{/privacy}","received_events_url":"https://api.github.com/users/xray/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xray/xray","description":"N-D labeled arrays and datasets in Python","fork":false,"url":"https://api.github.com/repos/xray/xray","forks_url":"https://api.github.com/repos/xray/xray/forks","keys_url":"https://api.github.com/repos/xray/xray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xray/xray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xray/xray/teams","hooks_url":"https://api.github.com/repos/xray/xray/hooks","issue_events_url":"https://api.github.com/repos/xray/xray/issues/events{/number}","events_url":"https://api.github.com/repos/xray/xray/events","assignees_url":"https://api.github.com/repos/xray/xray/assignees{/user}","branches_url":"https://api.github.com/repos/xray/xray/branches{/branch}","tags_url":"https://api.github.com/repos/xray/xray/tags","blobs_url":"https://api.github.com/repos/xray/xray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xray/xray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xray/xray/git/refs{/sha}","trees_url":"https://api.github.com/repos/xray/xray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xray/xray/statuses/{sha}","languages_url":"https://api.github.com/repos/xray/xray/languages","stargazers_url":"https://api.github.com/repos/xray/xray/stargazers","contributors_url":"https://api.github.com/repos/xray/xray/contributors","subscribers_url":"https://api.github.com/repos/xray/xray/subscribers","subscription_url":"https://api.github.com/repos/xray/xray/subscription","commits_url":"https://api.github.com/repos/xray/xray/commits{/sha}","git_commits_url":"https://api.github.com/repos/xray/xray/git/commits{/sha}","comments_url":"https://api.github.com/repos/xray/xray/comments{/number}","issue_comment_url":"https://api.github.com/repos/xray/xray/issues/comments{/number}","contents_url":"https://api.github.com/repos/xray/xray/contents/{+path}","compare_url":"https://api.github.com/repos/xray/xray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xray/xray/merges","archive_url":"https://api.github.com/repos/xray/xray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xray/xray/downloads","issues_url":"https://api.github.com/repos/xray/xray/issues{/number}","pulls_url":"https://api.github.com/repos/xray/xray/pulls{/number}","milestones_url":"https://api.github.com/repos/xray/xray/milestones{/number}","notifications_url":"https://api.github.com/repos/xray/xray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xray/xray/labels{/name}","releases_url":"https://api.github.com/repos/xray/xray/releases{/id}","created_at":"2013-09-30T17:21:10Z","updated_at":"2015-07-23T16:50:58Z","pushed_at":"2015-07-23T20:28:19Z","git_url":"git://github.com/xray/xray.git","ssh_url":"git@github.com:xray/xray.git","clone_url":"https://github.com/xray/xray.git","svn_url":"https://github.com/xray/xray","homepage":"http://xray.readthedocs.org","size":7226,"stargazers_count":213,"watchers_count":213,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":63,"forks":55,"open_issues":63,"watchers":213,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xray/xray/pulls/481"},"html":{"href":"https://github.com/xray/xray/pull/481"},"issue":{"href":"https://api.github.com/repos/xray/xray/issues/481"},"comments":{"href":"https://api.github.com/repos/xray/xray/issues/481/comments"},"review_comments":{"href":"https://api.github.com/repos/xray/xray/pulls/481/comments"},"review_comment":{"href":"https://api.github.com/repos/xray/xray/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xray/xray/pulls/481/commits"},"statuses":{"href":"https://api.github.com/repos/xray/xray/statuses/bf0915b11555dbe68cfacf68c0f18d43e75a4887"}}}}