Reputation: 21
I'm trying to create an array of Temperature and Time but my Time dimension is a slice. I am getting an error when I try to convert my slice to an array. "slice object is not callable"
filehandle = Dataset(path+indices,'r',format="NETCDF4")
timerange = slice(0, 1460)
temp = get_var(filehandle, 'tair')[timerange, lat, lon]
lat_file = str(lat_round)
lon_file = str(lon_round)
ncname = 'CRUNCEP_mstmip_Tair_'+year_url+'_lat('+lat_file+')_lon('+lon_file+').nc'
ncfile = Dataset(ncname,'w')
floats = [float(x) for x in timerange()]
data_out = temp*timerange
I want to make this an array, and create a Netcdf file. Any ideas on how to fix this? Thanks!
Upvotes: 0
Views: 1327
Reputation: 600059
I'm not quite sure why you've used slice here in the first place, or why you're calling the result. Did you perhaps mean range
?
timerange = range(0, 1460)
floats = [float(x) for x in timerange]
Upvotes: 2