Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b6b5d65
TST: Add xfail test that converters don't modify input W
VeckoTheGecko Oct 13, 2026
b455897
TST: Compare parcels.convert against a frozen legacy copy
VeckoTheGecko Oct 13, 2026
4ccc376
MAINT: Remove dead code and fix stale docs in parcels.convert
VeckoTheGecko Oct 13, 2026
9996cd0
MAINT: Extract shared helpers in parcels.convert
VeckoTheGecko Oct 13, 2026
cd62276
MAINT: Group per-model naming rules in parcels.convert
VeckoTheGecko Oct 13, 2026
c71f63e
BUG: Don't modify the caller's W when converting to SGRID
VeckoTheGecko Oct 13, 2026
a2d84ac
BUG: Detect existing SGRID metadata in all converters
VeckoTheGecko Oct 13, 2026
de2f655
MAINT: Clear global attrs and set Conventions in SGRID converters
VeckoTheGecko Oct 13, 2026
cea6476
MAINT: Use one helper to add a missing depth dimension
VeckoTheGecko Oct 13, 2026
8a20660
DOC: Document Dataset inputs in convert functions, and error clearly
VeckoTheGecko Oct 13, 2026
1ae5e3e
MAINT: Check for existing SGRID metadata in _attach_sgrid_metadata
VeckoTheGecko Oct 13, 2026
96e0a25
Merge branch 'main' into push-spyoxpwzwvqp
VeckoTheGecko Oct 19, 2026
97d9f67
Merge remote-tracking branch 'upstream/main' into push-spyoxpwzwvqp
VeckoTheGecko Oct 22, 2026
2953432
Port mom6_to_sgrid to the refactored parcels.convert
VeckoTheGecko Oct 22, 2026
695f440
TST: Apply CROCO padding fix from #2958 to legacy convert copy
VeckoTheGecko Oct 22, 2026
58b9cc7
Cleanup temp files
VeckoTheGecko Oct 22, 2026
b1b99c0
Merge branch 'main' into push-spyoxpwzwvqp
VeckoTheGecko Oct 23, 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
11 changes: 10 additions & 1 deletion src/parcels/_sgrid/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from textwrap import indent
from typing import IO, Any, Literal, Protocol, Self, cast, overload

import cf_xarray # noqa: F401
import xarray as xr

from parcels._python import repr_from_dunder_dict
Expand Down Expand Up @@ -681,7 +682,15 @@ def _grid3d_to_ascii(grid: SGrid3DMetadata) -> str:


def _attach_sgrid_metadata(ds: xr.Dataset, grid: SGrid2DMetadata | SGrid3DMetadata) -> xr.Dataset:
"""Copies the dataset and attaches the SGRID metadata in 'grid' variable. Modifies 'conventions' attribute."""
"""Copies the dataset and attaches the SGRID metadata in 'grid' variable. Modifies 'conventions' attribute.

Raises a ValueError if the dataset already has SGRID metadata.
"""
if existing := ds.cf.cf_roles.get("grid_topology"):
raise ValueError(
f"Dataset already has SGRID metadata (variables {existing} have cf_role 'grid_topology'), "
"can't attach more."
)
ds = ds.copy()
ds["grid"] = (
[],
Expand Down
Loading
Loading