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/2535#issuecomment-445939304,https://api.github.com/repos/pydata/xarray/issues/2535,445939304,MDEyOklzc3VlQ29tbWVudDQ0NTkzOTMwNA==,10137,2018-12-10T19:23:14Z,2018-12-10T19:23:14Z,NONE,"It seems that this is not a problem with xarray but only with rasterio and netCDF4. Also this fails: ```python import rasterio import netCDF4 with netCDF4.Dataset('test.nc', mode='w') as ds: ds.createDimension('x') ds.createVariable('foo', float, dimensions=('x')) print(ds) ``` Commenting out `import rasterio` removes the HDF error. I’ll report this to rasterio.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,376389539 https://github.com/pydata/xarray/issues/2535#issuecomment-443840119,https://api.github.com/repos/pydata/xarray/issues/2535,443840119,MDEyOklzc3VlQ29tbWVudDQ0Mzg0MDExOQ==,10137,2018-12-03T19:33:17Z,2018-12-03T19:33:17Z,NONE,"I have similar problem, when importing `rasterio` in the same script (not even using it for anything). This fails with HDF error:
import xarray as xa
import numpy as np
#import netCDF4
import rasterio

ds = xa.Dataset()
ds['z'] = (('y', 'x'), np.zeros((100, 100), np.float32))
print(ds)
ds.to_netcdf('test.nc')
ds.close()

with xa.open_dataset('test.nc') as ds:
    print(ds)
If I import `netCDF4` before `rasterio` it works fine (uncomment line 3). This is probably an issue with rasterio somehow. I installed everything with pip: $ pip install Cython $ pip install netCDF4 xarray rasterio numpy From `pip freeze`:
affine==2.2.1
attrs==18.2.0
cftime==1.0.3
Click==7.0
click-plugins==1.0.4
cligj==0.5.0
Cython==0.29.1
netCDF4==1.4.2
numpy==1.15.4
pandas==0.23.4
pyparsing==2.3.0
python-dateutil==2.7.5
pytz==2018.7
rasterio==1.0.11
six==1.11.0
snuggs==1.4.2
xarray==0.11.0
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,376389539