We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
LYRALightCurve returns level 2 data even when "lev" kwarg is set to 3.
The LYRALightCurve "lev" kwarg is supposed to allow the user to create a lightcurve object with level 2 (sub-second resolution) or level 3 (1-minute resolution).  At the moment, level 2 data is used even if lev=3.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sunpy/lightcurve/sources/lyra.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """Provides programs to process and analyze PROBA2/LYRA data."""
3 from __future__ import absolute_import
4 
5 import datetime
6 import sys
7 from collections import OrderedDict
8 
9 from matplotlib import pyplot as plt
10 from astropy.io import fits
11 import pandas
12 
13 from sunpy.lightcurve import LightCurve
14 from sunpy.time import parse_time
15 
16 from sunpy import config
17 
18 from sunpy.extern.six.moves import urllib
19 
20 TIME_FORMAT = config.get("general", "time_format")
21 
22 __all__ = ['LYRALightCurve']
23 
24 class LYRALightCurve(LightCurve):
25     """
26     Proba-2 LYRA LightCurve.
27 
28     LYRA (Large Yield RAdiometer) is an ultraviolet irradiance radiometer that
29     observes the Sun in four passbands, chosen for their relevance to
30     solar physics, aeronomy and space weather.
31     LYRA is composed of three (redundant) units, each of them constituted of the
32     same four channels:
33 
34         * 120-123 nm Lyman-alpha channel
35         * 190-222 nm Herzberg continuum channel
36         * Aluminium filter channel (17-80 nm + a contribution below 5 nm), including He II at 30.4 nm
37         * Zirconium filter channel (6-20 nm + a contribution below 2 nm), rejecting He II
38 
39     LYRA can take data with cadences chosen in the 100Hz to 0.1Hz interval.
40 
41     PROBA2 was launched on 2 November 2009.
42 
43     Examples
44     --------
45     >>> import sunpy
46     >>> lyra = sunpy.lightcurve.LYRALightCurve.create()
47     >>> lyra = sunpy.lightcurve.LYRALightCurve.create('~/Data/lyra/lyra_20110810-000000_lev2_std.fits')   # doctest: +SKIP
48     >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10')
49     >>> lyra = sunpy.lightcurve.LYRALightCurve.create("http://proba2.oma.be/lyra/data/bsd/2011/08/10/lyra_20110810-000000_lev2_std.fits")
50     >>> lyra.peek()   # doctest: +SKIP
51 
52     References
53     ----------
54     * `Proba2 SWAP Science Center <http://proba2.sidc.be/about/SWAP/>`_
55     * `LYRA Data Homepage <http://proba2.sidc.be/data/LYRA>`_
56     * `LYRA Instrument Homepage <http://proba2.sidc.be/about/LYRA>`_
57     """
58 
59     def peek(self, names=3, **kwargs):
60         """Plots the LYRA data. An example is shown below.
61 
62         .. plot::
63 
64             import sunpy.lightcurve
65             from sunpy.data.sample import LYRA_LEVEL3_LIGHTCURVE
66             lyra = sunpy.lightcurve.LYRALightCurve.create(LYRA_LEVEL3_LIGHTCURVE)
67             lyra.peek()
68 
69         Parameters
70         ----------
71         names : int
72             The number of columns to plot.
73 
74         **kwargs : dict
75             Any additional plot arguments that should be used
76             when plotting.
77 
78         Returns
79         -------
80         fig : `~matplotlib.Figure`
81             A plot figure.
82         """
83         lyranames = (('Lyman alpha','Herzberg cont.','Al filter','Zr filter'),
84                  ('120-123nm','190-222nm','17-80nm + <5nm','6-20nm + <2nm'))
85 
86         # Choose title if none was specified
87         #if not kwargs.has_key("title"):
88         #    if len(self.data.columns) > 1:
89         #        kwargs['title'] = 'LYRA data'
90         #    else:
91         #        if self._filename is not None:
92         #            base = self._filename
93         #            kwargs['title'] = os.path.splitext(base)[0]
94         #        else:
95         #            kwargs['title'] = 'LYRA data'
96         figure = plt.figure()
97         plt.subplots_adjust(left=0.17,top=0.94,right=0.94,bottom=0.15)
98         axes = plt.gca()
99 
100         axes = self.data.plot(ax=axes, subplots=True, sharex=True, **kwargs)
101 
102         for i, name in enumerate(self.data.columns):
103             if names < 3:
104                 name = lyranames[names][i]
105             else:
106                 name = lyranames[0][i] + ' \n (' + lyranames[1][i] + ')'
107             axes[i].set_ylabel( "{name} \n (W/m**2)".format(name=name), fontsize=9.5)
108 
109         axes[0].set_title("LYRA ({0:{1}})".format(self.data.index[0],TIME_FORMAT))
110         axes[-1].set_xlabel("Time")
111         for axe in axes:
112             axe.locator_params(axis='y',nbins=6)
113 
114         figure.show()
115 
116         return figure
117 
118     @staticmethod
119     def _get_url_for_date(date, **kwargs):
120         """Returns a URL to the LYRA data for the specified date"""
121         dt = parse_time(date or datetime.datetime.utcnow())
122 
123         # Filename
124         filename = "lyra_{0:%Y%m%d-}000000_lev{1:d}_std.fits".format(
125             dt, kwargs.get('level', 2))
126         # URL
127         base_url = "http://proba2.oma.be/lyra/data/bsd/"
128         url_path = urllib.parse.urljoin(dt.strftime('%Y/%m/%d/'), filename)
129         return urllib.parse.urljoin(base_url, url_path)
130 
131     @classmethod
132     def _get_default_uri(cls):
133         """Returns URL for latest LYRA data"""
134         return cls._get_url_for_date(datetime.datetime.utcnow())
135 
136     @staticmethod
137     def _parse_fits(filepath):
138         """Parses LYRA data from a FITS file"""
139         # Open file with PyFITS
140         hdulist = fits.open(filepath)
141         fits_record = hdulist[1].data
142         # secondary_header = hdulist[1].header
143 
144         # Start and end dates.  Different LYRA FITS files have
145         # different tags for the date obs.
146         if 'date-obs' in hdulist[0].header:
147             start_str = hdulist[0].header['date-obs']
148         elif 'date_obs' in hdulist[0].header:
149             start_str = hdulist[0].header['date_obs']
150         # end_str = hdulist[0].header['date-end']
151 
152         # start = datetime.datetime.strptime(start_str, '%Y-%m-%dT%H:%M:%S.%f')
153         start = parse_time(start_str)
154         # end = datetime.datetime.strptime(end_str, '%Y-%m-%dT%H:%M:%S.%f')
155 
156         # First column are times.  For level 2 data, the units are [s].
157         # For level 3 data, the units are [min]
158         if hdulist[1].header['TUNIT1'] == 's':
159             times = [start + datetime.timedelta(seconds=n)
160                      for n in fits_record.field(0)]
161         elif hdulist[1].header['TUNIT1'] == 'MIN':
162             times = [start + datetime.timedelta(minutes=int(n))
163                      for n in fits_record.field(0)]
164         else:
165             raise ValueError("Time unit in LYRA fits file not recognised.  "
166                              "Value = {0}".format(hdulist[1].header['TUNIT1']))
167 
168         # Rest of columns are the data
169         table = {}
170 
171         for i, col in enumerate(fits_record.columns[1:-1]):
172             # temporary patch for big-endian data bug on pandas 0.13
173             if fits_record.field(i+1).dtype.byteorder == '>' and sys.byteorder =='little':
174                 table[col.name] = fits_record.field(i + 1).byteswap().newbyteorder()
175             else:
176                 table[col.name] = fits_record.field(i + 1)
177 
178         # Return the header and the data
179         data = pandas.DataFrame(table, index=times)
180         data.sort_index(inplace=True)
181         return OrderedDict(hdulist[0].header), data
182
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sunpy/lightcurve/sources/lyra.py b/sunpy/lightcurve/sources/lyra.py
--- a/sunpy/lightcurve/sources/lyra.py
+++ b/sunpy/lightcurve/sources/lyra.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 """Provides programs to process and analyze PROBA2/LYRA data."""
-from __future__ import absolute_import
+from __future__ import absolute_import, division, print_function
 
 import datetime
 import sys
