diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2e97ae1..3b44298 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ^^^^^^^ @@ -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: diff --git a/src/xdatasets/spatial.py b/src/xdatasets/spatial.py index 12cacd3..986c83b 100644 --- a/src/xdatasets/spatial.py +++ b/src/xdatasets/spatial.py @@ -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")