.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_vector_plot_0_vector.py: Vector, 1D{2} dataset --------------------- The 1D{2} datasets are one-dimensional, :math:`d=1`, with two-component dependent variable, :math:`p=2`. Such datasets are more common with the weather forecast, such as the wind velocity predicting at a location as a function of time. The following is an example of a simulated 1D vector field dataset. .. code-block:: default import csdmpy as cp filename = "https://osu.box.com/shared/static/w63851uqruzhz6kx9rx5qgk3or2pot9l.csdf" vector_data = cp.load(filename) print(vector_data.data_structure) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none { "csdm": { "version": "1.0", "read_only": true, "timestamp": "2019-02-12T10:00:00Z", "dimensions": [ { "type": "linear", "count": 10, "increment": "1.0 m", "quantity_name": "length", "reciprocal": { "quantity_name": "wavenumber" } } ], "dependent_variables": [ { "type": "internal", "numeric_type": "float32", "quantity_type": "vector_2", "components": [ [ "0.6907923, 0.31292602, ..., 0.40570852, 0.7005596" ], [ "0.5603441, 0.06866818, ..., 0.48200375, 0.15077808" ] ] } ] } } The tuple of the dimension and dependent variable instances from this example are .. code-block:: default x = vector_data.dimensions y = vector_data.dependent_variables with coordinates .. code-block:: default print(x[0].coordinates) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none [0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] m In this example, the components of the dependent variable are vectors as seen from the :attr:`~csdmpy.DependentVariable.quantity_type` attribute of the corresponding dependent variable instance. .. code-block:: default print(y[0].quantity_type) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none vector_2 From the value `vector_2`, `vector` indicates a vector dataset, while `2` indicates the number of vector components. **Visualizing the dataset** .. code-block:: default cp.plot(vector_data) .. image:: /auto_examples/vector/images/sphx_glr_plot_0_vector_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.196 seconds) .. _sphx_glr_download_auto_examples_vector_plot_0_vector.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: plot_0_vector.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_0_vector.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_