diff --git a/spectral_cube/spectral_cube.py b/spectral_cube/spectral_cube.py index a11c0dc6..29ecb856 100644 --- a/spectral_cube/spectral_cube.py +++ b/spectral_cube/spectral_cube.py @@ -1060,7 +1060,7 @@ def apply_function(self, function, axis=None, weights=None, unit=None, # check dtype first (for argmax/argmin) result = function(np.arange(3, dtype=self._data.dtype), **kwargs) if 'int' in str(result.dtype): - out = np.zeros([nz, nx, ny], dtype=dtype) + out = np.zeros([nz, nx, ny], dtype=result.dtype) else: out = np.empty([nz, nx, ny]) * np.nan