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

    Click :ref:`here <sphx_glr_download_source_auto_examples_plot_power_spectra.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_source_auto_examples_plot_power_spectra.py:


Example on deriving lidar moments from raw IQ data
--------------------------------------------------



.. image:: /source/auto_examples/images/sphx_glr_plot_power_spectra_001.png
    :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    /home/rjackson/.conda/envs/spectra_env/lib/python3.7/site-packages/xarray/core/computation.py:609: RuntimeWarning: divide by zero encountered in log10
      result_data = func(*input_data)
    /home/rjackson/HighIQ/examples/plot_power_spectra.py:22: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
      plt.show()






|


.. code-block:: default

    import highiq
    import matplotlib.pyplot as plt

    from datetime import datetime

    # Load an example ARM compliant-file
    test_file = highiq.io.load_arm_netcdf(highiq.testing.TEST_FILE)

    # Get the particle size distributions
    my_ds = highiq.calc.get_psd(test_file)

    # Plot the power spectra for a given time and height
    my_time = datetime(2017, 8, 4, 0, 40, 59)
    fig, ax = plt.subplots(1, 2, figsize=(15, 5))
    my_ds["power_spectra_normed_interp"].sel(time=my_time, range=350., method='nearest').plot(ax=ax[0])
    my_ds["power_spectra_normed_interp"].sel(time=my_time, range=950., method='nearest').plot(ax=ax[1])
    plt.show()

    test_file.close()

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

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


.. _sphx_glr_download_source_auto_examples_plot_power_spectra.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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