-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclimatemeans.py
executable file
·58 lines (37 loc) · 1.2 KB
/
climatemeans.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 iris
from braceexpand import braceexpand
import iris.analysis
import os
import iris.analysis.cartography
in_dir_base='/home/williamsjh/cylc-run/'
runid='bc048'
whoami='williamsjh'
project='niwa00013'
out_dir='/nesi/nobackup/'+project+'/'+whoami+'/esmeval/user_data/'+whoami+'/model_data/u-'+runid
print('out_dir = ')
print(out_dir)
in_dir=in_dir_base+'u-'+runid+'/share/data/History_Data/'
firstyear=1960
nyears=20
if not os.path.exists(out_dir+'/supermeans'):
os.makedirs(out_dir+'/supermeans')
if nyears == 2:
supermeanlabel = '2'
if nyears == 10:
supermeanlabel = 'a'
if nyears == 20:
supermeanlabel = 'k'
if nyears == 2:
supermeanlabel = '2'
if nyears >= 30 and nyears <40:
supermeanlabel = 't'
if nyears >= 50 and nyears <100:
supermeanlabel = 'l'
fnames = list(braceexpand(in_dir+'*pm*{196[0-9],197[0-9]}*{mar,apr,may}*'))
period = 'mam'
print(fnames)
_vars = iris.load(fnames)
#_varsmean = _vars.collapsed('time',iris.analysis.MEAN)
#iris.save(_varsmean,out_dir+'/supermeans'+'/'+runid+'a.m'+supermeanlabel+str(year)+period+'.pp')
# the m in the previous line is the 'mean' indicator, not to be
# confused with the 'm for monthly' in the input files!