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

Bugfix for unique_id in clip_polygon #143

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Changelog
v0.3.7 (unreleased)
-------------------

Contributors: Trevor James Smith (:user:`Zeitsperre`)
Contributors: Trevor James Smith (:user:`Zeitsperre`), Gabriel Rondeau-Genesse (:user:`RondeauG`)

Changes
^^^^^^^
Expand All @@ -23,6 +23,7 @@ Changes
* A new pre-commit hook and linting step for validating numpy docstrings has been added (`numpydoc`).
* All `pip`-based dependencies used to run in CI are now managed by a CI/requirements_ci.txt that uses hashes of packages for security.
* Documentation has been added for ``$ make initialize-translations``.
* Fixed a bug where `clip_polygon` would not work if not given a `unique_id` during a `Query`. (:pull:`143`).

.. _changes_0.3.6:

Expand Down
2 changes: 1 addition & 1 deletion src/xdatasets/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def clip_by_polygon(ds, space, dataset_name):

data = xr.concat(arrays, dim="geom")

if "unique_id" in space:
if space.get("unique_id") is not None:
try:
data = data.swap_dims({"geom": space["unique_id"]})
data = data.drop_vars("geom")
Expand Down