diff --git a/src/ndv/controllers/_array_viewer.py b/src/ndv/controllers/_array_viewer.py index 4603d541..e39b407e 100644 --- a/src/ndv/controllers/_array_viewer.py +++ b/src/ndv/controllers/_array_viewer.py @@ -667,7 +667,7 @@ def _on_data_response_ready(self, future: Future[DataResponse]) -> None: try: response = future.result() except Exception as e: - warnings.warn(f"Error fetching data: {e}", stacklevel=2) + warnings.warn(f"Error fetching data: {e}", stacklevel=1) return for key, data in response.data.items(): diff --git a/src/ndv/models/_resolve.py b/src/ndv/models/_resolve.py index 22b0edc7..d0841004 100644 --- a/src/ndv/models/_resolve.py +++ b/src/ndv/models/_resolve.py @@ -353,8 +353,10 @@ def process_request(req: DataRequest) -> DataResponse: the dimensionality contract on the returned arrays. """ data = req.wrapper.isel(req.index) - vis_ax = req.visible_axes + if data.size == 0: + return DataResponse(n_visible_axes=len(vis_ax), data={}, request=req) + t_dims = vis_ax + tuple(i for i in range(data.ndim) if i not in vis_ax) vis_shape = tuple(data.shape[ax] for ax in vis_ax)