.. 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-15 .. 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 print(ta.versions()) .. rst-class:: sphx-glr-script-out .. code-block:: none ------------------------------------------------------ Software and hardware: TrajAn version 0.0.0 Platform: Linux, 6.17.0-1022-azure 15.614940643310547 GB memory 4 processors (x86_64) NumPy version 2.5.2 SciPy version 1.18.0 Matplotlib version 3.11.1 NetCDF4 version 1.7.4 Xarray version 2025.9.0 Pandas version 3.0.5 OpenDrift version 1.14.10 Python version 3.14.6 | packaged by conda-forge | (main, Aug 11 2026, 10:26:15) [GCC 14.4.0] ------------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 16-17 Open drifter dataset from a CSV file .. GENERATED FROM PYTHON SOURCE LINES 17-24 .. code-block:: Python ds = ta.read_csv(ta.DATA_DIR + 'omb/bug05_pos.csv', lon='Longitude', lat='Latitude', time='Time', name='Device') print(ds) .. rst-class:: sphx-glr-script-out .. code-block:: none 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detecting trajectory dimension 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG No trajectory_id attribute/variable found, trying to identify by name. 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detecting time-variable for "obs".. 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] WARNING No time CF-variable with dimension obs 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] WARNING Found instead variable with time in name: time 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detected obs-dim: obs, detected time-variable: time. 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detected Ragged trajectory dataset 2026-08-24 11:11:03 runnervm76f27 trajan.traj.ragged[2752] DEBUG Condensing 844 observations. 2026-08-24 11:11:03 runnervm76f27 trajan.traj.ragged[2752] DEBUG Condensed observations from: 844 to 844 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detecting trajectory dimension 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG No trajectory_id attribute/variable found, trying to identify by name. 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detecting time-variable for "obs".. 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] WARNING No time CF-variable with dimension obs 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] WARNING Found instead variable with time in name: time 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detected obs-dim: obs, detected time-variable: time. 2026-08-24 11:11:03 runnervm76f27 trajan.accessor[2752] DEBUG Detected Ragged trajectory dataset Size: 20kB Dimensions: (trajectory: 1, obs: 844) Coordinates: * trajectory (trajectory) Size: 6kB Dimensions: (trajectory: 1, time: 251) Coordinates: * time (time) datetime64[us] 2kB 2022-05-10T13:00:00 ... 2022-05-20T... * trajectory (trajectory) Size: 2kB array([[341742.46508359, 341746.15575471, 341750.41008676, 341754.66443019, 341758.918785 , 341763.17315118, 341767.42752874, 341771.68191768, 341775.93631799, 341780.19072968, 341784.44515275, 341788.69958719, 341792.95403301, 341797.2084902 , 341801.46295877, 341805.71743872, 341809.97193004, 341814.22643274, 341818.48094681, 341822.73547226, 341826.99000909, 341831.24455729, 341835.49911687, 341839.75368782, 341844.00827015, 341848.26286386, 341852.51746894, 341856.7720854 , 341861.02671323, 341865.28135244, 341869.53600302, 341873.79066498, 341878.04533832, 341882.30002303, 341886.55471912, 341890.80942658, 341895.06414542, 341899.31887563, 341903.57361722, 341907.82837019, 341912.08313453, 341916.33791024, 341920.59269733, 341924.8474958 , 341929.10230564, 341933.35712686, 341937.61195945, 341941.86680341, 341946.12165876, 341950.37652547, 341954.63140356, 341958.88629303, 341963.14119387, 341967.39610609, 341971.65102968, 341975.90596465, 341980.16091099, 341984.41586871, 341988.6708378 , 341992.92581827, ... 342558.93956979, 342563.19607422, 342567.45259002, 342571.70911719, 342575.96565573, 342580.22220565, 342584.47876693, 342588.73533959, 342592.99192361, 342597.24851901, 342601.50512578, 342605.76174392, 342610.01837342, 342614.2750143 , 342618.53166655, 342622.78833017, 342627.04500516, 342631.30169152, 342635.55838926, 342639.81509836, 342644.07181883, 342648.32855067, 342652.58529389, 342656.84204847, 342661.09881442, 342665.35559175, 342669.61238044, 342673.8691805 , 342678.12599194, 342682.38281474, 342686.63964892, 342690.89649446, 342695.15335138, 342699.41021966, 342703.66709931, 342707.92399034, 342712.18089273, 342716.4378065 , 342720.69473163, 342724.95166813, 342729.20861601, 342733.46557525, 342744.01671286, 346362.97897869, 345859.93639209, 345775.25735014, 346050.7958609 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 , 346071.2964588 ]]) Coordinates: * time (time) datetime64[us] 2kB 2022-05-10T13:00:00 ... 2022-05-20T... * trajectory (trajectory) Size: 1kB [251 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 `_