Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ffe0ebf
Update .gitignore
VeckoTheGecko Apr 17, 2026
9ebb653
Disable zarr writing
VeckoTheGecko Apr 17, 2026
0218c28
Fix parquet writing
VeckoTheGecko Apr 17, 2026
4e7de3e
Remove test_vriable_write_double
VeckoTheGecko Apr 17, 2026
bc653f1
Fix all "uses_old_zarr" tests
VeckoTheGecko Apr 17, 2026
5daec3b
Remove test_variable_write_double
VeckoTheGecko Apr 17, 2026
2a07ced
Fixing tests
VeckoTheGecko Apr 17, 2026
b8c5477
More test fixing
VeckoTheGecko Apr 20, 2026
2d438c5
Fix last tests
VeckoTheGecko Apr 20, 2026
32a82fa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 20, 2026
19fbd8d
Remove old fixtures
VeckoTheGecko Apr 20, 2026
e74672f
Fix pre-commit errors
VeckoTheGecko Apr 20, 2026
db9f983
Cleanup
VeckoTheGecko Apr 20, 2026
ac2a830
Add pandas and pyarrow as explicit dependencies
VeckoTheGecko Apr 20, 2026
de464e5
Add assert_cftime_like_particlefile
VeckoTheGecko Apr 22, 2026
57ccf6f
MAINT: Cleanup create_particle_data
VeckoTheGecko Apr 20, 2026
b2bde50
Add cftime metadata serialization
VeckoTheGecko Apr 22, 2026
55493a9
Add np.timedelta64 support
VeckoTheGecko Apr 22, 2026
bab4d5d
Fix assert_cftime_like_particlefile
VeckoTheGecko Apr 22, 2026
b28665c
Move imports
VeckoTheGecko Apr 22, 2026
7184e1f
Fixing tests
VeckoTheGecko Apr 22, 2026
e7e37ef
Fix test_time_is_age test
VeckoTheGecko Apr 22, 2026
54c829a
Refactor assert_cftime_like_particlefile
VeckoTheGecko Apr 23, 2026
8626d48
Self-review feedback
VeckoTheGecko Apr 23, 2026
3693329
Fix test_particle_schema
VeckoTheGecko Apr 23, 2026
81f127b
Make read_particlefile public
VeckoTheGecko Apr 23, 2026
9fcb5bf
Add docstring to read_particlefile
VeckoTheGecko Apr 23, 2026
04d8676
Review feedback
VeckoTheGecko Apr 24, 2026
b4e2214
Remove obs_written
VeckoTheGecko Apr 24, 2026
663f80c
Update migration guide
VeckoTheGecko Apr 24, 2026
5be22aa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 24, 2026
002b8f2
Revert from extra_metadata to metadata
VeckoTheGecko Apr 24, 2026
3c52647
Fix test_pfile_array_remove_particles
VeckoTheGecko Apr 24, 2026
39ab122
Merge branch 'main' into push-zlxyoyvlpoqm
VeckoTheGecko Apr 24, 2026
ae375b3
Fix numpy warning
VeckoTheGecko Apr 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/ci/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ requirements:
- numpy >=2.1.0
- tqdm >=4.50.0
- xarray >=2025.8.0,<2026.4.0 # TODO: remove upper pin when https://github.com/UXARRAY/uxarray/issues/1490 is resolved
- pandas >=2.2
- pyarrow >=20.0.0
- cf_xarray >=0.8.6
- xgcm >=0.9.0
- zarr >=2.15.0,!=2.18.0,<3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ out-*
*.pyc
**/*.zarr/*
.DS_Store
*.parquet

.vscode
.env
Expand Down
4 changes: 3 additions & 1 deletion docs/user_guide/v4-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ Version 4 of Parcels is unreleased at the moment. The information in this migrat
## ParticleFile

- Particlefiles should be created by `ParticleFile(...)` instead of `pset.ParticleFile(...)`
- The `name` argument in `ParticleFile` has been replaced by `store` and can now be a string, a Path or a zarr store.
- `ParticleFile` output is now in Parquet format
- `ParticleFile` writing behaviour now errors out if there's existing output (this be being further discussed in https://github.com/Parcels-code/Parcels/issues/2593 )
- A utility to read in ParticleFile output is now available. `parcels.read_particlefile()`

## Field

Expand Down
4 changes: 4 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ netcdf4 = ">=1.6.0"
numpy = ">=2.1.0"
tqdm = ">=4.50.0"
xarray = ">=2024.5.0,<2026.4.0" # TODO: remove upper pin when https://github.com/UXARRAY/uxarray/issues/1490 is resolved
pandas = ">=2.2"
pyarrow = ">=20.0.0"
holoviews = ">=1.22.0" # https://github.com/prefix-dev/rattler-build/issues/2326
uxarray = ">=2025.3.0"
dask = ">=2024.5.1"
Expand Down Expand Up @@ -51,6 +53,8 @@ netcdf4 = "1.6.*"
numpy = "2.1.*"
tqdm = "4.50.*"
xarray = "2025.8.*"
pandas = "2.2.*"
pyarrow = "20.0.*"
uxarray = "2025.3.*"
dask = "2024.6.*"
zarr = "2.18.*"
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ dependencies = [
"zarr >=2.15.0,!=2.18.0,<3",
"tqdm >=4.50.0",
"xarray >=2024.5.0,<2026.4.0", # TODO: remove upper pin when https://github.com/UXARRAY/uxarray/issues/1490 is resolved
"pandas >= 2.2",
"pyarrow >=20.0.0",
"uxarray >=2025.3.0",
"pooch >=1.8.0",
"xgcm >=0.9.0",
Expand Down
3 changes: 2 additions & 1 deletion src/parcels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from parcels._core.fieldset import FieldSet
from parcels._core.particleset import ParticleSet
from parcels._core.particlefile import ParticleFile
from parcels._core.particlefile import ParticleFile, read_particlefile
from parcels._core.particle import (
Variable,
Particle,
Expand Down Expand Up @@ -67,6 +67,7 @@
"ParticleSetWarning",
# Utilities
"logger",
"read_particlefile",
]

_stdlib_warnings.warn(
Expand Down
26 changes: 10 additions & 16 deletions src/parcels/_core/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from parcels._compat import _attrgetter_helper
from parcels._core.statuscodes import StatusCode
from parcels._core.utils.string import _assert_str_and_python_varname
from parcels._core.utils.time import TimeInterval
from parcels._reprs import particleclass_repr, variable_repr

__all__ = ["Particle", "ParticleClass", "Variable"]
Expand Down Expand Up @@ -149,7 +148,11 @@ def get_default_particle(spatial_dtype: type[np.float32] | type[np.float64]) ->
Variable(
"time",
dtype=np.float64,
attrs={"standard_name": "time", "units": "seconds", "axis": "T"},
attrs={
"standard_name": "time",
"units": "seconds",
"axis": "T",
}, # "units" and "calendar" gets updated/set if working with cftime time domain
),
Variable(
"trajectory",
Expand All @@ -160,7 +163,6 @@ def get_default_particle(spatial_dtype: type[np.float32] | type[np.float64]) ->
"cf_role": "trajectory_id",
},
),
Variable("obs_written", dtype=np.int32, initial=0, to_write=False),
Variable("dt", dtype=np.float64, initial=1.0, to_write=False),
Variable("state", dtype=np.int32, initial=StatusCode.Evaluate, to_write=False),
]
Expand All @@ -176,7 +178,6 @@ def create_particle_data(
pclass: ParticleClass,
nparticles: int,
ngrids: int,
time_interval: TimeInterval,
initial: dict[str, np.ndarray] | None = None,
):
if initial is None:
Expand Down Expand Up @@ -207,16 +208,9 @@ def create_particle_data(
name_to_copy = var.initial(_attrgetter_helper)
data[var.name] = data[name_to_copy].copy()
else:
data[var.name] = _create_array_for_variable(var, nparticles, time_interval)
data[var.name] = np.full(
shape=(nparticles,),
fill_value=var.initial,
dtype=var.dtype,
)
return data


def _create_array_for_variable(variable: Variable, nparticles: int, time_interval: TimeInterval):
assert not isinstance(variable.initial, operator.attrgetter), (
"This function cannot handle attrgetter initial values."
)
return np.full(
shape=(nparticles,),
fill_value=variable.initial,
dtype=variable.dtype,
)
Loading
Loading