|
27 | 27 | am_min = am_min.subspace(T=cf.ge(cf.dt("1980-01-01")))
|
28 | 28 | print("FINAL FIELDS ARE", am_max, am_min)
|
29 | 29 |
|
30 |
| -am_sub_1 = am_min.collapse("T: mean", group=cf.mam()) |
31 |
| -am_sub_2 = am_min.collapse("T: mean", group=cf.jja()) |
32 |
| -am_sub_3 = am_min.collapse("T: mean", group=cf.son()) |
33 |
| -am_sub_4 = am_min.collapse("T: mean", group=cf.djf()) |
| 30 | +# TODO |
| 31 | +colours_seasons_map = { |
| 32 | + "red": (cf.mam(), "Mean across MAM: March, April and May"), |
| 33 | + "blue": (cf.jja(), "Mean across JJA: June, July and August"), |
| 34 | + "green": (cf.son(), "Mean across SON: September, October and November"), |
| 35 | + "purple": (cf.djf(), "Mean across DJF: December, January and February"), |
| 36 | +} |
34 | 37 |
|
35 |
| -am_sub_5 = am_max.collapse("T: mean", group=cf.mam()) |
36 |
| -am_sub_6 = am_max.collapse("T: mean", group=cf.jja()) |
37 |
| -am_sub_7 = am_max.collapse("T: mean", group=cf.son()) |
38 |
| -am_sub_8 = am_max.collapse("T: mean", group=cf.djf()) |
39 |
| - |
40 |
| - |
41 |
| -cfp.gopen(rows=2, columns=1, bottom=0.2, file="global_avg_sst_plot.png") |
| 38 | +cfp.gopen( |
| 39 | + rows=2, columns=1, bottom=0.1, top=0.75, file="global_avg_sst_plot.png") |
42 | 40 |
|
43 | 41 | # Put maxima subplot at top since these values are higher, given
|
44 | 42 | # increasing x axis
|
45 |
| -xticks = list(range(1980, 2024)) |
46 |
| -xlabels = [None for i in xticks] |
47 |
| - |
48 | 43 | cfp.gpos(1)
|
| 44 | +plt.suptitle( |
| 45 | + "Global Average Sea Surface Temperature monthly minima\nand maxima " |
| 46 | + "including seasonal means of these extrema", |
| 47 | + fontsize=18, |
| 48 | +) |
| 49 | +for colour, season_query in colours_seasons_map.items(): |
| 50 | + query_on_season, season_description = season_query |
| 51 | + am_sub = am_max.collapse("T: mean", group=query_on_season) |
| 52 | + cfp.lineplot( |
| 53 | + am_sub, |
| 54 | + color=colour, |
| 55 | + markeredgecolor=colour, |
| 56 | + marker="o", |
| 57 | + xlabel="", |
| 58 | + label=season_description, |
| 59 | + title="Maxima per month or season", |
| 60 | + # TODO FONTSIZE HERE |
| 61 | + ) |
49 | 62 | cfp.lineplot(
|
50 | 63 | am_max,
|
51 | 64 | color="grey",
|
52 | 65 | xlabel="",
|
53 |
| - #xticks=xticks, |
54 |
| - #xticklabels=xlabels, |
55 |
| -) |
56 |
| -cfp.lineplot( |
57 |
| - am_sub_5, |
58 |
| - color="red", |
59 |
| - markeredgecolor="red", |
60 |
| - marker="o", |
61 |
| - xlabel="", |
62 |
| - #xticks=xticks, |
63 |
| - #xticklabels=xlabels, |
64 |
| -) |
65 |
| -cfp.lineplot( |
66 |
| - am_sub_6, |
67 |
| - color="green", |
68 |
| - markeredgecolor="green", |
69 |
| - marker="o", |
70 |
| - xlabel="", |
71 |
| - #xticks=xticks, |
72 |
| - #xticklabels=xlabels, |
73 |
| -) |
74 |
| -cfp.lineplot( |
75 |
| - am_sub_7, |
76 |
| - color="blue", |
77 |
| - markeredgecolor="blue", |
78 |
| - marker="o", |
79 |
| - xlabel="", |
80 |
| - #xticks=xticks, |
81 |
| - #xticklabels=xlabels, |
82 |
| -) |
83 |
| -cfp.lineplot( |
84 |
| - am_sub_8, |
85 |
| - color="purple", |
86 |
| - markeredgecolor="purple", |
87 |
| - marker="o", |
88 |
| - xlabel="", |
89 |
| - #xticks=xticks, |
90 |
| - #xticklabels=xlabels, |
| 66 | + ylabel="Temperature (K)", |
| 67 | + label="All months" |
91 | 68 | )
|
92 | 69 |
|
93 | 70 | # Minima subplot below the maxima one
|
94 | 71 | cfp.gpos(2)
|
| 72 | +for colour, season_query in colours_seasons_map.items(): |
| 73 | + query_on_season, season_description = season_query |
| 74 | + am_sub = am_min.collapse("T: mean", group=query_on_season) |
| 75 | + cfp.lineplot( |
| 76 | + am_sub, |
| 77 | + color=colour, |
| 78 | + markeredgecolor=colour, |
| 79 | + marker="o", |
| 80 | + xlabel="", |
| 81 | + title="Minima per month or season" |
| 82 | + ) |
95 | 83 | cfp.lineplot(
|
96 | 84 | am_min,
|
97 | 85 | color="grey",
|
98 | 86 | )
|
99 |
| -#cfp.lineplot( |
100 |
| -# am, |
101 |
| -# color="blue", |
102 |
| -# title="Global Average Sea Surface Temperature", |
103 |
| -# ylabel="Temperature (K)", |
104 |
| -# xlabel="Time" |
105 |
| -#) |
106 |
| -cfp.lineplot( |
107 |
| - am_sub_1, |
108 |
| - color="red", |
109 |
| - markeredgecolor="red", |
110 |
| - marker="o" |
111 |
| -) |
112 |
| -cfp.lineplot( |
113 |
| - am_sub_2, |
114 |
| - color="green", |
115 |
| - markeredgecolor="green", |
116 |
| - marker="o" |
117 |
| -) |
118 |
| -cfp.lineplot( |
119 |
| - am_sub_3, |
120 |
| - color="blue", |
121 |
| - markeredgecolor="blue", |
122 |
| - marker="o" |
123 |
| -) |
124 |
| -cfp.lineplot( |
125 |
| - am_sub_4, |
126 |
| - color="purple", |
127 |
| - markeredgecolor="purple", |
128 |
| - marker="o" |
129 |
| -) |
130 | 87 |
|
131 | 88 | cfp.gclose()
|
0 commit comments