In [25]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import h5py
import PIVutils
from importlib import reload
saveFolder = './'
In [26]:
X, Y, U, V, Cond, Prof = PIVutils.importMatlabPIVdata('/Users/Owen/Dropbox/Data/ABL/SBL PIV data/RNV45-RI2.mat',['X','Y','U','V'],['Cond','Prof'])
In [28]:
f = h5py.File('/Users/Owen/Dropbox/Python Codes/ASIIT/Data/testSave3.hdf5','w')
In [ ]:
Uset = f.create_dataset("U", data=U)
In [ ]:
Uset.dtype
In [ ]:
"U" in f
In [ ]:
f.close()
In [15]:
f = h5py.File('/Users/Owen/Dropbox/Python Codes/ASIIT/Data/testSave.hdf5','r')
In [ ]:
a = f.keys()
In [ ]:
list(f.keys())
In [ ]:
names = ['X','Y','V']
data = [X,Y,V]
In [ ]:
range(len(names))
In [ ]:
for i in range(len(names)):
print(i)
In [ ]:
for i in range(len(names)):
f.create_dataset(names[i], data=data[i])
In [ ]:
f.close()
In [57]:
reload(PIVutils)
PIVutils.saveDataset('/Users/Owen/Dropbox/Python Codes/ASIIT/Data/testSave4.hdf5',\
['X','Y','U','V'],[X,Y,U,V],\
['Cond','Prof'],[Cond,Prof])
In [ ]:
f.close()
In [7]:
Cond.items()
Out[7]:
In [11]:
a = list(Cond.items())
In [23]:
a[0][0]
Out[23]:
In [18]:
len(list(Cond.items()))
Out[18]:
In [32]:
CondSet = f.create_group("Cond2") #,(len(list(Cond.items())),)
In [33]:
for i in list(Cond.items()):
CondSet.create_dataset(i[0], data=i[1])
#h.create_dataset(i[0], data=i[1])
In [50]:
reload(PIVutils)
X, Y, U, V, Cond, Prof = PIVutils.loadDataset('/Users/Owen/Dropbox/Python Codes/ASIIT/Data/testSave4.hdf5',\
['X','Y','U','V'],['Cond','Prof'])
In [39]:
Cond
Out[39]:
In [48]:
import os
file = '/Users/Owen/Dropbox/Python Codes/ASIIT/Data/testSave2.hdf5'
if os.path.exists(file):
del(file)
print("Original file deleted")
In [58]:
f = h5py.File('/Users/Owen/Dropbox/Python Codes/ASIIT/Data/RNV45-thumbs.hdf5','r')
In [60]:
list(f.keys())
Out[60]:
In [61]:
list(f['ThumbParams'].keys())
Out[61]:
In [65]:
i = 'Cond'
TempS = {k : f[i][k].value[0] #Generate a dictionary linking all values in cond with their names
for k in f[i].keys()}
In [66]:
Cond
Out[66]:
In [67]:
Prof
Out[67]:
In [ ]: