Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add geometry encoding and decoding functions. #517

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Conversation

dcherian
Copy link
Contributor

These differ from shapely_to_cf and cf_to_shapely by returning all variables. Those function, simply encode and decode geometry-related variables.

cc @jsignell

xref xarray-contrib/xvec#26

Comment on lines +93 to +94
Only a single geometry variable is supported at present. Contributions to fix this
are welcome.
Copy link
Member

Choose a reason for hiding this comment

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

I think that is actually a limitation of CF conventions, no? I have a vague memory that it supports at max one geometry variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each variable is only linked to one geometry variable through the geometry attribute. But I can't see why you can't have multiple geometry variables.

@dcherian dcherian force-pushed the encode-decode-geometry branch 7 times, most recently from 2f73f3c to 745aee2 Compare June 25, 2024 02:29
These differ from `shapely_to_cf` and `cf_to_shapely` by returning
all variables. Those function, simply encode and decode geometry-related
variables.
1. Associate geometry vars as coordinates when we can
2. Add `cf.geometries`
3. Geometries in repr
4. Allow indexing by `"geometry"` or any geometry type.
@dcherian dcherian merged commit c511cc5 into main Jun 25, 2024
10 checks passed
@dcherian dcherian deleted the encode-decode-geometry branch June 25, 2024 02:53
martinfleis pushed a commit to xarray-contrib/xvec that referenced this pull request Jun 25, 2024
* Document read/write with CF encoding

Needs xarray-contrib/cf-xarray#517

* rerun
dcherian added a commit that referenced this pull request Jul 24, 2024
* main: (35 commits)
  Add release.yml
  Allow encoding/decoding multiple geometries (#526)
  Rewrite unit formatter for pint 0.24 and earlier (#523)
  [pre-commit.ci] pre-commit autoupdate (#527)
  Add grid_mapping for geometries if possible (#521)
  Bump pypa/gh-action-pypi-publish from 1.8.14 to 1.9.0 (#524)
  Bump codecov/codecov-action from 4.4.1 to 4.5.0 (#525)
  Add geometry encoding and decoding functions. (#517)
  Bump links to CF-1.11 (#519)
  Docs cleanup (#518)
  Bump codecov/codecov-action from 4.3.0 to 4.4.1 (#514)
  [pre-commit.ci] pre-commit autoupdate (#510)
  Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 (#509)
  Add docs about converting between shapely and cf (#512)
  Bump codecov/codecov-action from 4.1.0 to 4.3.0 (#511)
  Fix scheduled nightly upstream test
  Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12 (#503)
  Bump codecov/codecov-action from 4.0.0 to 4.1.0 (#504)
  numpy 2 compat (#505)
  ruff settings: move 'ignore' to 'lint' section (#506)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants