Skip to content

Commit 9fcb5bf

Browse files
committed
Add docstring to read_particlefile
1 parent 81f127b commit 9fcb5bf

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/parcels/_core/particlefile.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,31 @@ def _get_calendar_and_units(time_interval: TimeInterval) -> dict[str, str]: # T
212212

213213

214214
def read_particlefile(path: PathLike, decode_times: bool = True) -> pd.DataFrame:
215+
"""Read a Parcels particlefile (Parquet format) into a pandas DataFrame.
216+
217+
Parameters
218+
----------
219+
path : PathLike
220+
Path to the ``.parquet`` particlefile.
221+
decode_times : bool, optional
222+
If ``True`` (default), use Xarray to decode the numeric ``time`` column from CF
223+
conventions into ``datetime`` or ``cftime.datetime`` values using the units stored in
224+
the column metadata. If ``False``, the raw numeric values are
225+
returned unchanged.
226+
227+
Returns
228+
-------
229+
pd.DataFrame
230+
DataFrame containing the particle data. When *decode_times* is
231+
``True``, the ``time`` column contains datetime-like values;
232+
otherwise it contains the original numeric representation.
233+
234+
Notes
235+
-----
236+
For larger datasets, consider using `Polars <https://docs.pola.rs/>`_ directly,
237+
e.g. ``polars.read_parquet(path)``, which offers better performance and lower
238+
memory usage than pandas for large Parquet files.
239+
"""
215240
path = Path(path)
216241

217242
assert path.suffix == ".parquet", "Only Parquet files are supported"

0 commit comments

Comments
 (0)