We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug Trying to fit a model to DataArray without coordiantes fails.
Reproducible Minimal Working Example
import numpy as np import xarray as xr X = np.random.normal(100, 10) X = xr.DataArray(Xtrain, dims=("time", "space")) eof = xeofs.models.EOF(10) eof.fit(X, dim="time")
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[28], [line 9](vscode-notebook-cell:?execution_count=28&line=9) [7](vscode-notebook-cell:?execution_count=28&line=7) X = xr.DataArray(Xtrain, dims=("time", "space")) [8](vscode-notebook-cell:?execution_count=28&line=8) eof = xeofs.models.EOF(10) ----> [9](vscode-notebook-cell:?execution_count=28&line=9) eof.fit(X, dim="time") File [~/Projects/xeofs/xeofs/models/_base_model.py:186](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:186), in _BaseModel.fit(self, X, dim, weights) [183](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:183) self.sample_dims = convert_to_dim_type(dim) [185](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:185) # Preprocess the data & transform to 2D --> [186](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:186) data2D: DataArray = self.preprocessor.fit_transform( [187](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:187) X, self.sample_dims, weights [188](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:188) ) [190](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:190) self._fit_algorithm(data2D) [192](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/Projects/xeofs/xeofs/models/_base_model.py:192) if self._params["compute"]: File [~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:157](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:157), in _wrap_method_output.<locals>.wrapped(self, X, *args, **kwargs) [155](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:155) @wraps(f) [156](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:156) def wrapped(self, X, *args, **kwargs): --> [157](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:157) data_to_wrap = f(self, X, *args, **kwargs) [158](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:158) if isinstance(data_to_wrap, tuple): [159](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:159) # only wrap the first output for cross decomposition [160](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:160) return_tuple = ( [161](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:161) _wrap_data_with_container(method, data_to_wrap[0], X, self), [162](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/sklearn/utils/_set_output.py:162) *data_to_wrap[1:], ... File [~/miniconda3/envs/xeofs/lib/python3.11/site-packages/xarray/core/indexes.py:1655](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/xarray/core/indexes.py:1655), in Indexes.__getitem__(self, key) [1654](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/xarray/core/indexes.py:1654) def __getitem__(self, key) -> T_PandasOrXarrayIndex: -> [1655](https://file+.vscode-resource.vscode-cdn.net/home/nrieger/Projects/xeofs/~/miniconda3/envs/xeofs/lib/python3.11/site-packages/xarray/core/indexes.py:1655) return self._indexes[key] KeyError: 'dim0'
Expected behavior The model fits :)
Desktop (please complete the following information):
xeofs
Additional context -NA-
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Trying to fit a model to DataArray without coordiantes fails.
Reproducible Minimal Working Example
Expected behavior
The model fits :)
Desktop (please complete the following information):
xeofs
version 2.2.4Additional context
-NA-
The text was updated successfully, but these errors were encountered: