-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiplotter.py
More file actions
88 lines (63 loc) · 1.63 KB
/
miniplotter.py
File metadata and controls
88 lines (63 loc) · 1.63 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 10 13:54:44 2016
@author: hanbre
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import xray
import seaborn as sns
ds = xray.open_dataset('files/f1850w.new_control.cam.h5.0001-0030.10hpa.zon.TU.nc')
#Plot U10 60N
U60 = ds.U[dict(lat=79)]
time = np.arange(1,366,0.5)
#Plot all in one file
for i in range(1,31):
plt.plot(time,U60[(i*730-730):i*730])
plt.axis([0,366,-100,100])
plt.savefig('files/all_30_years_U60.png',dpi=200)
#Plot 5 in one file
plt.figure()
for i in range(1,31):
plt.plot(time,U60[(i*730-730):i*730])
plt.axis([0,366,-100,100])
if i%5==0:
plt.savefig('files/{0}_U60.png'.format(i),dpi=200)
plt.figure()
#Plot mean over all years
plt.figure()
U = []
for i in range(1,31):
U.append(U60[(i*730-730):i*730].values)
Ua=np.array(U)
Um=np.mean(Ua,axis=0)
plt.plot(time,Um)
plt.savefig('files/mean_U60.png',dpi=200)
#Plot U10 60S
U_60 = ds.U[dict(lat=16)]
#Plot all in one file
plt.figure()
for i in range(1,31):
plt.plot(time,U_60[(i*730-730):i*730])
plt.axis([0,366,-100,100])
U
plt.savefig('files/all_30_years_U-60.png',dpi=200)
#Plot 5 in one file
plt.figure()
for i in range(1,31):
plt.plot(time,U_60[(i*730-730):i*730])
plt.axis([0,366,-100,100])
if i%5==0:
plt.savefig('files/{0}_U-60.png'.format(i),dpi=200)
plt.figure()
#Plot mean of all years
plt.figure()
U = []
for i in range(1,31):
U.append(U_60[(i*730-730):i*730].values)
Ua=np.array(U)
Um=np.mean(Ua,axis=0)
plt.plot(time,Um)
plt.savefig('files/mean_U-60.png',dpi=200)