html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/2064#issuecomment-452337937,https://api.github.com/repos/pydata/xarray/issues/2064,452337937,MDEyOklzc3VlQ29tbWVudDQ1MjMzNzkzNw==,8441217,2019-01-08T15:25:27Z,2019-01-08T15:25:27Z,CONTRIBUTOR,"The comment from henrica above gives a solution to @xylar 's issue. Here is the original example where I added : data_vars='minimal'.

```python
#!/usr/bin/env python3
import xarray
ds = xarray.open_mfdataset('example_jan.nc', concat_dim='Time', data_vars='minimal')
print(ds)
```

```
Dimensions:                                                      (Time: 1, nOceanRegions: 7, nOceanRegionsTmp: 7, nVertLevels: 100)
Dimensions without coordinates: Time, nOceanRegions, nOceanRegionsTmp, nVertLevels
Data variables:
    refBottomDepth                                               (nVertLevels) float64 dask.array<shape=(100,), chunksize=(100,)>
    time_avg_avgValueWithinOceanLayerRegion_avgLayerTemperature  (Time, nOceanRegionsTmp, nVertLevels) float64 dask.array<shape=(1, 7, 100), chunksize=(1, 7, 100)>
    time_avg_avgValueWithinOceanRegion_avgSurfaceTemperature     (Time, nOceanRegions) float64 dask.array<shape=(1, 7), chunksize=(1, 7)>
    time_avg_daysSinceStartOfSim                                 (Time) timedelta64[ns] dask.array<shape=(1,), chunksize=(1,)>
    xtime_end                                                    (Time) |S64 dask.array<shape=(1,), chunksize=(1,)>
    xtime_start                                                  (Time) |S64 dask.array<shape=(1,), chunksize=(1,)>
Attributes:
    history:  Tue Dec  6 04:49:14 2016: ncatted -O -a ,global,d,, acme_alaph7...
    NCO:      ""4.6.2""
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,314764258
https://github.com/pydata/xarray/issues/1849#issuecomment-369543072,https://api.github.com/repos/pydata/xarray/issues/1849,369543072,MDEyOklzc3VlQ29tbWVudDM2OTU0MzA3Mg==,8441217,2018-03-01T10:09:40Z,2018-03-01T10:09:40Z,CONTRIBUTOR,"I also ran into this issue : to_netcdf fails for my dataset.

Here is how to reproduce the error : (the testfile is attached here [1.zip](https://github.com/pydata/xarray/files/1770670/1.zip) )

```
import netCDF4                                                                                                                                                                           
import xarray as xr                                                                                                                                                                      
print(netCDF4.__version__)                                                                                                                                                               
print(xr.__version__)                                                                                                                                                                    
ds = xr.open_dataset('testfile')                                                                                                                                                         
ds.to_netcdf('outfile.ok')                                                                                                                                                               
ds.to_netcdf('outfile.not.ok', unlimited_dims=['datetime'])  
```

And the ouput I get : 

> 1.3.1
> 0.10.1
> Traceback (most recent call last):
>   File ""bug.py"", line 6, in <module>
>     ds.to_netcdf('outfile', unlimited_dims=['datetime'])
>   File ""/home/pinaultf/miniconda3/envs/defaultenv/lib/python3.6/site-packages/xarray/core/dataset.py"", line 1133, in to_netcdf
>     unlimited_dims=unlimited_dims)
>   File ""/home/pinaultf/miniconda3/envs/defaultenv/lib/python3.6/site-packages/xarray/backends/api.py"", line 632, in to_netcdf
>     unlimited_dims=unlimited_dims)
>   File ""/home/pinaultf/miniconda3/envs/defaultenv/lib/python3.6/site-packages/xarray/core/dataset.py"", line 1070, in dump_to_store
>     unlimited_dims=unlimited_dims)
>   File ""/home/pinaultf/miniconda3/envs/defaultenv/lib/python3.6/site-packages/xarray/backends/common.py"", line 280, in store
>     unlimited_dims=unlimited_dims)
>   File ""/home/pinaultf/miniconda3/envs/defaultenv/lib/python3.6/site-packages/xarray/backends/netCDF4_.py"", line 348, in set_variables
>     super(NetCDF4DataStore, self).set_variables(*args, **kwargs)
>   File ""/home/pinaultf/miniconda3/envs/defaultenv/lib/python3.6/site-packages/xarray/backends/common.py"", line 317, in set_variables
>     name, v, check, unlimited_dims=unlimited_dims)
>   File ""/home/pinaultf/miniconda3/envs/defaultenv/lib/python3.6/site-packages/xarray/backends/netCDF4_.py"", line 393, in prepare_variable
>     fill_value=fill_value)
>   File ""netCDF4/_netCDF4.pyx"", line 2437, in netCDF4._netCDF4.Dataset.createVariable
>   File ""netCDF4/_netCDF4.pyx"", line 3439, in netCDF4._netCDF4.Variable.__init__
>   File ""netCDF4/_netCDF4.pyx"", line 1638, in netCDF4._netCDF4._ensure_nc_success
> RuntimeError: NetCDF: Invalid argument
> 


","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,290572700
https://github.com/pydata/xarray/pull/1918#issuecomment-366658572,https://api.github.com/repos/pydata/xarray/issues/1918,366658572,MDEyOklzc3VlQ29tbWVudDM2NjY1ODU3Mg==,8441217,2018-02-19T11:11:55Z,2018-02-19T11:11:55Z,CONTRIBUTOR,Here it is. Thanks for your code reviews and your helpful comments !,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,297793359
https://github.com/pydata/xarray/issues/1487#issuecomment-366242783,https://api.github.com/repos/pydata/xarray/issues/1487,366242783,MDEyOklzc3VlQ29tbWVudDM2NjI0Mjc4Mw==,8441217,2018-02-16T14:01:20Z,2018-02-16T14:01:20Z,CONTRIBUTOR,"Yes, @shoyer is right : Looking at the numpy code, this array.squeeze(axis) -> array.squeeze() is happening. 
```
1256     try:                                                                                                                                                                                                                                 
1257         # First try to use the new axis= parameter                                                                                                                                                                                       
1258         return squeeze(axis=axis)                                                                                                                                                                                                        
1259     except TypeError:                                                                                                                                                                                                                    
1260         # For backwards compatibility                                                                                                                                                                                                    
1261         return squeeze()    
```

I added the `axis` parameter in xarray and this fixed the problem.


```
PYTHONPATH=$HOME/sandbox/dev/xarray python -c 'import numpy as np ; import xarray as xr ; test = np.random.random((1,10,1)) ; print(np.squeeze(test, axis=0).shape); print(np.squeeze(xr.DataArray(test), axis=0).shape, np.__version__, xr.__version__) '
(10, 1)
(10, 1)      1.13.1     0.10.0+dev64.gd554ece

```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,245468219