.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated/gallery/downloads/download_proba2.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_gallery_downloads_download_proba2.py: ========================= Download PROBA2/SWAP data ========================= This example shows how to download PROBA2/SWAP data from the `PROBA2 Science center `__ using the ITI tool. .. GENERATED FROM PYTHON SOURCE LINES 7-18 .. code-block:: Python import glob import os from datetime import datetime from sunpy.map import Map import matplotlib.pyplot as plt from itipy.download.download_proba2 import PROBA2Downloader .. GENERATED FROM PYTHON SOURCE LINES 19-20 Initialize path where to download the data .. GENERATED FROM PYTHON SOURCE LINES 20-22 .. code-block:: Python base_path = os.getcwd() .. GENERATED FROM PYTHON SOURCE LINES 23-24 Set up the downloader for PROBA2/SWAP with the path to download the data .. GENERATED FROM PYTHON SOURCE LINES 24-26 .. code-block:: Python downloader = PROBA2Downloader(base_path=base_path+'/swap') .. GENERATED FROM PYTHON SOURCE LINES 27-28 Download the data for a specific date .. GENERATED FROM PYTHON SOURCE LINES 28-30 .. code-block:: Python downloader.downloadDate(date=datetime(2023, 5, 8, 15)) .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/iti-documentation/envs/latest/lib/python3.8/site-packages/sunpy/net/vso/vso.py:210: SunpyUserWarning: VSO-C500 :soap:Server : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /var/www/vso/local/lib/perl5/Physics/Solar/VSO/DataProvider/ROB.pm line 83. warn_user(resp["error"]) .. GENERATED FROM PYTHON SOURCE LINES 31-32 Glob the downloaded files and sort them by date .. GENERATED FROM PYTHON SOURCE LINES 32-34 .. code-block:: Python swap_files = sorted(glob.glob('swap/*/*.fits', recursive=True)) .. GENERATED FROM PYTHON SOURCE LINES 35-36 In the next step we load the `.fits`files as SunPy maps. .. GENERATED FROM PYTHON SOURCE LINES 36-38 .. code-block:: Python swap_map = Map(swap_files[0]) .. GENERATED FROM PYTHON SOURCE LINES 39-40 We can visualize the map using the SunPy plotting capabilities .. GENERATED FROM PYTHON SOURCE LINES 40-44 .. code-block:: Python plt.figure(figsize=(10, 10)) swap_map.plot() plt.show() .. image-sg:: /generated/gallery/downloads/images/sphx_glr_download_proba2_001.png :alt: SWAP $174 \; \mathrm{\mathring{A}}$ 2023-05-08 14:59:40 :srcset: /generated/gallery/downloads/images/sphx_glr_download_proba2_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase] INFO:sunpy:Missing metadata for solar radius: assuming the standard radius of the photosphere. INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase] INFO:sunpy:Missing metadata for solar radius: assuming the standard radius of the photosphere. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 10.035 seconds) .. _sphx_glr_download_generated_gallery_downloads_download_proba2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: download_proba2.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: download_proba2.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: download_proba2.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_