I am trying to open some 18 h5 files from the local directory by using datetime function in python. I have access some data inside those files and so, I use numpy arrays. I am getting this type error while trying to access one of the temperature arrays in the h5 files. can I have any solution? thanks in advance
indir = os.chdir('H:\INSAT-3D\may12')
dt = datetime.datetime(2016,5,12,0,0,0,tzinfo=pytz.UTC)
tdelta = datetime.timedelta(minutes=60)
dt = dt+tdelta
f= dt.strftime('3DSND_%d%b%Y_%H%M_L1B_SA1.h5')
f=f.upper()
print f
new = []
abc=0
for names in range(0,24):
tdelta = datetime.timedelta(minutes=60)
dt = dt+tdelta
f = dt.strftime('3DSND_%d%b%Y_%H%M_L1B_SA1.h5')
f= f.upper()
if os.path.isfile(f):
read = h5py.File(f, 'r')
temp = np.array(f['SND_MWIR1_TEMP'])
here is the error I am getting,
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-62-2fe7a4d4ceb7> in <module>()
22 if os.path.isfile(f):
23 read = h5py.File(f, 'r')
---> 24 temp = np.array(f['SND_MWIR1_TEMP'])
25
26
TypeError: string indices must be integers, not str