-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCCMA_plot.py
112 lines (39 loc) · 1.44 KB
/
CCMA_plot.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 13:25:03 2020
@author: Dr. Michael Sigmond, Canadian Centre for Climate Modelling and Analysis
"""
import matplotlib.colors as col
import matplotlib.cm as cm
import numpy as np
def register_cccmacms(cmap='all'):
"""create my personal colormaps with discrete colors and register them.
default is to register all of them. can also specify which one.
(@@ input arg cmap not implemented yet 2/27/14)
"""
#print 'registering cmaps'
# define individual colors as RGB triples
# from colorwheel.m
# =============================================
# kem_w20 (20) OR blue2red_w20
# blueish at top, white in middle, reddish at bottom
cpool = np.array([ [153,255,255], \
[204,255,229], \
[240,255,240],\
[204,255,153],\
[178,255,102],\
[216,255,76],\
[255,255,51],\
[255,220,51],\
[255,187,51],\
[255,153,51],\
[255,0,0],\
[204,0,0],\
[153,0,0]], \
dtype=float)
acccbar = (cpool/255.)
thecmap = col.ListedColormap(acccbar,'acccbar')
cm.register_cmap(cmap=thecmap)
return
register_cccmacms()