{"action":"created","comment":{"url":"https://api.github.com/repos/sunpy/sunpy/pulls/comments/70184797","id":70184797,"diff_hunk":"@@ -0,0 +1,124 @@\n+\"\"\"\n+This module implements SRS File Reader.\n+\"\"\"\n+__author__ = \"Sudarshan Konge\"\n+__email__ = \"sudk1896@gmail.com\"\n+\n+from astropy.table import Table, Column, vstack\n+import collections, calendar, re\n+\n+__all__ = ['read']\n+\n+def read(filepath):\n+    \"\"\"\n+    Method for reading an SRS File.\n+    \"\"\"\n+    File = open(filepath, 'r')\n+    lines = list()\n+    for line in File:\n+        arr = line.split()\n+        store = list()\n+        for i in range(0, min(len(arr), 8)):\n+            store.append(arr[i])\n+        lines.append(store)\n+\n+    #Store table meta-data. Only first two lines\n+    #of SRS text file store the meta-data.\n+    meta_data = collections.OrderedDict()\n+    regex = re.compile('[^a-zA-Z]')\n+    try:\n+        meta_data[regex.sub('', lines[0][0])] = lines[0][1]\n+        meta_data[regex.sub('', lines[1][0])] = ' '.join(lines[1][1:])\n+    except IndexError:\n+        print (\"SRS meta-data is not available.\")\n+\n+    #Problem: An array of strings. We need to extract\n+    #three tables from these I, IA and II.\n+\n+    table = list() #This table holds the three tables which we would later merge.\n+    indices = list()\n+    \n+    for i in range(0, len(lines)):\n+        if (lines[i][0][0] == 'I'):\n+            indices.append(i)\n+    indices.append(len(lines))\n+    indices.sort()\n+    \n+    for i in range(0, len(indices) - 1):\n+        cols = lines[indices[i]+1]\n+        temp_table = Table(names = cols, dtype=['object_']*len(cols))\n+        #If a table is empty, we are not adding it.\n+        for j in range(indices[i]+2, indices[i+1]):\n+            temp_string = lines[j]\n+            temp_array = temp_string\n+            if (len(temp_array) == len(cols)):\n+                temp_table.add_row(temp_array)\n+        #Make the table, data-type aware while\n+        #you're building it.\n+        #If it is empty, don't do anything\n+        #Just add the empty table as it is.\n+        if len(temp_table)>0:\n+            for cols in temp_table.columns.values():\n+                #Make the table columns unit-aware. First convert string to\n+                #floats, ones which can be converted that is.\n+                try:\n+                    column = temp_table[cols.name].astype(float)\n+                    temp_table.replace_column(cols.name, column)\n+                except ValueError:\n+                    pass","path":"sunpy/io/srs.py","position":68,"original_position":68,"commit_id":"e4a69dfb8e376ee824c2fda2f9c528111017b39a","original_commit_id":"e4a69dfb8e376ee824c2fda2f9c528111017b39a","user":{"login":"dpshelio","id":963242,"avatar_url":"https://avatars.githubusercontent.com/u/963242?v=3","gravatar_id":"","url":"https://api.github.com/users/dpshelio","html_url":"https://github.com/dpshelio","followers_url":"https://api.github.com/users/dpshelio/followers","following_url":"https://api.github.com/users/dpshelio/following{/other_user}","gists_url":"https://api.github.com/users/dpshelio/gists{/gist_id}","starred_url":"https://api.github.com/users/dpshelio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpshelio/subscriptions","organizations_url":"https://api.github.com/users/dpshelio/orgs","repos_url":"https://api.github.com/users/dpshelio/repos","events_url":"https://api.github.com/users/dpshelio/events{/privacy}","received_events_url":"https://api.github.com/users/dpshelio/received_events","type":"User","site_admin":false},"body":"These `pass` are dangerous.","created_at":"2016-07-10T16:40:07Z","updated_at":"2016-07-10T16:40:07Z","html_url":"https://github.com/sunpy/sunpy/pull/1852#discussion_r70184797","pull_request_url":"https://api.github.com/repos/sunpy/sunpy/pulls/1852","_links":{"self":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/comments/70184797"},"html":{"href":"https://github.com/sunpy/sunpy/pull/1852#discussion_r70184797"},"pull_request":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1852"}}},"pull_request":{"url":"https://api.github.com/repos/sunpy/sunpy/pulls/1852","id":76870406,"html_url":"https://github.com/sunpy/sunpy/pull/1852","diff_url":"https://github.com/sunpy/sunpy/pull/1852.diff","patch_url":"https://github.com/sunpy/sunpy/pull/1852.patch","issue_url":"https://api.github.com/repos/sunpy/sunpy/issues/1852","number":1852,"state":"open","locked":false,"title":"SRS Client and SRS reader.","user":{"login":"sudk1896","id":6025419,"avatar_url":"https://avatars.githubusercontent.com/u/6025419?v=3","gravatar_id":"","url":"https://api.github.com/users/sudk1896","html_url":"https://github.com/sudk1896","followers_url":"https://api.github.com/users/sudk1896/followers","following_url":"https://api.github.com/users/sudk1896/following{/other_user}","gists_url":"https://api.github.com/users/sudk1896/gists{/gist_id}","starred_url":"https://api.github.com/users/sudk1896/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sudk1896/subscriptions","organizations_url":"https://api.github.com/users/sudk1896/orgs","repos_url":"https://api.github.com/users/sudk1896/repos","events_url":"https://api.github.com/users/sudk1896/events{/privacy}","received_events_url":"https://api.github.com/users/sudk1896/received_events","type":"User","site_admin":false},"body":"This PR implements an SRS Client and also a module in ```sunpy.io``` to read SRS text files [from SWPC NOAA](ftp.swpc.noaa.gov/pub/warehouse/2015/SRS/).\r\n\r\nThe reader would take a valid SRS file as input and it would process it and output an ```astropy.Table```. It includes all the parameters listed [here](ftp.swpc.noaa.gov/pub/warehouse/README) and another additional parameter ```ID``` which tells if a certain row in the table belongs to ```Table I, IA or II```. All the three tables have been merged into one single table (hence the ```ID``` attribute).\r\n\r\nSome of the columns (attributes) have been made unit-aware and ones which have not, I would need information about their units. I also added a few tests, for those tests, 3 text files have been added to the test data , their combined size is less than 3KB. What remains, is to split the ```Location``` attribute into longitude and latitude. I need to know that which is which - Location is of type (N|S)xx(W|E)xx. I need to know which is the latitude and longitude and also what should be their attribute names, since the table already consists of an attribute ```Lat```.\r\n\r\n@dpshelio @wafels Review. Suggestions are welcome. ","created_at":"2016-07-10T10:58:25Z","updated_at":"2016-07-10T16:40:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a80c64a3a87cfffd2174d5e68971673c40a89347","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sunpy/sunpy/pulls/1852/commits","review_comments_url":"https://api.github.com/repos/sunpy/sunpy/pulls/1852/comments","review_comment_url":"https://api.github.com/repos/sunpy/sunpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sunpy/sunpy/issues/1852/comments","statuses_url":"https://api.github.com/repos/sunpy/sunpy/statuses/e4a69dfb8e376ee824c2fda2f9c528111017b39a","head":{"label":"sudk1896:srs","ref":"srs","sha":"e4a69dfb8e376ee824c2fda2f9c528111017b39a","user":{"login":"sudk1896","id":6025419,"avatar_url":"https://avatars.githubusercontent.com/u/6025419?v=3","gravatar_id":"","url":"https://api.github.com/users/sudk1896","html_url":"https://github.com/sudk1896","followers_url":"https://api.github.com/users/sudk1896/followers","following_url":"https://api.github.com/users/sudk1896/following{/other_user}","gists_url":"https://api.github.com/users/sudk1896/gists{/gist_id}","starred_url":"https://api.github.com/users/sudk1896/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sudk1896/subscriptions","organizations_url":"https://api.github.com/users/sudk1896/orgs","repos_url":"https://api.github.com/users/sudk1896/repos","events_url":"https://api.github.com/users/sudk1896/events{/privacy}","received_events_url":"https://api.github.com/users/sudk1896/received_events","type":"User","site_admin":false},"repo":{"id":44807807,"name":"sunpy","full_name":"sudk1896/sunpy","owner":{"login":"sudk1896","id":6025419,"avatar_url":"https://avatars.githubusercontent.com/u/6025419?v=3","gravatar_id":"","url":"https://api.github.com/users/sudk1896","html_url":"https://github.com/sudk1896","followers_url":"https://api.github.com/users/sudk1896/followers","following_url":"https://api.github.com/users/sudk1896/following{/other_user}","gists_url":"https://api.github.com/users/sudk1896/gists{/gist_id}","starred_url":"https://api.github.com/users/sudk1896/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sudk1896/subscriptions","organizations_url":"https://api.github.com/users/sudk1896/orgs","repos_url":"https://api.github.com/users/sudk1896/repos","events_url":"https://api.github.com/users/sudk1896/events{/privacy}","received_events_url":"https://api.github.com/users/sudk1896/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sudk1896/sunpy","description":"SunPy - Python for solar physics","fork":true,"url":"https://api.github.com/repos/sudk1896/sunpy","forks_url":"https://api.github.com/repos/sudk1896/sunpy/forks","keys_url":"https://api.github.com/repos/sudk1896/sunpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sudk1896/sunpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sudk1896/sunpy/teams","hooks_url":"https://api.github.com/repos/sudk1896/sunpy/hooks","issue_events_url":"https://api.github.com/repos/sudk1896/sunpy/issues/events{/number}","events_url":"https://api.github.com/repos/sudk1896/sunpy/events","assignees_url":"https://api.github.com/repos/sudk1896/sunpy/assignees{/user}","branches_url":"https://api.github.com/repos/sudk1896/sunpy/branches{/branch}","tags_url":"https://api.github.com/repos/sudk1896/sunpy/tags","blobs_url":"https://api.github.com/repos/sudk1896/sunpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sudk1896/sunpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sudk1896/sunpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sudk1896/sunpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sudk1896/sunpy/statuses/{sha}","languages_url":"https://api.github.com/repos/sudk1896/sunpy/languages","stargazers_url":"https://api.github.com/repos/sudk1896/sunpy/stargazers","contributors_url":"https://api.github.com/repos/sudk1896/sunpy/contributors","subscribers_url":"https://api.github.com/repos/sudk1896/sunpy/subscribers","subscription_url":"https://api.github.com/repos/sudk1896/sunpy/subscription","commits_url":"https://api.github.com/repos/sudk1896/sunpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sudk1896/sunpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sudk1896/sunpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sudk1896/sunpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sudk1896/sunpy/contents/{+path}","compare_url":"https://api.github.com/repos/sudk1896/sunpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sudk1896/sunpy/merges","archive_url":"https://api.github.com/repos/sudk1896/sunpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sudk1896/sunpy/downloads","issues_url":"https://api.github.com/repos/sudk1896/sunpy/issues{/number}","pulls_url":"https://api.github.com/repos/sudk1896/sunpy/pulls{/number}","milestones_url":"https://api.github.com/repos/sudk1896/sunpy/milestones{/number}","notifications_url":"https://api.github.com/repos/sudk1896/sunpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sudk1896/sunpy/labels{/name}","releases_url":"https://api.github.com/repos/sudk1896/sunpy/releases{/id}","deployments_url":"https://api.github.com/repos/sudk1896/sunpy/deployments","created_at":"2015-10-23T11:00:28Z","updated_at":"2016-03-02T14:59:27Z","pushed_at":"2016-07-10T11:04:01Z","git_url":"git://github.com/sudk1896/sunpy.git","ssh_url":"git@github.com:sudk1896/sunpy.git","clone_url":"https://github.com/sudk1896/sunpy.git","svn_url":"https://github.com/sudk1896/sunpy","homepage":"http://www.sunpy.org","size":38517,"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":"sunpy:unidown","ref":"unidown","sha":"2c57069fe4f4450607063ec4e85255d20adde3ea","user":{"login":"sunpy","id":963197,"avatar_url":"https://avatars.githubusercontent.com/u/963197?v=3","gravatar_id":"","url":"https://api.github.com/users/sunpy","html_url":"https://github.com/sunpy","followers_url":"https://api.github.com/users/sunpy/followers","following_url":"https://api.github.com/users/sunpy/following{/other_user}","gists_url":"https://api.github.com/users/sunpy/gists{/gist_id}","starred_url":"https://api.github.com/users/sunpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunpy/subscriptions","organizations_url":"https://api.github.com/users/sunpy/orgs","repos_url":"https://api.github.com/users/sunpy/repos","events_url":"https://api.github.com/users/sunpy/events{/privacy}","received_events_url":"https://api.github.com/users/sunpy/received_events","type":"Organization","site_admin":false},"repo":{"id":2165383,"name":"sunpy","full_name":"sunpy/sunpy","owner":{"login":"sunpy","id":963197,"avatar_url":"https://avatars.githubusercontent.com/u/963197?v=3","gravatar_id":"","url":"https://api.github.com/users/sunpy","html_url":"https://github.com/sunpy","followers_url":"https://api.github.com/users/sunpy/followers","following_url":"https://api.github.com/users/sunpy/following{/other_user}","gists_url":"https://api.github.com/users/sunpy/gists{/gist_id}","starred_url":"https://api.github.com/users/sunpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunpy/subscriptions","organizations_url":"https://api.github.com/users/sunpy/orgs","repos_url":"https://api.github.com/users/sunpy/repos","events_url":"https://api.github.com/users/sunpy/events{/privacy}","received_events_url":"https://api.github.com/users/sunpy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sunpy/sunpy","description":"SunPy - Python for Solar Physics","fork":false,"url":"https://api.github.com/repos/sunpy/sunpy","forks_url":"https://api.github.com/repos/sunpy/sunpy/forks","keys_url":"https://api.github.com/repos/sunpy/sunpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sunpy/sunpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sunpy/sunpy/teams","hooks_url":"https://api.github.com/repos/sunpy/sunpy/hooks","issue_events_url":"https://api.github.com/repos/sunpy/sunpy/issues/events{/number}","events_url":"https://api.github.com/repos/sunpy/sunpy/events","assignees_url":"https://api.github.com/repos/sunpy/sunpy/assignees{/user}","branches_url":"https://api.github.com/repos/sunpy/sunpy/branches{/branch}","tags_url":"https://api.github.com/repos/sunpy/sunpy/tags","blobs_url":"https://api.github.com/repos/sunpy/sunpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sunpy/sunpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sunpy/sunpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sunpy/sunpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sunpy/sunpy/statuses/{sha}","languages_url":"https://api.github.com/repos/sunpy/sunpy/languages","stargazers_url":"https://api.github.com/repos/sunpy/sunpy/stargazers","contributors_url":"https://api.github.com/repos/sunpy/sunpy/contributors","subscribers_url":"https://api.github.com/repos/sunpy/sunpy/subscribers","subscription_url":"https://api.github.com/repos/sunpy/sunpy/subscription","commits_url":"https://api.github.com/repos/sunpy/sunpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sunpy/sunpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sunpy/sunpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sunpy/sunpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sunpy/sunpy/contents/{+path}","compare_url":"https://api.github.com/repos/sunpy/sunpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sunpy/sunpy/merges","archive_url":"https://api.github.com/repos/sunpy/sunpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sunpy/sunpy/downloads","issues_url":"https://api.github.com/repos/sunpy/sunpy/issues{/number}","pulls_url":"https://api.github.com/repos/sunpy/sunpy/pulls{/number}","milestones_url":"https://api.github.com/repos/sunpy/sunpy/milestones{/number}","notifications_url":"https://api.github.com/repos/sunpy/sunpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sunpy/sunpy/labels{/name}","releases_url":"https://api.github.com/repos/sunpy/sunpy/releases{/id}","deployments_url":"https://api.github.com/repos/sunpy/sunpy/deployments","created_at":"2011-08-06T15:34:08Z","updated_at":"2016-07-05T03:46:00Z","pushed_at":"2016-07-10T11:04:01Z","git_url":"git://github.com/sunpy/sunpy.git","ssh_url":"git@github.com:sunpy/sunpy.git","clone_url":"https://github.com/sunpy/sunpy.git","svn_url":"https://github.com/sunpy/sunpy","homepage":"http://www.sunpy.org","size":142395,"stargazers_count":229,"watchers_count":229,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":160,"mirror_url":null,"open_issues_count":261,"forks":160,"open_issues":261,"watchers":229,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1852"},"html":{"href":"https://github.com/sunpy/sunpy/pull/1852"},"issue":{"href":"https://api.github.com/repos/sunpy/sunpy/issues/1852"},"comments":{"href":"https://api.github.com/repos/sunpy/sunpy/issues/1852/comments"},"review_comments":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1852/comments"},"review_comment":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1852/commits"},"statuses":{"href":"https://api.github.com/repos/sunpy/sunpy/statuses/e4a69dfb8e376ee824c2fda2f9c528111017b39a"}}}}
{"actor":{"display_login":"dpshelio"}}