In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import modred as mr
import pandas as pd
In [2]:
1+1
Out[2]:
In [11]:
import h5py
f = h5py.File('/Users/Owen/Dropbox/Data/ABL/Heat Flux Data/Processed Results/N/Neutral45_2.mat')
list(f.keys())
Out[11]:
In [4]:
swirl = np.asarray(f['Swirl'])
X = np.asarray(f['X'])
Y = np.asarray(f['Y'])
U = np.asarray(f['U'])
V = np.asarray(f['V'])
In [5]:
k = f["Cond"].keys()
In [6]:
d= f["Cond"]["delta"]
In [7]:
list(k)
Out[7]:
In [9]:
d.value
Out[9]:
In [76]:
L = [i**2 for i in range(10)] #list comprehensions (also look up generator expressions)
L
Out[76]:
In [87]:
D = {1:2, 'abc':4} #Defining a dictionary object
D['abc']
Out[87]:
In [83]:
D['Cf']
Out[83]:
In [8]:
k = f["Cond"].keys() #Longer way to generate a pandas Series with all the values in Cond
Cond = pd.Series()
for i in list(k):
#d = f["Cond"][i].value[0]
#print(i, " = ", f["Cond"][i].value[0])
s1 = pd.Series(f["Cond"][i].value[0], index = [i])
Cond = Cond.append(s1)
In [72]:
Cond['Uinf']
Out[72]:
In [96]:
Cond = {k : f["Cond"][k].value[0] #Generate a dictionary linking all values in cond with their names
for k in f['Cond'].keys()}
In [97]:
Cond['Uinf'] #look up in pandas or dictionary object is the same
Out[97]:
In [124]:
k = f["Prof"].keys() #Once again long way to generate pandas object with all profiles
Prof = pd.Series()
for i in list(k):
d = f["Prof"][i].value
#print(i, " = " , f["Prof"][i].value)
s1 = pd.Series(f["Prof"][i].value, index = [i])
Prof = Prof.append(s1)
In [99]:
Prof = {k : f["Prof"][k].value #Generate a dictionary linking all values in cond with their names
for k in f['Prof'].keys()}
In [122]:
Prof = pd.Series({k : f["Prof"][k].value #Generate a pandas series from the dictionary
for k in f['Prof'].keys()})
In [123]:
Prof['U']
Out[123]:
In [109]:
Out[109]:
In [21]:
for i in range(1):
plt.figure()
plt.imshow(swirl[i].T, cmap='RdBu', origin='lower');
plt.clim([-50, 50])
In [27]:
for i in range(1):
plt.figure()
plt.pcolor(X.T,Y.T,swirl[i].T, cmap='RdBu');
plt.clim([-50, 50])
plt.axis('equal')
plt.axis([0, X.max(), 0, Y.max()])
#plt.yaxis([0, Y.max()])
In [18]:
Y.max()
Out[18]:
In [29]:
num_modes = 50;
modes, eig_vals = mr.compute_POD_matrices_snaps_method(U, list(range(num_modes)))
In [1]:
a = U.shape
In [ ]: