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

.. only:: html

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

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

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

.. _sphx_glr_auto_examples_text_only_save_hdf.py:


Saving HDF5 Files
=================

an example of saving nddata to hdf5 files, which preserves all of the nddata
information flawlessly

.. GENERATED FROM PYTHON SOURCE LINES 7-22




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

 .. code-block:: none

    file already exists, not creating again -- delete the file or node if wanted
    found data: array([0.        , 0.55555556, 1.11111111, 1.66666667, 2.22222222,
           2.77777778, 3.33333333, 3.88888889, 4.44444444, 5.        ])
                    +/-None
            dimlabels=['x']
            axes={`x':array([0.        , 0.55555556, 1.11111111, 1.66666667, 2.22222222,
           2.77777778, 3.33333333, 3.88888889, 4.44444444, 5.        ])
                            +/-None}

    found data: array([0.        , 0.55555556, 1.11111111, 1.66666667, 2.22222222,
           2.77777778, 3.33333333, 3.88888889, 4.44444444, 5.        ])
                    +/-None
            dimlabels=['x']
            axes={`x':array([0.        , 0.55555556, 1.11111111, 1.66666667, 2.22222222,
           2.77777778, 3.33333333, 3.88888889, 4.44444444, 5.        ])
                            +/-None}







|

.. code-block:: default

    from pyspecdata import *
    a = nddata(r_[0:5:10j], 'x')
    a.name('test_data')
    try:
        a.hdf5_write('example.h5',getDATADIR(exp_type='francklab_esr/Sam'))
    except:
        print("file already exists, not creating again -- delete the file or node if wanted")
    # read the file by the "raw method"
    b = nddata_hdf5('example.h5/test_data',
            getDATADIR(exp_type='francklab_esr/Sam'))
    print("found data:",b)
    # or use the find file method
    c = find_file('example.h5', exp_type='francklab_esr/Sam',
            expno='test_data')
    print("found data:",c)


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

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


.. _sphx_glr_download_auto_examples_text_only_save_hdf.py:

.. only:: html

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


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

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

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

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


.. only:: html

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

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