-1

Hi i am using this code from here How to read NetCDF file and write to CSV using Python I want to be able to pull out the "Mean_period_of_swell_waves_ordered_sequence_of_data" from from the THREDDS Catalog here but am recieving the below error. I am using Canopy

Any ideas why? Thanks 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: 

1 Answers1

0

Fixed by changing

var = nc.variables[vname]
hs = var[istart:istop,iy,ix]
tim = dtime[istart:istop]

to

var = nc.variables[vname]
tp = var[istart:istop,iy,ix]
tim = dtime[istart:istop]