From b9d5afbdc8569df32e909cb6470b7c6602b5c1ed Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 15 Jul 2026 13:30:00 +0200 Subject: [PATCH 1/3] Updates to github.io docs --- docs/source/api.rst | 8 ++++++++ docs/source/index.rst | 4 ++-- trajan/__init__.pyi | 44 ------------------------------------------- 3 files changed, 10 insertions(+), 46 deletions(-) delete mode 100644 trajan/__init__.pyi diff --git a/docs/source/api.rst b/docs/source/api.rst index f31f514..4b0e8a9 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -73,6 +73,14 @@ Top-level API .. DataArray.cf.__gt__ .. DataArray.cf.isin +Classes +------- +.. autoclass:: trajan.traj.orthogonal.Orthogonal + :members: + :undoc-members: +.. autoclass:: trajan.traj.ragged.Ragged + :members: + :undoc-members: Dataset ------- diff --git a/docs/source/index.rst b/docs/source/index.rst index d6b42f4..490e139 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -74,9 +74,9 @@ Methods applicable to both types of datasets can be found in: :class:`trajan.acc Generic plotting is available in the standard `Xarray` way, and strives to stay as close to `matplotlib` as possible: -:meth:`ds.traj.plot ` +:class:`ds.traj.plot ` TrajAn also contains an animation builder mechanism the can be chained: -:meth:`ds.traj.animate Traj: ... - -def versions() -> str: ... - -def read_csv(f: Any, **kwargs: Any) -> Dataset: ... - -def from_dataframe( - df: pd.DataFrame, - lon: str = ..., - lat: str = ..., - time: str = ..., - name: str | None = ..., - *, - __test_condense__: bool = ..., -) -> Dataset: ... - -def trajectory_dict_to_dataset( - trajectory_dict: dict[str, Any], - variable_attributes: dict[str, Any] | None = ..., - global_attributes: dict[str, Any] | None = ..., -) -> Dataset: ... From a6af1240db3c994e8e90a863744e259b0fb91eb1 Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 15 Jul 2026 13:36:04 +0200 Subject: [PATCH 2/3] Restore stub file --- trajan/__init__.pyi | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 trajan/__init__.pyi diff --git a/trajan/__init__.pyi b/trajan/__init__.pyi new file mode 100644 index 0000000..040b47f --- /dev/null +++ b/trajan/__init__.pyi @@ -0,0 +1,44 @@ +""" +Stub file for trajan public API. + +Declares ``trajan.Dataset`` — a typed alias for ``xr.Dataset`` that exposes +the ``.traj`` accessor. Use it as a type annotation to get LSP completion: + + import trajan + ds: trajan.Dataset = xr.open_dataset("file.nc") + ds.traj.speed() # <- full completion +""" + +import pandas as pd +import xarray as xr +from typing import Any + +from .traj import Traj as Traj +from .traj1d import Traj1d as Traj1d +from .traj2d import Traj2d as Traj2d + +class Dataset(xr.Dataset): + """xarray Dataset with the trajan ``.traj`` accessor typed.""" + + @property + def traj(self) -> Traj: ... + +def versions() -> str: ... + +def read_csv(f: Any, **kwargs: Any) -> Dataset: ... + +def from_dataframe( + df: pd.DataFrame, + lon: str = ..., + lat: str = ..., + time: str = ..., + name: str | None = ..., + *, + __test_condense__: bool = ..., +) -> Dataset: ... + +def trajectory_dict_to_dataset( + trajectory_dict: dict[str, Any], + variable_attributes: dict[str, Any] | None = ..., + global_attributes: dict[str, Any] | None = ..., +) -> Dataset: ... From 402d70f553a54d8448a69b417d740120a9173cbc Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 15 Jul 2026 13:37:58 +0200 Subject: [PATCH 3/3] Updated stub file --- trajan/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trajan/__init__.pyi b/trajan/__init__.pyi index 040b47f..b4d4245 100644 --- a/trajan/__init__.pyi +++ b/trajan/__init__.pyi @@ -14,8 +14,8 @@ import xarray as xr from typing import Any from .traj import Traj as Traj -from .traj1d import Traj1d as Traj1d -from .traj2d import Traj2d as Traj2d +from .traj.orthogonal import Orthogonal +from .traj.ragged import Ragged class Dataset(xr.Dataset): """xarray Dataset with the trajan ``.traj`` accessor typed."""