
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "source/auto_examples/multidata_example.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_source_auto_examples_multidata_example.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_source_auto_examples_multidata_example.py:


==================================================
Example on how to plot multiple datasets at a time
==================================================

This is an example of how to download and
plot multiple datasets at a time.

.. image:: ../../multi_ds_plot1.png

.. GENERATED FROM PYTHON SOURCE LINES 12-51

.. code-block:: default


    import act
    import matplotlib.pyplot as plt

    # Place your username and token here
    username = ''
    token = ''

    act.discovery.download_data(username, token, 'sgpceilC1.b1', '2019-01-01', '2019-01-07')

    # Read in CEIL data and correct it
    ceil_ds = act.io.armfiles.read_netcdf('sgpceilC1.b1/sgpceilC1.b1.201901*.nc')
    ceil_ds = act.corrections.ceil.correct_ceil(ceil_ds, -9999.)

    # Read in the MET data
    met_ds = act.io.armfiles.read_netcdf(
        act.tests.sample_files.EXAMPLE_MET_WILDCARD)

    # You can use tuples if the datasets in the tuple contain a
    # datastream attribute. This is required in all ARM datasets.
    display = act.plotting.TimeSeriesDisplay(
        (ceil_ds, met_ds), subplot_shape=(2, ), figsize=(15, 10))
    display.plot('backscatter', 'sgpceilC1.b1', subplot_index=(0, ))
    display.plot('temp_mean', 'sgpmetE13.b1', subplot_index=(1, ))
    display.day_night_background('sgpmetE13.b1', subplot_index=(1, ))
    plt.show()

    # You can also use a dictionary so that you can customize
    # your datastream names to something that may be more useful.
    display = act.plotting.TimeSeriesDisplay(
        {'ceiliometer': ceil_ds, 'met': met_ds},
        subplot_shape=(2, ), figsize=(15, 10))
    display.plot('backscatter', 'ceiliometer', subplot_index=(0, ))
    display.plot('temp_mean', 'met', subplot_index=(1, ))
    display.day_night_background('met', subplot_index=(1, ))
    plt.show()

    ceil_ds.close()
    met_ds.close()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.000 seconds)


.. _sphx_glr_download_source_auto_examples_multidata_example.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: multidata_example.py <multidata_example.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: multidata_example.ipynb <multidata_example.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
