Skip to content

Commit

Permalink
Unpin xarray
Browse files Browse the repository at this point in the history
Set dimensions order on conversion to dataframe.
  • Loading branch information
larsevj committed May 21, 2024
1 parent 9ecf5d2 commit 398bae8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dependencies=[
"tqdm>=4.62.0",
"uvicorn >= 0.17.0",
"websockets",
"xarray<2024.5.0",
"xarray",
"xtgeo >= 3.3.0",
]

Expand Down
6 changes: 4 additions & 2 deletions src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def _load_dataset(
]
else:
datasets = [self._load_single_dataset(group, i) for i in realizations]
return xr.combine_nested(datasets, "realizations")
return xr.combine_nested(datasets, concat_dim="realizations")

def load_parameters(
self, group: str, realizations: Union[int, npt.NDArray[np.int_], None] = None
Expand Down Expand Up @@ -637,7 +637,9 @@ def load_all_summary_data(
summary_keys = self.get_summary_keyset()

try:
df = self.load_responses("summary", tuple(realizations)).to_dataframe()
df = self.load_responses("summary", tuple(realizations)).to_dataframe(
dim_order=["time", "name", "realization"]
)
except (ValueError, KeyError):
return pd.DataFrame()

Expand Down
4 changes: 3 additions & 1 deletion tests/integration_tests/test_storage_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ def test_that_storage_matches(
tuple(ensemble.get_realization_list_with_responses("summary")),
)
snapshot.assert_match(
summary_data.to_dataframe().transform(np.sort).to_csv(),
summary_data.to_dataframe(dim_order=["time", "name", "realization"])
.transform(np.sort)
.to_csv(),
"summary_data",
)
snapshot.assert_match_dir(
Expand Down

0 comments on commit 398bae8

Please sign in to comment.