@@ -40,12 +40,18 @@
 
     PROBA2 was launched on 2 November 2009.
 
+    This class can download and hold either Level 2 data (the default) which
+    has sub-second resolution or Level 3 which is the Level 2 data averaged to
+    one minute cadence. The level can be specified with the ``level`` keyword
+    argument to `~sunpy.lightcurve.LyraLightCurve.create`.
+
     Examples
     --------
     >>> import sunpy
     >>> lyra = sunpy.lightcurve.LYRALightCurve.create()
     >>> lyra = sunpy.lightcurve.LYRALightCurve.create('~/Data/lyra/lyra_20110810-000000_lev2_std.fits')   # doctest: +SKIP
     >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10')
+    >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10', level=3)
     >>> lyra = sunpy.lightcurve.LYRALightCurve.create("http://proba2.oma.be/lyra/data/bsd/2011/08/10/lyra_20110810-000000_lev2_std.fits")
     >>> lyra.peek()   # doctest: +SKIP

{"golden_diff": "diff --git a/sunpy/lightcurve/sources/lyra.py b/sunpy/lightcurve/sources/lyra.py\n--- a/sunpy/lightcurve/sources/lyra.py\n+++ b/sunpy/lightcurve/sources/lyra.py\n@@ -1,6 +1,6 @@\n # -*- coding: utf-8 -*-\n \"\"\"Provides programs to process and analyze PROBA2/LYRA data.\"\"\"\n-from __future__ import absolute_import\n+from __future__ import absolute_import, division, print_function\n \n import datetime\n import sys\n@@ -40,12 +40,18 @@\n \n     PROBA2 was launched on 2 November 2009.\n \n+    This class can download and hold either Level 2 data (the default) which\n+    has sub-second resolution or Level 3 which is the Level 2 data averaged to\n+    one minute cadence. The level can be specified with the ``level`` keyword\n+    argument to `~sunpy.lightcurve.LyraLightCurve.create`.\n+\n     Examples\n     --------\n     >>> import sunpy\n     >>> lyra = sunpy.lightcurve.LYRALightCurve.create()\n     >>> lyra = sunpy.lightcurve.LYRALightCurve.create('~/Data/lyra/lyra_20110810-000000_lev2_std.fits')   # doctest: +SKIP\n     >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10')\n+    >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10', level=3)\n     >>> lyra = sunpy.lightcurve.LYRALightCurve.create(\"http://proba2.oma.be/lyra/data/bsd/2011/08/10/lyra_20110810-000000_lev2_std.fits\")\n     >>> lyra.peek()   # doctest: +SKIP\n", "issue": "LYRALightCurve returns level 2 data even when \"lev\" kwarg is set to 3.\nThe LYRALightCurve \"lev\" kwarg is supposed to allow the user to create a lightcurve object with level 2 (sub-second resolution) or level 3 (1-minute resolution).  At the moment, level 2 data is used even if lev=3.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"Provides programs to process and analyze PROBA2/LYRA data.\"\"\"\nfrom __future__ import absolute_import\n\nimport datetime\nimport sys\nfrom collections import OrderedDict\n\nfrom matplotlib import pyplot as plt\nfrom astropy.io import fits\nimport pandas\n\nfrom sunpy.lightcurve import LightCurve\nfrom sunpy.time import parse_time\n\nfrom sunpy import config\n\nfrom sunpy.extern.six.moves import urllib\n\nTIME_FORMAT = config.get(\"general\", \"time_format\")\n\n__all__ = ['LYRALightCurve']\n\nclass LYRALightCurve(LightCurve):\n    \"\"\"\n    Proba-2 LYRA LightCurve.\n\n    LYRA (Large Yield RAdiometer) is an ultraviolet irradiance radiometer that\n    observes the Sun in four passbands, chosen for their relevance to\n    solar physics, aeronomy and space weather.\n    LYRA is composed of three (redundant) units, each of them constituted of the\n    same four channels:\n\n        * 120-123 nm Lyman-alpha channel\n        * 190-222 nm Herzberg continuum channel\n        * Aluminium filter channel (17-80 nm + a contribution below 5 nm), including He II at 30.4 nm\n        * Zirconium filter channel (6-20 nm + a contribution below 2 nm), rejecting He II\n\n    LYRA can take data with cadences chosen in the 100Hz to 0.1Hz interval.\n\n    PROBA2 was launched on 2 November 2009.\n\n    Examples\n    --------\n    >>> import sunpy\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create()\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create('~/Data/lyra/lyra_20110810-000000_lev2_std.fits')   # doctest: +SKIP\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10')\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create(\"http://proba2.oma.be/lyra/data/bsd/2011/08/10/lyra_20110810-000000_lev2_std.fits\")\n    >>> lyra.peek()   # doctest: +SKIP\n\n    References\n    ----------\n    * `Proba2 SWAP Science Center <http://proba2.sidc.be/about/SWAP/>`_\n    * `LYRA Data Homepage <http://proba2.sidc.be/data/LYRA>`_\n    * `LYRA Instrument Homepage <http://proba2.sidc.be/about/LYRA>`_\n    \"\"\"\n\n    def peek(self, names=3, **kwargs):\n        \"\"\"Plots the LYRA data. An example is shown below.\n\n        .. plot::\n\n            import sunpy.lightcurve\n            from sunpy.data.sample import LYRA_LEVEL3_LIGHTCURVE\n            lyra = sunpy.lightcurve.LYRALightCurve.create(LYRA_LEVEL3_LIGHTCURVE)\n            lyra.peek()\n\n        Parameters\n        ----------\n        names : int\n            The number of columns to plot.\n\n        **kwargs : dict\n            Any additional plot arguments that should be used\n            when plotting.\n\n        Returns\n        -------\n        fig : `~matplotlib.Figure`\n            A plot figure.\n        \"\"\"\n        lyranames = (('Lyman alpha','Herzberg cont.','Al filter','Zr filter'),\n                 ('120-123nm','190-222nm','17-80nm + <5nm','6-20nm + <2nm'))\n\n        # Choose title if none was specified\n        #if not kwargs.has_key(\"title\"):\n        #    if len(self.data.columns) > 1:\n        #        kwargs['title'] = 'LYRA data'\n        #    else:\n        #        if self._filename is not None:\n        #            base = self._filename\n        #            kwargs['title'] = os.path.splitext(base)[0]\n        #        else:\n        #            kwargs['title'] = 'LYRA data'\n        figure = plt.figure()\n        plt.subplots_adjust(left=0.17,top=0.94,right=0.94,bottom=0.15)\n        axes = plt.gca()\n\n        axes = self.data.plot(ax=axes, subplots=True, sharex=True, **kwargs)\n\n        for i, name in enumerate(self.data.columns):\n            if names < 3:\n                name = lyranames[names][i]\n            else:\n                name = lyranames[0][i] + ' \\n (' + lyranames[1][i] + ')'\n            axes[i].set_ylabel( \"{name} \\n (W/m**2)\".format(name=name), fontsize=9.5)\n\n        axes[0].set_title(\"LYRA ({0:{1}})\".format(self.data.index[0],TIME_FORMAT))\n        axes[-1].set_xlabel(\"Time\")\n        for axe in axes:\n            axe.locator_params(axis='y',nbins=6)\n\n        figure.show()\n\n        return figure\n\n    @staticmethod\n    def _get_url_for_date(date, **kwargs):\n        \"\"\"Returns a URL to the LYRA data for the specified date\"\"\"\n        dt = parse_time(date or datetime.datetime.utcnow())\n\n        # Filename\n        filename = \"lyra_{0:%Y%m%d-}000000_lev{1:d}_std.fits\".format(\n            dt, kwargs.get('level', 2))\n        # URL\n        base_url = \"http://proba2.oma.be/lyra/data/bsd/\"\n        url_path = urllib.parse.urljoin(dt.strftime('%Y/%m/%d/'), filename)\n        return urllib.parse.urljoin(base_url, url_path)\n\n    @classmethod\n    def _get_default_uri(cls):\n        \"\"\"Returns URL for latest LYRA data\"\"\"\n        return cls._get_url_for_date(datetime.datetime.utcnow())\n\n    @staticmethod\n    def _parse_fits(filepath):\n        \"\"\"Parses LYRA data from a FITS file\"\"\"\n        # Open file with PyFITS\n        hdulist = fits.open(filepath)\n        fits_record = hdulist[1].data\n        # secondary_header = hdulist[1].header\n\n        # Start and end dates.  Different LYRA FITS files have\n        # different tags for the date obs.\n        if 'date-obs' in hdulist[0].header:\n            start_str = hdulist[0].header['date-obs']\n        elif 'date_obs' in hdulist[0].header:\n            start_str = hdulist[0].header['date_obs']\n        # end_str = hdulist[0].header['date-end']\n\n        # start = datetime.datetime.strptime(start_str, '%Y-%m-%dT%H:%M:%S.%f')\n        start = parse_time(start_str)\n        # end = datetime.datetime.strptime(end_str, '%Y-%m-%dT%H:%M:%S.%f')\n\n        # First column are times.  For level 2 data, the units are [s].\n        # For level 3 data, the units are [min]\n        if hdulist[1].header['TUNIT1'] == 's':\n            times = [start + datetime.timedelta(seconds=n)\n                     for n in fits_record.field(0)]\n        elif hdulist[1].header['TUNIT1'] == 'MIN':\n            times = [start + datetime.timedelta(minutes=int(n))\n                     for n in fits_record.field(0)]\n        else:\n            raise ValueError(\"Time unit in LYRA fits file not recognised.  \"\n                             \"Value = {0}\".format(hdulist[1].header['TUNIT1']))\n\n        # Rest of columns are the data\n        table = {}\n\n        for i, col in enumerate(fits_record.columns[1:-1]):\n            # temporary patch for big-endian data bug on pandas 0.13\n            if fits_record.field(i+1).dtype.byteorder == '>' and sys.byteorder =='little':\n                table[col.name] = fits_record.field(i + 1).byteswap().newbyteorder()\n            else:\n                table[col.name] = fits_record.field(i + 1)\n\n        # Return the header and the data\n        data = pandas.DataFrame(table, index=times)\n        data.sort_index(inplace=True)\n        return OrderedDict(hdulist[0].header), data\n", "path": "sunpy/lightcurve/sources/lyra.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"Provides programs to process and analyze PROBA2/LYRA data.\"\"\"\nfrom __future__ import absolute_import, division, print_function\n\nimport datetime\nimport sys\nfrom collections import OrderedDict\n\nfrom matplotlib import pyplot as plt\nfrom astropy.io import fits\nimport pandas\n\nfrom sunpy.lightcurve import LightCurve\nfrom sunpy.time import parse_time\n\nfrom sunpy import config\n\nfrom sunpy.extern.six.moves import urllib\n\nTIME_FORMAT = config.get(\"general\", \"time_format\")\n\n__all__ = ['LYRALightCurve']\n\nclass LYRALightCurve(LightCurve):\n    \"\"\"\n    Proba-2 LYRA LightCurve.\n\n    LYRA (Large Yield RAdiometer) is an ultraviolet irradiance radiometer that\n    observes the Sun in four passbands, chosen for their relevance to\n    solar physics, aeronomy and space weather.\n    LYRA is composed of three (redundant) units, each of them constituted of the\n    same four channels:\n\n        * 120-123 nm Lyman-alpha channel\n        * 190-222 nm Herzberg continuum channel\n        * Aluminium filter channel (17-80 nm + a contribution below 5 nm), including He II at 30.4 nm\n        * Zirconium filter channel (6-20 nm + a contribution below 2 nm), rejecting He II\n\n    LYRA can take data with cadences chosen in the 100Hz to 0.1Hz interval.\n\n    PROBA2 was launched on 2 November 2009.\n\n    This class can download and hold either Level 2 data (the default) which\n    has sub-second resolution or Level 3 which is the Level 2 data averaged to\n    one minute cadence. The level can be specified with the ``level`` keyword\n    argument to `~sunpy.lightcurve.LyraLightCurve.create`.\n\n    Examples\n    --------\n    >>> import sunpy\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create()\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create('~/Data/lyra/lyra_20110810-000000_lev2_std.fits')   # doctest: +SKIP\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10')\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create('2011/08/10', level=3)\n    >>> lyra = sunpy.lightcurve.LYRALightCurve.create(\"http://proba2.oma.be/lyra/data/bsd/2011/08/10/lyra_20110810-000000_lev2_std.fits\")\n    >>> lyra.peek()   # doctest: +SKIP\n\n    References\n    ----------\n    * `Proba2 SWAP Science Center <http://proba2.sidc.be/about/SWAP/>`_\n    * `LYRA Data Homepage <http://proba2.sidc.be/data/LYRA>`_\n    * `LYRA Instrument Homepage <http://proba2.sidc.be/about/LYRA>`_\n    \"\"\"\n\n    def peek(self, names=3, **kwargs):\n        \"\"\"Plots the LYRA data. An example is shown below.\n\n        .. plot::\n\n            import sunpy.lightcurve\n            from sunpy.data.sample import LYRA_LEVEL3_LIGHTCURVE\n            lyra = sunpy.lightcurve.LYRALightCurve.create(LYRA_LEVEL3_LIGHTCURVE)\n            lyra.peek()\n\n        Parameters\n        ----------\n        names : int\n            The number of columns to plot.\n\n        **kwargs : dict\n            Any additional plot arguments that should be used\n            when plotting.\n\n        Returns\n        -------\n        fig : `~matplotlib.Figure`\n            A plot figure.\n        \"\"\"\n        lyranames = (('Lyman alpha','Herzberg cont.','Al filter','Zr filter'),\n                 ('120-123nm','190-222nm','17-80nm + <5nm','6-20nm + <2nm'))\n\n        # Choose title if none was specified\n        #if not kwargs.has_key(\"title\"):\n        #    if len(self.data.columns) > 1:\n        #        kwargs['title'] = 'LYRA data'\n        #    else:\n        #        if self._filename is not None:\n        #            base = self._filename\n        #            kwargs['title'] = os.path.splitext(base)[0]\n        #        else:\n        #            kwargs['title'] = 'LYRA data'\n        figure = plt.figure()\n        plt.subplots_adjust(left=0.17,top=0.94,right=0.94,bottom=0.15)\n        axes = plt.gca()\n\n        axes = self.data.plot(ax=axes, subplots=True, sharex=True, **kwargs)\n\n        for i, name in enumerate(self.data.columns):\n            if names < 3:\n                name = lyranames[names][i]\n            else:\n                name = lyranames[0][i] + ' \\n (' + lyranames[1][i] + ')'\n            axes[i].set_ylabel( \"{name} \\n (W/m**2)\".format(name=name), fontsize=9.5)\n\n        axes[0].set_title(\"LYRA ({0:{1}})\".format(self.data.index[0],TIME_FORMAT))\n        axes[-1].set_xlabel(\"Time\")\n        for axe in axes:\n            axe.locator_params(axis='y',nbins=6)\n\n        figure.show()\n\n        return figure\n\n    @staticmethod\n    def _get_url_for_date(date, **kwargs):\n        \"\"\"Returns a URL to the LYRA data for the specified date\"\"\"\n        dt = parse_time(date or datetime.datetime.utcnow())\n\n        # Filename\n        filename = \"lyra_{0:%Y%m%d-}000000_lev{1:d}_std.fits\".format(\n            dt, kwargs.get('level', 2))\n        # URL\n        base_url = \"http://proba2.oma.be/lyra/data/bsd/\"\n        url_path = urllib.parse.urljoin(dt.strftime('%Y/%m/%d/'), filename)\n        return urllib.parse.urljoin(base_url, url_path)\n\n    @classmethod\n    def _get_default_uri(cls):\n        \"\"\"Returns URL for latest LYRA data\"\"\"\n        return cls._get_url_for_date(datetime.datetime.utcnow())\n\n    @staticmethod\n    def _parse_fits(filepath):\n        \"\"\"Parses LYRA data from a FITS file\"\"\"\n        # Open file with PyFITS\n        hdulist = fits.open(filepath)\n        fits_record = hdulist[1].data\n        # secondary_header = hdulist[1].header\n\n        # Start and end dates.  Different LYRA FITS files have\n        # different tags for the date obs.\n        if 'date-obs' in hdulist[0].header:\n            start_str = hdulist[0].header['date-obs']\n        elif 'date_obs' in hdulist[0].header:\n            start_str = hdulist[0].header['date_obs']\n        # end_str = hdulist[0].header['date-end']\n\n        # start = datetime.datetime.strptime(start_str, '%Y-%m-%dT%H:%M:%S.%f')\n        start = parse_time(start_str)\n        # end = datetime.datetime.strptime(end_str, '%Y-%m-%dT%H:%M:%S.%f')\n\n        # First column are times.  For level 2 data, the units are [s].\n        # For level 3 data, the units are [min]\n        if hdulist[1].header['TUNIT1'] == 's':\n            times = [start + datetime.timedelta(seconds=n)\n                     for n in fits_record.field(0)]\n        elif hdulist[1].header['TUNIT1'] == 'MIN':\n            times = [start + datetime.timedelta(minutes=int(n))\n                     for n in fits_record.field(0)]\n        else:\n            raise ValueError(\"Time unit in LYRA fits file not recognised.  \"\n                             \"Value = {0}\".format(hdulist[1].header['TUNIT1']))\n\n        # Rest of columns are the data\n        table = {}\n\n        for i, col in enumerate(fits_record.columns[1:-1]):\n            # temporary patch for big-endian data bug on pandas 0.13\n            if fits_record.field(i+1).dtype.byteorder == '>' and sys.byteorder =='little':\n                table[col.name] = fits_record.field(i + 1).byteswap().newbyteorder()\n            else:\n                table[col.name] = fits_record.field(i + 1)\n\n        # Return the header and the data\n        data = pandas.DataFrame(table, index=times)\n        data.sort_index(inplace=True)\n        return OrderedDict(hdulist[0].header), data\n", "path": "sunpy/lightcurve/sources/lyra.py"}]}