.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_model_along_trajectory.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_gallery_example_model_along_trajectory.py: Read variables from a model along the trajectories of drifters. ============================================================================= .. GENERATED FROM PYTHON SOURCE LINES 5-13 .. code-block:: Python import xarray as xr import numpy as np import cf_xarray as _ import pyproj import trajan as ta import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 14-15 Open drifter dataset from a CSV file .. GENERATED FROM PYTHON SOURCE LINES 15-22 .. code-block:: Python ds = ta.read_csv('bug05_pos.csv.xz', lon='Longitude', lat='Latitude', time='Time', name='Device') print(ds) .. rst-class:: sphx-glr-script-out .. code-block:: none 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detecting trajectory dimension 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG No trajectory_id attribute/variable found, trying to identify by name. 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detecting time-variable for "obs".. 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detected obs-dim: obs, detected time-variable: time. 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detected un-structured (2D) trajectory dataset 2025-09-09 15:15:39 runnervmf4ws1 trajan.traj2d[2509] DEBUG Condensing 844 observations. 2025-09-09 15:15:39 runnervmf4ws1 trajan.traj2d[2509] DEBUG Condensed observations from: 844 to 844 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detecting trajectory dimension 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG No trajectory_id attribute/variable found, trying to identify by name. 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detecting time-variable for "obs".. 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detected obs-dim: obs, detected time-variable: time. 2025-09-09 15:15:39 runnervmf4ws1 trajan.accessor[2509] DEBUG Detected un-structured (2D) trajectory dataset 2025-09-09 15:15:39 runnervmf4ws1 trajan.traj[2509] DEBUG No grid-mapping specified, checking if coordinates are lon/lat.. 2025-09-09 15:15:39 runnervmf4ws1 trajan.traj[2509] DEBUG No grid-mapping specified, checking if coordinates are lon/lat.. 2025-09-09 15:15:39 runnervmf4ws1 trajan.traj[2509] DEBUG No grid-mapping specified, checking if coordinates are lon/lat.. 2025-09-09 15:15:39 runnervmf4ws1 trajan.traj[2509] DEBUG No grid-mapping specified, checking if coordinates are lon/lat.. Size: 27kB Dimensions: (trajectory: 1, obs: 844) Coordinates: * trajectory (trajectory) Size: 6kB Dimensions: (trajectory: 1, time: 239) Coordinates: * time (time) datetime64[ns] 2kB 2022-05-10T13:00:00 ... 2022-05-20T... * trajectory (trajectory) Size: 956B [239 values with dtype=float32] Coordinates: X (trajectory, time) float64 2kB 3.416e+05 3.416e+05 ... 3.464e+05 Y (trajectory, time) float64 2kB 4.344e+05 4.344e+05 ... 4.416e+05 depth float64 8B 0.0 * time (time) datetime64[ns] 2kB 2022-05-10T13:00:00 ... 2022-05-20T... lat (trajectory, time) float64 2kB ... lon (trajectory, time) float64 2kB ... * trajectory (trajectory) ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_model_along_trajectory.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_model_along_trajectory.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_