您好,我正在使用此处的代码How to read NetCDF file and write to CSV using Python我希望能够提取" Mean_period_of_swell_waves_ordered_sequence_of_data"来自THREDDS Catalog here,但我收到了以下错误。我正在使用Canopy
任何想法为什么? 谢谢Alec
IndexErrorTraceback (most recent call last)
/home/GRIB-extract-SWPER.py in <module>()
73 #vname = 'surf_el'
74 var = nc.variables[vname]
---> 75 hs = var[istart:istop,iy,ix]
76 tim = dtime[istart:istop]
77
netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Variable.__getitem__ (netCDF4/_netCDF4.c:39739)()
netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Variable._get (netCDF4/_netCDF4.c:49789)()
IndexError:
答案 0 :(得分:0)
通过更改
修复var = nc.variables[vname]
hs = var[istart:istop,iy,ix]
tim = dtime[istart:istop]
到
var = nc.variables[vname]
tp = var[istart:istop,iy,ix]
tim = dtime[istart:istop]