In [15]:
from sunpy.lightcurve import GOESLightCurve
In [16]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
In [17]:
goes = GOESLightCurve.create('2008/05/04 01:10','2008/05/04 02:10')
http://satdat.ngdc.noaa.gov/sem/goes/data/new_full/2008/05/goes13/netcdf/g13_xrs_2s_20080504_20080504.nc
ERROR: URLError: <urlopen error Unable to download data at specified URL> [sunpy.lightcurve.lightcurve]
---------------------------------------------------------------------------
URLError Traceback (most recent call last)
<ipython-input-17-e3abf15f7ddf> in <module>()
----> 1 goes = GOESLightCurve.create('2008/05/04 01:10','2008/05/04 02:10')
/Users/schriste/Dropbox/Developer/python/sunpy/sunpy/util/cond_dispatch.pyc in <lambda>(*args, **kwargs)
208
209 def wrapper(self):
--> 210 return lambda *args, **kwargs: self(*args, **kwargs)
211
212 def get_signatures(self, prefix="", start=0):
/Users/schriste/Dropbox/Developer/python/sunpy/sunpy/util/cond_dispatch.pyc in __call__(self, *args, **kwargs)
191 matched = True
192 if condition(*args, **kwargs):
--> 193 return fun(*args, **kwargs)
194 for fun, types in self.nones:
195 if (matches_signature(fun, args, kwargs) and
/Users/schriste/Dropbox/Developer/python/sunpy/sunpy/util/cond_dispatch.pyc in <lambda>(cls, *args, **kwargs)
84 def run_cls(name):
85 """ run_cls("foo")(cls, *args, **kwargs) -> cls.foo(*args, **kwargs) """
---> 86 fun = lambda cls, *args, **kwargs: getattr(cls, name)(*args, **kwargs)
87 fun.__name__ = name
88 fun.run_cls = True
/Users/schriste/Dropbox/Developer/python/sunpy/sunpy/lightcurve/lightcurve.pyc in from_range(cls, start, end, **kwargs)
105 filepath = cls._download(
106 url, kwargs,
--> 107 err = "Unable to download data for specified date range"
108 )
109 result = cls.from_file(filepath)
/Users/schriste/Dropbox/Developer/python/sunpy/sunpy/lightcurve/sources/goes.py in _download(uri, kwargs, err, filename)
162 def _download(uri, kwargs, err='Unable to download data at specified URL',
163 filename = None):
--> 164 filepath = LightCurve._download(uri,kwargs,filename=None)
165
166 return filepath
/Users/schriste/Dropbox/Developer/python/sunpy/sunpy/lightcurve/lightcurve.pyc in _download(uri, kwargs, err, filename)
222 response = urllib2.urlopen(uri)
223 except (urllib2.HTTPError, urllib2.URLError):
--> 224 raise urllib2.URLError(err)
225 with open(filepath, 'wb') as fp:
226 shutil.copyfileobj(response, fp)
URLError: <urlopen error Unable to download data at specified URL>
In [10]:
goes.data
Out[10]:
xrsa
xrsb
2010-05-04 01:10:01.157000
3.108550e-09
6.784440e-08
2010-05-04 01:10:03.203000
3.686880e-09
6.527820e-08
2010-05-04 01:10:05.253000
3.108550e-09
6.527820e-08
2010-05-04 01:10:07.300000
3.686880e-09
6.784440e-08
2010-05-04 01:10:09.347000
2.530210e-09
6.527820e-08
2010-05-04 01:10:11.397000
5.421890e-09
6.527820e-08
2010-05-04 01:10:13.443000
4.843550e-09
6.784440e-08
2010-05-04 01:10:15.490000
3.686880e-09
6.527820e-08
2010-05-04 01:10:17.540000
3.108550e-09
6.271200e-08
2010-05-04 01:10:19.587000
4.843550e-09
6.527820e-08
2010-05-04 01:10:21.637000
6.578560e-09
6.527820e-08
2010-05-04 01:10:23.683000
4.843550e-09
6.784440e-08
2010-05-04 01:10:25.730000
3.686880e-09
6.784440e-08
2010-05-04 01:10:27.780000
3.686880e-09
6.784440e-08
2010-05-04 01:10:29.827000
4.265220e-09
6.527820e-08
2010-05-04 01:10:31.877000
4.265220e-09
6.271200e-08
2010-05-04 01:10:33.923000
3.108550e-09
7.041060e-08
2010-05-04 01:10:35.970000
4.843550e-09
6.784440e-08
2010-05-04 01:10:38.020000
3.686880e-09
6.784440e-08
2010-05-04 01:10:40.067000
4.265220e-09
7.041060e-08
2010-05-04 01:10:42.117000
2.530210e-09
7.041060e-08
2010-05-04 01:10:44.163000
3.108550e-09
7.041060e-08
2010-05-04 01:10:46.210000
2.530210e-09
6.784440e-08
2010-05-04 01:10:48.260000
4.265220e-09
7.041060e-08
2010-05-04 01:10:50.307000
3.108550e-09
6.784440e-08
2010-05-04 01:10:52.357000
4.843550e-09
7.041060e-08
2010-05-04 01:10:54.403000
1.373550e-09
6.784440e-08
2010-05-04 01:10:56.450000
3.108550e-09
6.784440e-08
2010-05-04 01:10:58.500000
4.843550e-09
6.784440e-08
2010-05-04 01:11:00.547000
3.686880e-09
6.784440e-08
2010-05-04 01:11:02.597000
5.421890e-09
6.784440e-08
2010-05-04 01:11:04.643000
4.843550e-09
6.784440e-08
2010-05-04 01:11:06.690000
5.421890e-09
7.041060e-08
2010-05-04 01:11:08.740000
4.265220e-09
6.527820e-08
2010-05-04 01:11:10.787000
4.843550e-09
6.784440e-08
2010-05-04 01:11:12.837000
4.843550e-09
6.784440e-08
2010-05-04 01:11:14.883000
4.265220e-09
6.527820e-08
2010-05-04 01:11:16.930000
3.686880e-09
6.784440e-08
2010-05-04 01:11:18.980000
2.530210e-09
6.527820e-08
2010-05-04 01:11:21.027000
3.108550e-09
6.271200e-08
2010-05-04 01:11:23.077000
3.108550e-09
5.757950e-08
2010-05-04 01:11:25.123000
2.530210e-09
6.784440e-08
2010-05-04 01:11:27.170000
2.530210e-09
6.527820e-08
2010-05-04 01:11:29.220000
2.530210e-09
6.527820e-08
2010-05-04 01:11:31.267000
2.530210e-09
6.527820e-08
2010-05-04 01:11:33.317000
2.530210e-09
6.271200e-08
2010-05-04 01:11:35.363000
3.108550e-09
6.527820e-08
2010-05-04 01:11:37.410000
3.686880e-09
6.784440e-08
2010-05-04 01:11:39.460000
4.843550e-09
6.527820e-08
2010-05-04 01:11:41.507000
3.686880e-09
6.784440e-08
2010-05-04 01:11:43.557000
3.686880e-09
6.527820e-08
2010-05-04 01:11:45.603000
2.530210e-09
6.527820e-08
2010-05-04 01:11:47.650000
1.000000e-09
6.271200e-08
2010-05-04 01:11:49.700000
1.000000e-09
6.527820e-08
2010-05-04 01:11:51.747000
1.000000e-09
6.784440e-08
2010-05-04 01:11:53.793000
1.951880e-09
6.527820e-08
2010-05-04 01:11:55.843000
1.951880e-09
6.271200e-08
2010-05-04 01:11:57.890000
1.951880e-09
6.527820e-08
2010-05-04 01:11:59.937000
2.530210e-09
6.014580e-08
2010-05-04 01:12:01.987000
3.686880e-09
6.527820e-08
...
...
1758 rows × 2 columns
In [11]:
goes.data['xrsa'].max()
Out[11]:
1.06269e-08
In [12]:
import matplotlib.pyplot as plt
In [13]:
plt.figure()
Out[13]:
<matplotlib.figure.Figure at 0x109783ed0>
<matplotlib.figure.Figure at 0x109783ed0>
In [14]:
goes.data.plot()
Out[14]:
<matplotlib.axes.AxesSubplot at 0x109577b90>
In [8]:
Content source: ehsteve/ipython-notebooks
Similar notebooks: