0

I want to find the time index corresponding to the date 2018-08-21

import netCDF4
from netCDF4 import num2date, date2num, date2index
import numpy as np

f=netCDF4.Dataset('../t.cdf')
times=f.variables['time']
dates = num2date(times[:], times.units)
print(dates.index(2014, 8, 21))

error: print(dates.index(2018, 8, 25)) Traceback (most recent call last): File "", line 1, in AttributeError: 'numpy.ndarray' object has no attribute 'index'

0 Answers0