{"action":"created","comment":{"url":"https://api.github.com/repos/ARM-DOE/pyart/pulls/comments/35564631","id":35564631,"diff_hunk":"@@ -152,3 +152,178 @@ def _interpolate_azimuth_edges(azimuths):\n     edges[-1] = np.angle(az[-1] - (az[-2] - az[-1]) / 2., deg=True)\n     edges[edges < 0] += 360     # range from [-180, 180] to [0, 360]\n     return edges\n+\n+########################\n+# Common radar methods #\n+########################\n+\n+def parse_ax(ax):\n+    \"\"\" Parse and return ax parameter. \"\"\"\n+    if ax is None:\n+        ax = plt.gca()\n+    return ax\n+\n+def parse_ax_fig(ax, fig):\n+    \"\"\" Parse and return ax and fig parameters. \"\"\"\n+    if ax is None:\n+        ax = plt.gca()\n+    if fig is None:\n+        fig = plt.gcf()\n+    return ax, fig\n+\n+def generate_colorbar_label(standard_name, units):\n+    \"\"\" Generate and return a label for a colorbar. \"\"\"\n+    return standard_name.replace('_', ' ') + ' (' + units + ')'\n+\n+def generate_field_name(radar, field):\n+    \"\"\" Return a nice field name for a particular field. \"\"\"\n+    if 'standard_name' in radar.fields[field]:\n+        field_name = radar.fields[field]['standard_name']\n+    elif 'long_name' in radar.fields[field]:\n+        field_name = radar.fields[field]['long_name']\n+    else:\n+        field_name = str(field)\n+    field_name = field_name.replace('_', ' ')\n+    field_name = field_name[0].upper() + field_name[1:]\n+    return field_name\n+\n+def generate_radar_name(radar):\n+    \"\"\" Return radar name. \"\"\"\n+    if 'instrument_name' in radar.metadata:\n+        return radar.metadata['instrument_name']\n+    else:\n+        return ''\n+\n+def generate_time_begin(radar):\n+    \"\"\" Return time begin in datetime instance. \"\"\"\n+    # datetime object describing first sweep time\n+    times = radar.time['data'][0]\n+    units = radar.time['units']\n+    calendar = radar.time['calendar']\n+    return netCDF4.num2date(times, units, calendar)\n+\n+\n+def generate_filename(radar, field, sweep, ext='png'):\n+    \"\"\"\n+    Generate a filename for a plot.\n+\n+    Generated filename has form:\n+        radar_name_field_sweep_time.ext\n+\n+    Parameters\n+    ----------\n+    radar : Radar\n+        Radar structure.\n+    field : str\n+        Field plotted.\n+    sweep : int\n+        Sweep plotted.\n+    ext : str\n+        Filename extension.\n+\n+    Returns\n+    -------\n+    filename : str\n+        Filename suitable for saving a plot.\n+\n+    \"\"\"\n+    name_s = generate_radar_name(radar).replace(' ', '_')\n+    field_s = field.replace(' ', '_')\n+    time_s = generate_time_begin(radar).strftime('%Y%m%d%H%M%S')\n+    sweep_s = str(sweep).zfill(2)\n+    return '%s_%s_%s_%s.%s' % (name_s, field_s, sweep_s, time_s, ext)\n+\n+def generate_title(radar, field, sweep):\n+    \"\"\"\n+    Generate a title for a plot.\n+\n+    Parameters\n+    ----------\n+    radar : Radar\n+        Radar structure.\n+    field : str\n+        Field plotted.\n+    sweep : int\n+        Sweep plotted.\n+\n+    Returns\n+    -------\n+    title : str\n+        Plot title.\n+\n+    \"\"\"\n+    time_str = generate_time_begin(radar).isoformat() + 'Z'\n+    fixed_angle = radar.fixed_angle['data'][sweep]\n+    l1 = \"%s %.1f Deg. %s \" % (generate_radar_name(radar), fixed_angle, time_str)\n+    field_name = generate_field_name(radar, field)\n+    return l1 + '\\n' + field_name\n+\n+def generate_vpt_title(radar, field):\n+    \"\"\"\n+    Generate a title for a VPT plot.\n+\n+    Parameters\n+    ----------\n+    radar : Radar\n+        Radar structure.\n+    field : str\n+        Field plotted.\n+\n+    Returns\n+    -------\n+    title : str\n+        Plot title.\n+\n+    \"\"\"\n+    time_str = generate_time_begin(radar).isoformat() + 'Z'\n+    l1 = \"%s %s \" % (generate_radar_name(radar), time_str)\n+    field_name = generate_field_name(radar, field)\n+    return l1 + '\\n' + field_name\n+\n+def generate_ray_title(radar, field, ray):\n+    \"\"\"\n+    Generate a title for a ray plot.\n+\n+    Parameters\n+    ----------\n+    radar : Radar\n+        Radar structure.\n+    field : str\n+        Field plotted.\n+    ray : int\n+        Ray plotted.\n+\n+    Returns\n+    -------\n+    title : str\n+        Plot title.\n+\n+    \"\"\"\n+    time_str = generate_time_begin(radar).isoformat() + 'Z'\n+    l1 = \"%s %s\" % (generate_radar_name(radar), time_str)\n+    azim = radar.azimuth['data'][ray]\n+    elev = radar.elevation['data'][ray]\n+    l2 = \"Ray: %i  Elevation: %.1f Azimuth: %.1f\" % (ray, azim, elev)\n+    field_name = generate_field_name(radar, field)\n+    return l1 + '\\n' + l2 + '\\n' + field_name\n+\n+def set_limits(self, xlim=None, ylim=None, ax=None):","path":"pyart/graph/common.py","position":159,"original_position":159,"commit_id":"de214132be72d89519b33fb22a703873ce80a23c","original_commit_id":"de214132be72d89519b33fb22a703873ce80a23c","user":{"login":"gamaanderson","id":7915525,"avatar_url":"https://avatars.githubusercontent.com/u/7915525?v=3","gravatar_id":"","url":"https://api.github.com/users/gamaanderson","html_url":"https://github.com/gamaanderson","followers_url":"https://api.github.com/users/gamaanderson/followers","following_url":"https://api.github.com/users/gamaanderson/following{/other_user}","gists_url":"https://api.github.com/users/gamaanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/gamaanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamaanderson/subscriptions","organizations_url":"https://api.github.com/users/gamaanderson/orgs","repos_url":"https://api.github.com/users/gamaanderson/repos","events_url":"https://api.github.com/users/gamaanderson/events{/privacy}","received_events_url":"https://api.github.com/users/gamaanderson/received_events","type":"User","site_admin":false},"body":"ok, I missed that","created_at":"2015-07-27T17:49:08Z","updated_at":"2015-07-27T17:49:08Z","html_url":"https://github.com/ARM-DOE/pyart/pull/339#discussion_r35564631","pull_request_url":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339","_links":{"self":{"href":"https://api.github.com/repos/ARM-DOE/pyart/pulls/comments/35564631"},"html":{"href":"https://github.com/ARM-DOE/pyart/pull/339#discussion_r35564631"},"pull_request":{"href":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339"}}},"pull_request":{"url":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339","id":40927177,"html_url":"https://github.com/ARM-DOE/pyart/pull/339","diff_url":"https://github.com/ARM-DOE/pyart/pull/339.diff","patch_url":"https://github.com/ARM-DOE/pyart/pull/339.patch","issue_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/339","number":339,"state":"open","locked":false,"title":"externalise methods from display","user":{"login":"gamaanderson","id":7915525,"avatar_url":"https://avatars.githubusercontent.com/u/7915525?v=3","gravatar_id":"","url":"https://api.github.com/users/gamaanderson","html_url":"https://github.com/gamaanderson","followers_url":"https://api.github.com/users/gamaanderson/followers","following_url":"https://api.github.com/users/gamaanderson/following{/other_user}","gists_url":"https://api.github.com/users/gamaanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/gamaanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamaanderson/subscriptions","organizations_url":"https://api.github.com/users/gamaanderson/orgs","repos_url":"https://api.github.com/users/gamaanderson/repos","events_url":"https://api.github.com/users/gamaanderson/events{/privacy}","received_events_url":"https://api.github.com/users/gamaanderson/received_events","type":"User","site_admin":false},"body":"In the spirit of issue #248; to help a little in artview and in anticipation of improving `GridDisplay`, I made some independent methods based in what is being done in  `RadarDisplay`. I would just like to get an approval before applying to `RadarDisplay` (removing some private methods and redirecting public ones)\r\n\r\nAlso, do you have any suggestion on how to proceed (define names and stuff) while creating similar ones for grid?","created_at":"2015-07-27T17:17:33Z","updated_at":"2015-07-27T17:49:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8103b731263a6966743620809afd91f0d8087687","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339/commits","review_comments_url":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339/comments","review_comment_url":"https://api.github.com/repos/ARM-DOE/pyart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/339/comments","statuses_url":"https://api.github.com/repos/ARM-DOE/pyart/statuses/de214132be72d89519b33fb22a703873ce80a23c","head":{"label":"gamaanderson:display","ref":"display","sha":"de214132be72d89519b33fb22a703873ce80a23c","user":{"login":"gamaanderson","id":7915525,"avatar_url":"https://avatars.githubusercontent.com/u/7915525?v=3","gravatar_id":"","url":"https://api.github.com/users/gamaanderson","html_url":"https://github.com/gamaanderson","followers_url":"https://api.github.com/users/gamaanderson/followers","following_url":"https://api.github.com/users/gamaanderson/following{/other_user}","gists_url":"https://api.github.com/users/gamaanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/gamaanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamaanderson/subscriptions","organizations_url":"https://api.github.com/users/gamaanderson/orgs","repos_url":"https://api.github.com/users/gamaanderson/repos","events_url":"https://api.github.com/users/gamaanderson/events{/privacy}","received_events_url":"https://api.github.com/users/gamaanderson/received_events","type":"User","site_admin":false},"repo":{"id":39389546,"name":"pyart","full_name":"gamaanderson/pyart","owner":{"login":"gamaanderson","id":7915525,"avatar_url":"https://avatars.githubusercontent.com/u/7915525?v=3","gravatar_id":"","url":"https://api.github.com/users/gamaanderson","html_url":"https://github.com/gamaanderson","followers_url":"https://api.github.com/users/gamaanderson/followers","following_url":"https://api.github.com/users/gamaanderson/following{/other_user}","gists_url":"https://api.github.com/users/gamaanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/gamaanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamaanderson/subscriptions","organizations_url":"https://api.github.com/users/gamaanderson/orgs","repos_url":"https://api.github.com/users/gamaanderson/repos","events_url":"https://api.github.com/users/gamaanderson/events{/privacy}","received_events_url":"https://api.github.com/users/gamaanderson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gamaanderson/pyart","description":"The Python-ARM Radar Toolkit. An data model driven interactive toolkit for working with weather radar data. ","fork":true,"url":"https://api.github.com/repos/gamaanderson/pyart","forks_url":"https://api.github.com/repos/gamaanderson/pyart/forks","keys_url":"https://api.github.com/repos/gamaanderson/pyart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gamaanderson/pyart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gamaanderson/pyart/teams","hooks_url":"https://api.github.com/repos/gamaanderson/pyart/hooks","issue_events_url":"https://api.github.com/repos/gamaanderson/pyart/issues/events{/number}","events_url":"https://api.github.com/repos/gamaanderson/pyart/events","assignees_url":"https://api.github.com/repos/gamaanderson/pyart/assignees{/user}","branches_url":"https://api.github.com/repos/gamaanderson/pyart/branches{/branch}","tags_url":"https://api.github.com/repos/gamaanderson/pyart/tags","blobs_url":"https://api.github.com/repos/gamaanderson/pyart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gamaanderson/pyart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gamaanderson/pyart/git/refs{/sha}","trees_url":"https://api.github.com/repos/gamaanderson/pyart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gamaanderson/pyart/statuses/{sha}","languages_url":"https://api.github.com/repos/gamaanderson/pyart/languages","stargazers_url":"https://api.github.com/repos/gamaanderson/pyart/stargazers","contributors_url":"https://api.github.com/repos/gamaanderson/pyart/contributors","subscribers_url":"https://api.github.com/repos/gamaanderson/pyart/subscribers","subscription_url":"https://api.github.com/repos/gamaanderson/pyart/subscription","commits_url":"https://api.github.com/repos/gamaanderson/pyart/commits{/sha}","git_commits_url":"https://api.github.com/repos/gamaanderson/pyart/git/commits{/sha}","comments_url":"https://api.github.com/repos/gamaanderson/pyart/comments{/number}","issue_comment_url":"https://api.github.com/repos/gamaanderson/pyart/issues/comments{/number}","contents_url":"https://api.github.com/repos/gamaanderson/pyart/contents/{+path}","compare_url":"https://api.github.com/repos/gamaanderson/pyart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gamaanderson/pyart/merges","archive_url":"https://api.github.com/repos/gamaanderson/pyart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gamaanderson/pyart/downloads","issues_url":"https://api.github.com/repos/gamaanderson/pyart/issues{/number}","pulls_url":"https://api.github.com/repos/gamaanderson/pyart/pulls{/number}","milestones_url":"https://api.github.com/repos/gamaanderson/pyart/milestones{/number}","notifications_url":"https://api.github.com/repos/gamaanderson/pyart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gamaanderson/pyart/labels{/name}","releases_url":"https://api.github.com/repos/gamaanderson/pyart/releases{/id}","created_at":"2015-07-20T14:44:53Z","updated_at":"2015-07-20T14:44:53Z","pushed_at":"2015-07-27T17:16:54Z","git_url":"git://github.com/gamaanderson/pyart.git","ssh_url":"git@github.com:gamaanderson/pyart.git","clone_url":"https://github.com/gamaanderson/pyart.git","svn_url":"https://github.com/gamaanderson/pyart","homepage":"http://arm-doe.github.io/pyart/","size":53276,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ARM-DOE:master","ref":"master","sha":"64b25196292bae2fd4090f08923e56b6b584cb38","user":{"login":"ARM-DOE","id":2540600,"avatar_url":"https://avatars.githubusercontent.com/u/2540600?v=3","gravatar_id":"","url":"https://api.github.com/users/ARM-DOE","html_url":"https://github.com/ARM-DOE","followers_url":"https://api.github.com/users/ARM-DOE/followers","following_url":"https://api.github.com/users/ARM-DOE/following{/other_user}","gists_url":"https://api.github.com/users/ARM-DOE/gists{/gist_id}","starred_url":"https://api.github.com/users/ARM-DOE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARM-DOE/subscriptions","organizations_url":"https://api.github.com/users/ARM-DOE/orgs","repos_url":"https://api.github.com/users/ARM-DOE/repos","events_url":"https://api.github.com/users/ARM-DOE/events{/privacy}","received_events_url":"https://api.github.com/users/ARM-DOE/received_events","type":"Organization","site_admin":false},"repo":{"id":6248645,"name":"pyart","full_name":"ARM-DOE/pyart","owner":{"login":"ARM-DOE","id":2540600,"avatar_url":"https://avatars.githubusercontent.com/u/2540600?v=3","gravatar_id":"","url":"https://api.github.com/users/ARM-DOE","html_url":"https://github.com/ARM-DOE","followers_url":"https://api.github.com/users/ARM-DOE/followers","following_url":"https://api.github.com/users/ARM-DOE/following{/other_user}","gists_url":"https://api.github.com/users/ARM-DOE/gists{/gist_id}","starred_url":"https://api.github.com/users/ARM-DOE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARM-DOE/subscriptions","organizations_url":"https://api.github.com/users/ARM-DOE/orgs","repos_url":"https://api.github.com/users/ARM-DOE/repos","events_url":"https://api.github.com/users/ARM-DOE/events{/privacy}","received_events_url":"https://api.github.com/users/ARM-DOE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARM-DOE/pyart","description":"The Python-ARM Radar Toolkit. An data model driven interactive toolkit for working with weather radar data. ","fork":false,"url":"https://api.github.com/repos/ARM-DOE/pyart","forks_url":"https://api.github.com/repos/ARM-DOE/pyart/forks","keys_url":"https://api.github.com/repos/ARM-DOE/pyart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARM-DOE/pyart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARM-DOE/pyart/teams","hooks_url":"https://api.github.com/repos/ARM-DOE/pyart/hooks","issue_events_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/events{/number}","events_url":"https://api.github.com/repos/ARM-DOE/pyart/events","assignees_url":"https://api.github.com/repos/ARM-DOE/pyart/assignees{/user}","branches_url":"https://api.github.com/repos/ARM-DOE/pyart/branches{/branch}","tags_url":"https://api.github.com/repos/ARM-DOE/pyart/tags","blobs_url":"https://api.github.com/repos/ARM-DOE/pyart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARM-DOE/pyart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARM-DOE/pyart/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARM-DOE/pyart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARM-DOE/pyart/statuses/{sha}","languages_url":"https://api.github.com/repos/ARM-DOE/pyart/languages","stargazers_url":"https://api.github.com/repos/ARM-DOE/pyart/stargazers","contributors_url":"https://api.github.com/repos/ARM-DOE/pyart/contributors","subscribers_url":"https://api.github.com/repos/ARM-DOE/pyart/subscribers","subscription_url":"https://api.github.com/repos/ARM-DOE/pyart/subscription","commits_url":"https://api.github.com/repos/ARM-DOE/pyart/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARM-DOE/pyart/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARM-DOE/pyart/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARM-DOE/pyart/contents/{+path}","compare_url":"https://api.github.com/repos/ARM-DOE/pyart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARM-DOE/pyart/merges","archive_url":"https://api.github.com/repos/ARM-DOE/pyart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARM-DOE/pyart/downloads","issues_url":"https://api.github.com/repos/ARM-DOE/pyart/issues{/number}","pulls_url":"https://api.github.com/repos/ARM-DOE/pyart/pulls{/number}","milestones_url":"https://api.github.com/repos/ARM-DOE/pyart/milestones{/number}","notifications_url":"https://api.github.com/repos/ARM-DOE/pyart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARM-DOE/pyart/labels{/name}","releases_url":"https://api.github.com/repos/ARM-DOE/pyart/releases{/id}","created_at":"2012-10-16T17:51:30Z","updated_at":"2015-07-23T13:32:38Z","pushed_at":"2015-07-27T17:17:33Z","git_url":"git://github.com/ARM-DOE/pyart.git","ssh_url":"git@github.com:ARM-DOE/pyart.git","clone_url":"https://github.com/ARM-DOE/pyart.git","svn_url":"https://github.com/ARM-DOE/pyart","homepage":"http://arm-doe.github.io/pyart/","size":55466,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":39,"mirror_url":null,"open_issues_count":46,"forks":39,"open_issues":46,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339"},"html":{"href":"https://github.com/ARM-DOE/pyart/pull/339"},"issue":{"href":"https://api.github.com/repos/ARM-DOE/pyart/issues/339"},"comments":{"href":"https://api.github.com/repos/ARM-DOE/pyart/issues/339/comments"},"review_comments":{"href":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339/comments"},"review_comment":{"href":"https://api.github.com/repos/ARM-DOE/pyart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARM-DOE/pyart/pulls/339/commits"},"statuses":{"href":"https://api.github.com/repos/ARM-DOE/pyart/statuses/de214132be72d89519b33fb22a703873ce80a23c"}}}}