Skip to content

Commit

Permalink
linexpression: drop squeeze argument in groupby
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianHofmann committed Aug 7, 2024
1 parent 9249ef1 commit 0163d2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 1 addition & 6 deletions linopy/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,6 @@ def diff(self, dim: str, n: int = 1) -> LinearExpression:
def groupby(
self,
group: DataFrame | Series | DataArray,
squeeze: bool = True,
restore_coord_dims: bool | None = None,
**kwargs,
) -> LinearExpressionGroupby:
Expand All @@ -1227,10 +1226,6 @@ def groupby(
group : str, DataArray or IndexVariable
Array whose unique values should be used to group this array. If a
string, must be the name of a variable contained in this dataset.
squeeze : bool, optional
If "group" is a dimension of any arrays in this dataset, `squeeze`
controls whether the subarrays have a dimension of length 1 along
that dimension or if the dimension is squeezed out.
restore_coord_dims : bool, optional
If True, also restore the dimension order of multi-dimensional
coordinates.
Expand All @@ -1242,7 +1237,7 @@ def groupby(
the correct return type.
"""
ds = self.data
kwargs = dict(squeeze=squeeze, restore_coord_dims=restore_coord_dims, **kwargs)
kwargs = dict(restore_coord_dims=restore_coord_dims, **kwargs)
return LinearExpressionGroupby(ds, group, model=self.model, kwargs=kwargs)

def rolling(
Expand Down
7 changes: 1 addition & 6 deletions linopy/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ def dot(self, other: ndarray | Variable) -> QuadraticExpression | LinearExpressi
def groupby(
self,
group: DataArray,
squeeze: bool = True,
restore_coord_dims: bool | None = None,
) -> LinearExpressionGroupby:
"""
Expand All @@ -530,10 +529,6 @@ def groupby(
group : str, DataArray or IndexVariable
Array whose unique values should be used to group this array. If a
string, must be the name of a variable contained in this dataset.
squeeze : bool, optional
If "group" is a dimension of any arrays in this dataset, `squeeze`
controls whether the subarrays have a dimension of length 1 along
that dimension or if the dimension is squeezed out.
restore_coord_dims : bool, optional
If True, also restore the dimension order of multi-dimensional
coordinates.
Expand All @@ -545,7 +540,7 @@ def groupby(
the correct return type.
"""
return self.to_linexpr().groupby(
group=group, squeeze=squeeze, restore_coord_dims=restore_coord_dims
group=group, restore_coord_dims=restore_coord_dims
)

def rolling(
Expand Down

0 comments on commit 0163d2c

Please sign in to comment.