Skip to content
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
13 changes: 13 additions & 0 deletions tests/test_20_open_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ def test_open_dataset(tmp_path: Path, index_node: str, download: bool) -> None:
)
assert (esgpull_path / "data" / "CMIP6").exists() is download

# Dims
assert ds.sizes == {
"experiment_id": 2,
"time": 24,
"bnds": 2,
"lat": 256,
"lon": 512,
}

# Coords
assert set(ds.coords) == {
"experiment_id",
"height",
Expand All @@ -47,7 +50,17 @@ def test_open_dataset(tmp_path: Path, index_node: str, download: bool) -> None:
"time",
"time_bnds",
}
assert set(ds[["lat_bnds", "lon_bnds", "time_bnds"]].dims) == {
"bnds",
"lat",
"lon",
"time",
}

# Data vars
assert set(ds.data_vars) == {"tas", "pr"}

# Attributes
assert ds.dataset_ids == [
"CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3-CC.ssp245.r1i1p1f1.Amon.pr.gr.v20210113",
"CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3-CC.ssp245.r1i1p1f1.Amon.tas.gr.v20210113",
Expand Down
2 changes: 1 addition & 1 deletion xarray_esgf/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ def open_dataset(
compat="override",
combine_attrs="drop_conflicts",
)
ds = ds.expand_dims({dim: [dataset_id_dict[dim]] for dim in concat_dims})
ds = ds.set_coords([
name for name, da in ds.variables.items() if "bnds" in da.dims
])
ds = ds.expand_dims({dim: [dataset_id_dict[dim]] for dim in concat_dims})
combined_datasets[dataset_id] = ds

check_dimensions(combined_datasets)
Expand Down