Dead kernel in Notebook when trying to read specific netCDF file

Hi everyone, I’m running into some issues reading data from a netcdf file in a python notebook. I hope this is the right place to ask for some advice on this problem.

The code what I use to read the netcdf file:

loadfiles3 = glob.glob(path3)
with nc.Dataset(loadfiles3[0]) as d:
    lon_ice_age = d['longitude'][:,:] 
    lat_ice_age = d['latitude'][:,:] 
    iage_NASA = d['age_of_sea_ice'][:,:,:] #(time, y, x)

Usually this works for me, but with this file I get a dead kernel every time I try to run it. Could it be due to the fact that the data type of ‘age_of_sea_ice’ variable in the netcdf file is ubyte? Does anyone have an idea how to read such a data type?



1 Like

Have you tried running your code in a plain Python session, outside of a Notebook, to see what is causing the problem? Otherwise, can you provide information about what is causing the kernel to die/crash?

1 Like

In a plain python session it does not give any problems and the data can be downloaded from the netcdf file. Strange it gives this problems in Notebook, this didnt happen before by reading other netcdf files. But for now I can work in a regular python session with this data file, thanks!

1 Like

It could be useful to find out what causes the problem with the notebook, just in case you need to be able to use your code in a notebook in the future. Perhaps look at the Jupyter Notebook forum if you are using that kind of notebook.

From memory, if you start a notebook from a terminal you should get a log written to the terminal window. This may help to diagnose the cause of the kernel crash. If you ask for advice in the notebook forum you may be asked to file a bug report/issue with that information. Good luck!

1 Like