{"action":"created","comment":{"url":"https://api.github.com/repos/sunpy/sunpy/pulls/comments/73031714","id":73031714,"diff_hunk":"@@ -52,33 +93,75 @@ def _get_url_for_timerange(self, timerange, **kwargs):\n         ----------\n         timerange: sunpy.time.TimeRange\n             time range for which data is to be downloaded.\n-        satellite_number : int\n-            GOES satellite number (default = 15)\n-        data_type : string\n-            Data type to return for the particular GOES satellite. Supported\n-            types depend on the satellite number specified. (default = xrs_2s)\n+        Physobs : string\n+            'INTENSITY', 'PARTICLE_FLUX' and 'IRRADIANCE', Case sensitive\n+        Instrument: string\n+            Fixed argument, 'goes' Case insensitive.\n         \"\"\"\n-        # find out which satellite and datatype to query from the query times\n-        sat_num = self._get_goes_sat_num(timerange.start, timerange.end)\n-        base_url = 'http://umbra.nascom.nasa.gov/goes/fits/'\n-        total_days = (timerange.end - timerange.start).days + 1 \n-        all_dates = timerange.split(total_days)\n-        result = list()\n-#       Earlier we assumed that an entire range (consequently all dates within the range) were assigned the\n-#       same GOES sat number, which meant we supplied timerange.start and timerange.end to\n-#       _get_goes_sat_num. But now, we iterate over all the dates individually and hence\n-#       _get_goes_sat_num gets each single date as an argument (the timerange.start and timerange.end\n-#       for a single day is the day itself (trivial) ). That is why the same date. Its iterating over all the dates\n-#       indivually.\n-        for day in all_dates:\n-            regex = \"{date:%Y}/go{sat:02d}\"\n-            if (day.end < parse_time('1999/01/15')):\n-                regex += \"{date:%y%m%d}.fits\"\n-            else:\n-                regex += \"{date:%Y%m%d}.fits\"\n-            url = base_url + regex.format(\n-                    date=day.end, sat=self._get_goes_sat_num(day.end, day.end)[0])\n-            result.append(url)\n+        physobs = kwargs['physobs']\n+        def download_particle_flux(time_range):\n+            now = datetime.datetime.now()\n+            real_time = ((now - time_range.end).total_seconds() <= 300)\n+            result = list()\n+            total_days = (time_range.end - time_range.start).days + 1\n+            all_dates = time_range.split(total_days)\n+            url_pattern = 'ftp://ftp.swpc.noaa.gov/pub/lists/particle/{date:%Y%m%d}_G{char}_part_5m.txt'\n+            for day in all_dates:\n+                result.extend([url_pattern.format(date=day.end, char=ch) for ch in ('p', 's')])\n+            if real_time:\n+                result.extend(['ftp://ftp.swpc.noaa.gov/pub/lists/particle/G{char}_part_5m.txt'.format(char=ch) for ch in ('p', 's')])\n+            return result\n+\n+        def download_irradiance(time_range):\n+            now = datetime.datetime.now()\n+            real_time = ((now - time_range.end).total_seconds() <= 300)\n+            result = list()\n+            total_days = (time_range.end - time_range.start).days + 1\n+            all_dates = time_range.split(total_days)\n+            url_pattern = 'ftp://ftp.swpc.noaa.gov/pub/lists/xray/{date:%Y%m%d}_G{char}_xr_{cad}m.txt'\n+            base_url = 'http://umbra.nascom.nasa.gov/goes/fits/'\n+            for day in all_dates:\n+                regex = \"{date:%Y}/go{sat:02d}%Y%m%d.fits\"\n+                if (now - day.end).days > 3:\n+                    url = base_url + regex.format(date=day.end, sat=self._get_goes_sat_num(day.end, day.end)[0])\n+                    result.append(url)\n+                result.extend([url_pattern.format(char='s', date=day.end, cad=cad) for cad in (1, 5)])\n+                result.extend([url_pattern.format(char='p', date=day.end, cad=cad) for cad in (1, 5)])\n+            if real_time:\n+                result.extend(['ftp://ftp.swpc.noaa.gov/pub/lists/xray/G{char}_xr_1m.txt'.format(char=ch) for ch in ('p', 's')])\n+                result.extend(['ftp://ftp.swpc.noaa.gov/pub/lists/xray/G{char}_xr_5m.txt'.format(char=ch) for ch in ('p', 's')])\n+            return result\n+\n+        def download_intensity(time_range):","path":"sunpy/net/dataretriever/sources/goes.py","position":133,"original_position":133,"commit_id":"baba67a6206985dde9d81190e1a2bb588a733c67","original_commit_id":"baba67a6206985dde9d81190e1a2bb588a733c67","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":"This implementation can be now changed with the new suggested changes to the scraper (#1862)","created_at":"2016-08-01T18:50:11Z","updated_at":"2016-08-01T18:50:11Z","html_url":"https://github.com/sunpy/sunpy/pull/1839#discussion_r73031714","pull_request_url":"https://api.github.com/repos/sunpy/sunpy/pulls/1839","_links":{"self":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/comments/73031714"},"html":{"href":"https://github.com/sunpy/sunpy/pull/1839#discussion_r73031714"},"pull_request":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1839"}}},"pull_request":{"url":"https://api.github.com/repos/sunpy/sunpy/pulls/1839","id":74247413,"html_url":"https://github.com/sunpy/sunpy/pull/1839","diff_url":"https://github.com/sunpy/sunpy/pull/1839.diff","patch_url":"https://github.com/sunpy/sunpy/pull/1839.patch","issue_url":"https://api.github.com/repos/sunpy/sunpy/issues/1839","number":1839,"state":"open","locked":false,"title":"[unidown]GOES Client with additional argument for Physobs.","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":"With this users can now download real-time data for GOES Client. Users need to supply an additional argument ```Physobs``` which can take three values ```PARTICLE_FLUX, INTENSITY, IRRADIANCE```. Real-time logic has also been implemented.\r\n## Usage\r\n```\r\nqr = Fido.search(a.Time, a.Instrument('goes'), a.Physobs('PARTICLE_FLUX')\r\n```\r\n@dpshelio @wafels \r\nReview. \r\nWith this I'm done for my Summer of Code mid-terms. I will now work on polishing existing code that I've written.","created_at":"2016-06-17T14:03:45Z","updated_at":"2016-08-01T18:50:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29248e52453bff42ef625ab5400b7669ba0a2f99","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sunpy/sunpy/pulls/1839/commits","review_comments_url":"https://api.github.com/repos/sunpy/sunpy/pulls/1839/comments","review_comment_url":"https://api.github.com/repos/sunpy/sunpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sunpy/sunpy/issues/1839/comments","statuses_url":"https://api.github.com/repos/sunpy/sunpy/statuses/baba67a6206985dde9d81190e1a2bb588a733c67","head":{"label":"sudk1896:goes-1","ref":"goes-1","sha":"baba67a6206985dde9d81190e1a2bb588a733c67","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-24T09:03:35Z","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":38500,"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-29T12:02:49Z","pushed_at":"2016-08-01T18:46:38Z","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":145522,"stargazers_count":230,"watchers_count":230,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":162,"mirror_url":null,"open_issues_count":269,"forks":162,"open_issues":269,"watchers":230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1839"},"html":{"href":"https://github.com/sunpy/sunpy/pull/1839"},"issue":{"href":"https://api.github.com/repos/sunpy/sunpy/issues/1839"},"comments":{"href":"https://api.github.com/repos/sunpy/sunpy/issues/1839/comments"},"review_comments":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1839/comments"},"review_comment":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sunpy/sunpy/pulls/1839/commits"},"statuses":{"href":"https://api.github.com/repos/sunpy/sunpy/statuses/baba67a6206985dde9d81190e1a2bb588a733c67"}}}}
{"actor":{"display_login":"dpshelio"}}