You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have come across a case where linopy does not adhere to the naming of xarray and this problem can only be solved with an unnecessary type check. Here is a short linear equation that should work with both pure xarray instances and a xarray/linopy mix.
For this let $$func(A,x,\tilde x) = A^T(x-\tilde x) = A^Tx - A^T\tilde x = u$$
where
$A \in \mathbb{R}^n \times \mathbb{R}^m$ is some (xarray) data matrix
$\tilde x \in \mathbb{R}^n$ is a (xarray) data array
$x \in \mathbb{R}^n$ is EITHER a (linopy) variable OR a (xarray) data array
$u \in \mathbb{R}^m$ is the result.
The following minimal example shows that a type check must be made in the implementation of $func$. The reason for this is only the different naming of dim and dims:
In my opinion the dimskeyword should be renamed to dim. Of course this is a breaking change, but with a DeprecationWarning in the long and an alias in the short run this should be no problem.
I'm happy to submit a PR if this is something worth doing.
The text was updated successfully, but these errors were encountered:
@leuchtum thank you for your issue. You are totally right, I and cannot remember why I did not named the keyword consistently with xarray... :(
I would be very happy about a PR!
I have come across a case where linopy does not adhere to the naming of xarray and this problem can only be solved with an unnecessary type check. Here is a short linear equation that should work with both pure xarray instances and a xarray/linopy mix.
For this let$$func(A,x,\tilde x) = A^T(x-\tilde x) = A^Tx - A^T\tilde x = u$$
where
The following minimal example shows that a type check must be made in the implementation of$func$ . The reason for this is only the different naming of
dim
anddims
:with the expected output
In my opinion the
dims
keyword should be renamed todim
. Of course this is a breaking change, but with aDeprecationWarning
in the long and an alias in the short run this should be no problem.I'm happy to submit a PR if this is something worth doing.
The text was updated successfully, but these errors were encountered: