We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5dad00 commit 940c775Copy full SHA for 940c775
xarray/coding/variables.py
@@ -245,7 +245,7 @@ def _choose_float_dtype(
245
maxsize = max(maxsize, np.dtype(type(scale_factor)).itemsize)
246
if add_offset and np.issubdtype(type(add_offset), np.floating):
247
maxsize = max(maxsize, np.dtype(type(add_offset)).itemsize)
248
- return np.dtype(f"float{maxsize * 8}")
+ return np.float32 if maxsize == 4 else np.float64
249
# Keep float32 as-is. Upcast half-precision to single-precision,
250
# because float16 is "intended for storage but not computation"
251
if dtype.itemsize <= 4 and np.issubdtype(dtype, np.floating):
0 commit comments