id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 509285415,MDU6SXNzdWU1MDkyODU0MTU=,3416,Cannot write array larger than 4GB with SciPy netCDF backend,56707780,closed,0,,,6,2019-10-18T20:06:29Z,2019-10-21T08:53:25Z,2019-10-21T08:53:25Z,NONE,,,,"#### MCVE Code Sample ```python # Your code here import numpy as np import xarray as xr random_vals = np.random.randint(0, 10, 180*1024*1024*5) test_array = random_vals.reshape((180, 1024, 1024, 5)) test_xr = xr.DataArray(test_array, coords=[range(test_array.shape[0]), range(test_array.shape[1]), range(test_array.shape[2]), range(test_array.shape[3])], dims=[""Image"", ""Rows"", ""Cols"", ""Channels""]) test_xr.to_netcdf(""test_xr.nc"", format=""NETCDF3_64BIT"") ``` #### Expected Output This should either give an error that the requested array is too big to save, or should successfully save it. #### Problem Description However, what instead happens is a long a stack trace that gives an OS error , which is confusing to debug. Reducing the dimensionality of the above data by a factor of 10 removes this error, demonstrating that it is a size issue. Traceback (most recent call last): File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/IPython/core/interactiveshell.py"", line 3326, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File """", line 1, in test_xr.to_netcdf(""test_xr.nc"", format=""NETCDF3_64BIT"") File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/xarray/core/dataarray.py"", line 1791, in to_netcdf return dataset.to_netcdf(*args, **kwargs) File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/xarray/core/dataset.py"", line 1323, in to_netcdf compute=compute) File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/xarray/backends/api.py"", line 822, in to_netcdf store.close() File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/xarray/backends/scipy_.py"", line 226, in close self._manager.close() File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/xarray/backends/file_manager.py"", line 188, in close file.close() File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/scipy/io/netcdf.py"", line 299, in close self.flush() File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/scipy/io/netcdf.py"", line 409, in flush self._write() File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/scipy/io/netcdf.py"", line 421, in _write self._write_var_array() File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/scipy/io/netcdf.py"", line 477, in _write_var_array self._write_var_data(name) File ""/Users/noahgreenwald/Documents/Grad_School/Lab/Segmentation_Project/code/segmentation/env/lib/python3.6/site-packages/scipy/io/netcdf.py"", line 525, in _write_var_data self.fp.write(var.data.tostring()) OSError: [Errno 22] Invalid argument #### Output of ``xr.show_versions()``
# Paste the output here xr.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] python-bits: 64 OS: Darwin OS-release: 18.7.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: en_US.UTF-8 libhdf5: None libnetcdf: None xarray: 0.12.1 pandas: 0.24.2 numpy: 1.16.3 scipy: 1.2.1 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudonetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 2.2.2 cartopy: None seaborn: None setuptools: 39.0.1 pip: 9.0.3 conda: None pytest: None IPython: 7.8.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3416/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue