From a9668f6e085a45e3d83f62098ca5e89a27915949 Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 15 Jul 2026 11:18:25 +0200 Subject: [PATCH 1/2] Updated from page of github.io/trajan --- docs/source/index.rst | 18 +++++++++++------- trajan/traj/__init__.py | 3 +++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 75d8a3f..4bf5b8e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -27,15 +27,16 @@ or .. code-block:: console + $ git clone git@github.com:OpenDrift/trajan.git $ cd trajan # move to the location of the trajan root, containing the pyproject.toml file - $ pip install . + $ pip install -e . Remember to re-install each time you have done an edit during the development process. Usage ----- -*TrajAn* is an `Xarry extension `_. On drifter (or trajectory) datasets you can use the `.traj` accessor on `xarray.Dataset `_ s. In order to register the accessor, _trajan_ needs to be imported: +*TrajAn* is an `Xarry extension `_. On drifter (or trajectory) datasets you can use the `.traj` accessor on `xarray.Dataset `_. In order to register the accessor, `trajan` needs to be imported: .. code-block:: python @@ -58,13 +59,13 @@ Generally, TrajAn supports two types of data layout: 1) Ragged: trajectories sampled at different times (unstructured or irregular grid), almost every dataset from real observations. 2) Orthogonal: trajectories sampled at uniform (or regular) grid, typical the output from a model. -For Ragged datasets is time function of trajectory and observation, while for Orthognal datasets time is only a function of observation. +For Ragged datasets time is a 2D array with dimensions for trajectory and observation/time, while for Orthognal datasets time is a 1D array common for all trajectories. -TrajAn will detect which type of dataset you have and you will have access to the appropriate methods for the type data layout. +TrajAn will detect which type of dataset you have and you will have access to the appropriate methods for the type data layout. Contiguous ragged and `nc_particles `_ format ara internally modified to Ragged format. -While the first type (Ragged) is more general it often limits analysis that require trajectories to be sampled at the same points, you can therefor convert a Ragged dataset to Orthogonal by using :meth:`trajan.traj.Ragged.gridtime`. +While the Ragged format is more general it often limits analysis that require trajectories to be sampled at the same points, you can therefor convert a Ragged dataset to Orthogonal by using :meth:`trajan.traj.ragged.Ragged.gridtime`. -Methods applicable to both types of datasets can be found in: :mod:`trajan.traj`, methods for Orthogonal datasets: :mod:`trajan.traj.trajOrthogonal`, and Ragged: :mod:`trajan.traj.trajRagged`. All methods are forwarded to the accessor, so you call the methods on `Dataset.traj`: +Methods applicable to both types of datasets can be found in: :mod:`trajan.traj`, methods for Orthogonal datasets: :mod:`trajan.traj.orthogonal.Orthogonal`, and Ragged: :mod:`trajan.traj.ragged.Ragged`. All methods are forwarded to the accessor, so you call the methods on `ds.traj`: .. code-block:: python @@ -72,7 +73,10 @@ Methods applicable to both types of datasets can be found in: :mod:`trajan.traj` ds.traj.plot() # plot dataset -Generic plotting is available in the standard `Xarray` way, and strives to stay as close to `matplotlib` as possible: (:meth:`trajan.trajectory_accessor.TrajAccessor.plot`) and animation (:meth:`trajan.trajectory_accessor.TrajAccessor.animate`). +Generic plotting is available in the standard `Xarray` way, and strives to stay as close to `matplotlib` as possible: +:meth:`trajan.trajectory_accessor.TrajAccessor.plot` +TrajAn also contains an animation builder mechanism the can be chained: +:meth:`trajan.trajectory_accessor.TrajAccessor.animate` Contents -------- diff --git a/trajan/traj/__init__.py b/trajan/traj/__init__.py index 757db96..6df262f 100644 --- a/trajan/traj/__init__.py +++ b/trajan/traj/__init__.py @@ -23,6 +23,9 @@ from ..plot import Plot from ..animation import Animation +from .ragged import Ragged +from .orthogonal import Orthogonal + if TYPE_CHECKING: from .. import Dataset From a09ee8fa50095228b921bdd5299b844f4b22bacf Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 15 Jul 2026 11:23:37 +0200 Subject: [PATCH 2/2] Avoiding circular import --- trajan/traj/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/trajan/traj/__init__.py b/trajan/traj/__init__.py index 6df262f..1ce6c3d 100644 --- a/trajan/traj/__init__.py +++ b/trajan/traj/__init__.py @@ -23,8 +23,6 @@ from ..plot import Plot from ..animation import Animation -from .ragged import Ragged -from .orthogonal import Orthogonal if TYPE_CHECKING: from .. import Dataset