Skip to content
Closed
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Drop coordinate values associated with the spatial bounds dimension in CMIP6 cleaning (PR #177, @emileten).

## [0.16.1] - 2022-01-27
### Fixed
Expand Down
6 changes: 6 additions & 0 deletions dodola/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,12 @@ def standardize_gcm(ds, leapday_removal=True):
coords_to_drop, drop=True
)

# Some models have coordinates values (e.g. [1.0, 2.0]) for the spatial bounds dimension. We don't need this.
if "bnds" in ds_cleaned.variables:
ds_cleaned = ds_cleaned.drop(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ds_cleaned = ds_cleaned.drop(
ds_cleaned = ds_cleaned.drop_vars(

I think .drop() was lightly deprecated in favor of more specific .drop_vars() or .drop_sel() back in pydata/xarray#3475.

Copy link
Member

Choose a reason for hiding this comment

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

...Interesting because xarray's error message says to use .drop():

ValueError: when setting region explicitly in to_zarr(), all variables in the dataset to write must have at least one dimension in common with the region's dimensions ['time'], but that is not the case for some variables here. To drop these variables from this dataset before exporting to zarr, write: .drop(['bnds'])

Might be worth a PR to xarray updating this message.

["bnds"]
) # this preserves the dimension in itself but drops the coordinates values.

# Cleanup time.

# if variable is precip, need to update units to mm day-1
Expand Down