forked from pressel/pycles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBOMEX_plotting_mean.py
58 lines (44 loc) · 1.5 KB
/
BOMEX_plotting_mean.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import netCDF4 as nc
import numpy as np
import pylab as plt
import glob
import os
my_i = np.arange(180,217,1) # which profiles to include
#my_i = np.arange(1,2,1) # which profiles to include
print(my_i)
n_i = np.shape(my_i)[0]
nkr = 75
vars = ['cloud_fraction'] #,'u_mean','v_mean','s_mean','viscosity_mean','diffusivity_mean' ,'wind_speed', 'wind_angle', 'theta_mean']
colors = ['White','Black','LightPink','PowderBlue','HotPink','SkyBlue','MediumVioletRed','RoyalBlue','Maroon','Navy','White','Black']
dirs = glob.glob('./Output.Bomex.f827b*')
#--------MEANS
for dir in dirs:
file = glob.glob(dir+'/stats/*')[0]
data = nc.Dataset(file,'r')
print(data.groups['profiles'].variables['cloud_fraction'][72,1:72])
for var in vars:
string = '1'
if string[0]=='_':
string = string[1]
# print(string)
if string == '3':
pass
else:
title = var
plt.figure(title)
reg1 = np.zeros(nkr)
for t in my_i:
#print(t)
for k in np.arange(nkr):
#print(k)
reg1[k] += data.groups['profiles'].variables[var][t,k]/float(n_i)
print(reg1)
plt.plot(reg1, data.groups['profiles'].variables['z'][:], linewidth = 2,label = string, color='r')
for var in vars:
plt.figure(var)
#plt.xlabel(var)
#plt.ylabel('z, m',fontsize=14 )
plt.title('cloud_fraction_profiles',fontsize=14 )
plt.grid(True)
plt.legend()
plt.show()