Skip to content

Make xgcm a dependency and remove vendored code - #2220

Merged
VeckoTheGecko merged 4 commits into
Parcels-code:v4-devfrom
VeckoTheGecko:2193-xgcm
Sep 16, 2025
Merged

Make xgcm a dependency and remove vendored code#2220
VeckoTheGecko merged 4 commits into
Parcels-code:v4-devfrom
VeckoTheGecko:2193-xgcm

Conversation

@VeckoTheGecko

Copy link
Copy Markdown
Contributor

Fixes#2193

Now we're not vendoring anymore, reducing reliance on private API
- Axis._ds no longer exists
- Saving `parcels.XGrid._ds` as an attribute
- Pass dataset to Grid (not dataarray)
- Set `autoparse_metadata` to where coords are provided

@erikvansebilleerikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good that we can use xgcm as a dependency now!

Comment threadparcels/xgrid.py
assert_valid_lat_lon(ds["lat"], ds["lon"], grid.axes)

assert_valid_mesh(mesh)
self._ds = ds

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbusecke do you feel accessing xgcm.Grid._ds would be bad practice? Its private API (not asking you to make it public), but also passing the original dataset alongside in the initialiser seems a bit verbose. We need access to the dataset for grid searching.

Also, I assume you aren't making modifications to the dataset under the hood in xgcm?

Happy to discuss face to face during our catchup :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLDR; Yes, I think its fine as far as I can recall.

@VeckoTheGecko
VeckoTheGecko merged commit 6b267ed into Parcels-code:v4-devSep 16, 2025
9 checks passed
@github-project-automationgithub-project-automationBot moved this from Backlog to Done in Parcels developmentSep 16, 2025
@VeckoTheGecko
VeckoTheGecko deleted the 2193-xgcm branch October 7, 2025 11:03
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Make xgcm a dependency and remove vendored code

3 participants

@VeckoTheGecko@jbusecke@erikvansebille