You could do this using exception handling. I've shown this with a simple example based on your code:
import xarray as xr
import numpy as np
import pandas as pd
ncfile = glob.glob('mydata/****/se*')
frame = pd.DataFrame()
errors = []
for i in np.arange(len(ncfile)):
frame = frame
try:
ds = xr.open_dataset(ncfile[i])
except:
errors.append(ncfile[i])
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…