{"action":"created","comment":{"url":"https://api.github.com/repos/Unidata/MetPy/pulls/comments/176850527","pull_request_review_id":106632708,"id":176850527,"diff_hunk":"@@ -0,0 +1,27 @@\n+# Copyright (c) 2018 MetPy Developers.\n+# Distributed under the terms of the BSD 3-Clause License.\n+# SPDX-License-Identifier: BSD-3-Clause\n+import cartopy.feature as cfeature\n+import matplotlib.pyplot as plt\n+import xarray as xr\n+\n+import metpy.io.xarray  # To ensure accessors are available","path":"examples/xarray_projections.py","position":8,"original_position":8,"commit_id":"f3e317555e55b60aa25134622e0d586f57d926a2","original_commit_id":"f3e317555e55b60aa25134622e0d586f57d926a2","user":{"login":"stickler-ci","id":16011037,"avatar_url":"https://avatars3.githubusercontent.com/u/16011037?v=4","gravatar_id":"","url":"https://api.github.com/users/stickler-ci","html_url":"https://github.com/stickler-ci","followers_url":"https://api.github.com/users/stickler-ci/followers","following_url":"https://api.github.com/users/stickler-ci/following{/other_user}","gists_url":"https://api.github.com/users/stickler-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/stickler-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stickler-ci/subscriptions","organizations_url":"https://api.github.com/users/stickler-ci/orgs","repos_url":"https://api.github.com/users/stickler-ci/repos","events_url":"https://api.github.com/users/stickler-ci/events{/privacy}","received_events_url":"https://api.github.com/users/stickler-ci/received_events","type":"User","site_admin":false},"body":"F401 'metpy.io.xarray' imported but unused","created_at":"2018-03-23T20:06:58Z","updated_at":"2018-03-23T20:06:58Z","html_url":"https://github.com/Unidata/MetPy/pull/786#discussion_r176850527","pull_request_url":"https://api.github.com/repos/Unidata/MetPy/pulls/786","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Unidata/MetPy/pulls/comments/176850527"},"html":{"href":"https://github.com/Unidata/MetPy/pull/786#discussion_r176850527"},"pull_request":{"href":"https://api.github.com/repos/Unidata/MetPy/pulls/786"}}},"pull_request":{"url":"https://api.github.com/repos/Unidata/MetPy/pulls/786","id":177172065,"html_url":"https://github.com/Unidata/MetPy/pull/786","diff_url":"https://github.com/Unidata/MetPy/pull/786.diff","patch_url":"https://github.com/Unidata/MetPy/pull/786.patch","issue_url":"https://api.github.com/repos/Unidata/MetPy/issues/786","number":786,"state":"open","locked":false,"title":"Xarray + CF + CartoPy Projection Handling [WIP]","user":{"login":"dopplershift","id":221526,"avatar_url":"https://avatars2.githubusercontent.com/u/221526?v=4","gravatar_id":"","url":"https://api.github.com/users/dopplershift","html_url":"https://github.com/dopplershift","followers_url":"https://api.github.com/users/dopplershift/followers","following_url":"https://api.github.com/users/dopplershift/following{/other_user}","gists_url":"https://api.github.com/users/dopplershift/gists{/gist_id}","starred_url":"https://api.github.com/users/dopplershift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dopplershift/subscriptions","organizations_url":"https://api.github.com/users/dopplershift/orgs","repos_url":"https://api.github.com/users/dopplershift/repos","events_url":"https://api.github.com/users/dopplershift/events{/privacy}","received_events_url":"https://api.github.com/users/dopplershift/received_events","type":"User","site_admin":false},"body":"Here's a first cut at automatically decoding CF projection information using an XArray accessor and making it available conveniently as a CartoPy projection. There are no docs or tests yet, but there is an example using our NARR test data set.\r\n\r\nOpen questions:\r\n1. Naming and organization of everything\r\n2. Should we require manually activating the XArray accessors (using a function call)\r\n3. Anything else labelled TODO\r\n\r\nTo save everyone the trouble of downloading to try it out (though please do!), here's what the example looks like:\r\n```python\r\nimport cartopy.feature as cfeature\r\nimport matplotlib.pyplot as plt\r\nimport xarray as xr\r\n\r\nimport metpy.io.xarray  # To ensure accessors are available\r\nfrom metpy.testing import get_test_data\r\n\r\nds = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))\r\ndata_var = ds.parse_cf('Temperature')\r\n\r\nx = data_var.x\r\ny = data_var.y\r\nim_data = data_var.isel(time=0).sel(isobaric=1000.)\r\n\r\nfig = plt.figure(figsize=(14, 14))\r\nax = fig.add_subplot(1, 1, 1, projection=data_var.cf.cartopy_crs)\r\n\r\nax.imshow(im_data, extent=(x.min(), x.max(), y.min(), y.max()),\r\n          cmap='RdBu', origin='lower' if y[0] < y[-1] else 'upper')\r\nax.coastlines(color='tab:green', resolution='10m')\r\nax.add_feature(cfeature.LAKES.with_scale('10m'), facecolor='none', edgecolor='tab:blue')\r\nax.add_feature(cfeature.RIVERS.with_scale('10m'), edgecolor='tab:blue')\r\n\r\nplt.show()\r\n```\r\n\r\nAnd the result:\r\n![figure_1](https://user-images.githubusercontent.com/221526/37850946-acbc0ebe-2ea2-11e8-9873-22f606ab62bd.png)\r\n\r\nI've tested this locally with quite a few data sets. Everything coming from GOES-16 (both NOAAPORT and GRB) works fine. Many GRIB2 datasets work fine, with the exception of WW3 and MRMS; those failures are not related to the projection stuff. NARR, HRRR, NAM Alaska, and RTMA Guam are working fine.","created_at":"2018-03-23T20:06:33Z","updated_at":"2018-03-23T20:06:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77261e9deb527e27ed4d4ef1eb8e366af650c909","assignee":null,"assignees":[],"requested_reviewers":[{"login":"jrleeman","id":325269,"avatar_url":"https://avatars3.githubusercontent.com/u/325269?v=4","gravatar_id":"","url":"https://api.github.com/users/jrleeman","html_url":"https://github.com/jrleeman","followers_url":"https://api.github.com/users/jrleeman/followers","following_url":"https://api.github.com/users/jrleeman/following{/other_user}","gists_url":"https://api.github.com/users/jrleeman/gists{/gist_id}","starred_url":"https://api.github.com/users/jrleeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrleeman/subscriptions","organizations_url":"https://api.github.com/users/jrleeman/orgs","repos_url":"https://api.github.com/users/jrleeman/repos","events_url":"https://api.github.com/users/jrleeman/events{/privacy}","received_events_url":"https://api.github.com/users/jrleeman/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Unidata/MetPy/pulls/786/commits","review_comments_url":"https://api.github.com/repos/Unidata/MetPy/pulls/786/comments","review_comment_url":"https://api.github.com/repos/Unidata/MetPy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Unidata/MetPy/issues/786/comments","statuses_url":"https://api.github.com/repos/Unidata/MetPy/statuses/f3e317555e55b60aa25134622e0d586f57d926a2","head":{"label":"dopplershift:xarray-projections","ref":"xarray-projections","sha":"f3e317555e55b60aa25134622e0d586f57d926a2","user":{"login":"dopplershift","id":221526,"avatar_url":"https://avatars2.githubusercontent.com/u/221526?v=4","gravatar_id":"","url":"https://api.github.com/users/dopplershift","html_url":"https://github.com/dopplershift","followers_url":"https://api.github.com/users/dopplershift/followers","following_url":"https://api.github.com/users/dopplershift/following{/other_user}","gists_url":"https://api.github.com/users/dopplershift/gists{/gist_id}","starred_url":"https://api.github.com/users/dopplershift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dopplershift/subscriptions","organizations_url":"https://api.github.com/users/dopplershift/orgs","repos_url":"https://api.github.com/users/dopplershift/repos","events_url":"https://api.github.com/users/dopplershift/events{/privacy}","received_events_url":"https://api.github.com/users/dopplershift/received_events","type":"User","site_admin":false},"repo":{"id":18279631,"name":"MetPy","full_name":"dopplershift/MetPy","owner":{"login":"dopplershift","id":221526,"avatar_url":"https://avatars2.githubusercontent.com/u/221526?v=4","gravatar_id":"","url":"https://api.github.com/users/dopplershift","html_url":"https://github.com/dopplershift","followers_url":"https://api.github.com/users/dopplershift/followers","following_url":"https://api.github.com/users/dopplershift/following{/other_user}","gists_url":"https://api.github.com/users/dopplershift/gists{/gist_id}","starred_url":"https://api.github.com/users/dopplershift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dopplershift/subscriptions","organizations_url":"https://api.github.com/users/dopplershift/orgs","repos_url":"https://api.github.com/users/dopplershift/repos","events_url":"https://api.github.com/users/dopplershift/events{/privacy}","received_events_url":"https://api.github.com/users/dopplershift/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dopplershift/MetPy","description":"A Python Package for Meteorological Data","fork":true,"url":"https://api.github.com/repos/dopplershift/MetPy","forks_url":"https://api.github.com/repos/dopplershift/MetPy/forks","keys_url":"https://api.github.com/repos/dopplershift/MetPy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dopplershift/MetPy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dopplershift/MetPy/teams","hooks_url":"https://api.github.com/repos/dopplershift/MetPy/hooks","issue_events_url":"https://api.github.com/repos/dopplershift/MetPy/issues/events{/number}","events_url":"https://api.github.com/repos/dopplershift/MetPy/events","assignees_url":"https://api.github.com/repos/dopplershift/MetPy/assignees{/user}","branches_url":"https://api.github.com/repos/dopplershift/MetPy/branches{/branch}","tags_url":"https://api.github.com/repos/dopplershift/MetPy/tags","blobs_url":"https://api.github.com/repos/dopplershift/MetPy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dopplershift/MetPy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dopplershift/MetPy/git/refs{/sha}","trees_url":"https://api.github.com/repos/dopplershift/MetPy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dopplershift/MetPy/statuses/{sha}","languages_url":"https://api.github.com/repos/dopplershift/MetPy/languages","stargazers_url":"https://api.github.com/repos/dopplershift/MetPy/stargazers","contributors_url":"https://api.github.com/repos/dopplershift/MetPy/contributors","subscribers_url":"https://api.github.com/repos/dopplershift/MetPy/subscribers","subscription_url":"https://api.github.com/repos/dopplershift/MetPy/subscription","commits_url":"https://api.github.com/repos/dopplershift/MetPy/commits{/sha}","git_commits_url":"https://api.github.com/repos/dopplershift/MetPy/git/commits{/sha}","comments_url":"https://api.github.com/repos/dopplershift/MetPy/comments{/number}","issue_comment_url":"https://api.github.com/repos/dopplershift/MetPy/issues/comments{/number}","contents_url":"https://api.github.com/repos/dopplershift/MetPy/contents/{+path}","compare_url":"https://api.github.com/repos/dopplershift/MetPy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dopplershift/MetPy/merges","archive_url":"https://api.github.com/repos/dopplershift/MetPy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dopplershift/MetPy/downloads","issues_url":"https://api.github.com/repos/dopplershift/MetPy/issues{/number}","pulls_url":"https://api.github.com/repos/dopplershift/MetPy/pulls{/number}","milestones_url":"https://api.github.com/repos/dopplershift/MetPy/milestones{/number}","notifications_url":"https://api.github.com/repos/dopplershift/MetPy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dopplershift/MetPy/labels{/name}","releases_url":"https://api.github.com/repos/dopplershift/MetPy/releases{/id}","deployments_url":"https://api.github.com/repos/dopplershift/MetPy/deployments","created_at":"2014-03-31T02:32:25Z","updated_at":"2016-10-31T16:57:45Z","pushed_at":"2018-03-23T19:55:04Z","git_url":"git://github.com/dopplershift/MetPy.git","ssh_url":"git@github.com:dopplershift/MetPy.git","clone_url":"https://github.com/dopplershift/MetPy.git","svn_url":"https://github.com/dopplershift/MetPy","homepage":"","size":140192,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"Unidata:master","ref":"master","sha":"95e80440bc11fbb85d1e6300e537d036a40d1aa4","user":{"login":"Unidata","id":613345,"avatar_url":"https://avatars3.githubusercontent.com/u/613345?v=4","gravatar_id":"","url":"https://api.github.com/users/Unidata","html_url":"https://github.com/Unidata","followers_url":"https://api.github.com/users/Unidata/followers","following_url":"https://api.github.com/users/Unidata/following{/other_user}","gists_url":"https://api.github.com/users/Unidata/gists{/gist_id}","starred_url":"https://api.github.com/users/Unidata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unidata/subscriptions","organizations_url":"https://api.github.com/users/Unidata/orgs","repos_url":"https://api.github.com/users/Unidata/repos","events_url":"https://api.github.com/users/Unidata/events{/privacy}","received_events_url":"https://api.github.com/users/Unidata/received_events","type":"Organization","site_admin":false},"repo":{"id":1409621,"name":"MetPy","full_name":"Unidata/MetPy","owner":{"login":"Unidata","id":613345,"avatar_url":"https://avatars3.githubusercontent.com/u/613345?v=4","gravatar_id":"","url":"https://api.github.com/users/Unidata","html_url":"https://github.com/Unidata","followers_url":"https://api.github.com/users/Unidata/followers","following_url":"https://api.github.com/users/Unidata/following{/other_user}","gists_url":"https://api.github.com/users/Unidata/gists{/gist_id}","starred_url":"https://api.github.com/users/Unidata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unidata/subscriptions","organizations_url":"https://api.github.com/users/Unidata/orgs","repos_url":"https://api.github.com/users/Unidata/repos","events_url":"https://api.github.com/users/Unidata/events{/privacy}","received_events_url":"https://api.github.com/users/Unidata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Unidata/MetPy","description":"MetPy is a collection of tools in Python for reading, visualizing and performing calculations with weather data.","fork":false,"url":"https://api.github.com/repos/Unidata/MetPy","forks_url":"https://api.github.com/repos/Unidata/MetPy/forks","keys_url":"https://api.github.com/repos/Unidata/MetPy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Unidata/MetPy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Unidata/MetPy/teams","hooks_url":"https://api.github.com/repos/Unidata/MetPy/hooks","issue_events_url":"https://api.github.com/repos/Unidata/MetPy/issues/events{/number}","events_url":"https://api.github.com/repos/Unidata/MetPy/events","assignees_url":"https://api.github.com/repos/Unidata/MetPy/assignees{/user}","branches_url":"https://api.github.com/repos/Unidata/MetPy/branches{/branch}","tags_url":"https://api.github.com/repos/Unidata/MetPy/tags","blobs_url":"https://api.github.com/repos/Unidata/MetPy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Unidata/MetPy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Unidata/MetPy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Unidata/MetPy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Unidata/MetPy/statuses/{sha}","languages_url":"https://api.github.com/repos/Unidata/MetPy/languages","stargazers_url":"https://api.github.com/repos/Unidata/MetPy/stargazers","contributors_url":"https://api.github.com/repos/Unidata/MetPy/contributors","subscribers_url":"https://api.github.com/repos/Unidata/MetPy/subscribers","subscription_url":"https://api.github.com/repos/Unidata/MetPy/subscription","commits_url":"https://api.github.com/repos/Unidata/MetPy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Unidata/MetPy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Unidata/MetPy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Unidata/MetPy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Unidata/MetPy/contents/{+path}","compare_url":"https://api.github.com/repos/Unidata/MetPy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Unidata/MetPy/merges","archive_url":"https://api.github.com/repos/Unidata/MetPy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Unidata/MetPy/downloads","issues_url":"https://api.github.com/repos/Unidata/MetPy/issues{/number}","pulls_url":"https://api.github.com/repos/Unidata/MetPy/pulls{/number}","milestones_url":"https://api.github.com/repos/Unidata/MetPy/milestones{/number}","notifications_url":"https://api.github.com/repos/Unidata/MetPy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Unidata/MetPy/labels{/name}","releases_url":"https://api.github.com/repos/Unidata/MetPy/releases{/id}","deployments_url":"https://api.github.com/repos/Unidata/MetPy/deployments","created_at":"2011-02-25T04:20:25Z","updated_at":"2018-03-23T17:30:11Z","pushed_at":"2018-03-23T20:06:33Z","git_url":"git://github.com/Unidata/MetPy.git","ssh_url":"git@github.com:Unidata/MetPy.git","clone_url":"https://github.com/Unidata/MetPy.git","svn_url":"https://github.com/Unidata/MetPy","homepage":"https://unidata.github.io/MetPy","size":187581,"stargazers_count":253,"watchers_count":253,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":127,"mirror_url":null,"archived":false,"open_issues_count":155,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":127,"open_issues":155,"watchers":253,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Unidata/MetPy/pulls/786"},"html":{"href":"https://github.com/Unidata/MetPy/pull/786"},"issue":{"href":"https://api.github.com/repos/Unidata/MetPy/issues/786"},"comments":{"href":"https://api.github.com/repos/Unidata/MetPy/issues/786/comments"},"review_comments":{"href":"https://api.github.com/repos/Unidata/MetPy/pulls/786/comments"},"review_comment":{"href":"https://api.github.com/repos/Unidata/MetPy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Unidata/MetPy/pulls/786/commits"},"statuses":{"href":"https://api.github.com/repos/Unidata/MetPy/statuses/f3e317555e55b60aa25134622e0d586f57d926a2"}},"author_association":"OWNER"}}
{"actor":{"display_login":"stickler-ci"}}