2

I have converted several raster files into NetCDF file using ArcMap10.5. Now I want to open netcdf file in python 3.6.

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import netCDF4
import xarray as xr
import h5py
import glob

allfiles = glob.glob('\folder*.nc')
for file in allfiles:
    file = xr.open_dataset(file).to_dataframe()
    list_of_dfs.append(file)
    print(file)

Getting following error:

SError: [Errno -101] NetCDF: HDF error:'file.nc'

I tried Setting environmental variable HDF5_USE_FILE_LOCKING=FALSE as suggested here But, still getting that error. Is there anyone who can help? Thanks

jhamman
  • 5,867
  • 19
  • 39
Sher
  • 369
  • 2
  • 19
  • Is there a file called 'file.nc' in the source directory? Also, you might want to check if the produced netCDF files are valid. For instance, check the input file with `ncdump -h 'file.nc'` from terminal. – msi_gerva Sep 06 '18 at 12:46
  • It was a simple mistake, after changing environmental variable HDF5_USE_FILE_LOCKING=FALSE I needed to restart jupyter notebook, so it worked then. – Sher Sep 06 '18 at 23:39

0 Answers0