|
1 | 1 | """
|
2 |
| -Calculate and plotting per-season trends in global sea surface extrema |
3 |
| -====================================================================== |
| 2 | +Plotting per-season trends in global sea surface tempreature extrema |
| 3 | +==================================================================== |
4 | 4 |
|
5 | 5 | In this recipe we find the area-based extrema of global sea surface
|
6 | 6 | temperature per month and, because it is very difficult to
|
|
19 | 19 | # %%
|
20 | 20 | # 2. Read the dataset in extract the SST Field from the FieldList:
|
21 | 21 | f = cf.read("~/recipes_break/ERA5_monthly_averaged_SST.nc")
|
22 |
| -sst = f[0] |
| 22 | +sst = f[0] # this gives the sea surface temperature (SST) |
23 | 23 |
|
24 | 24 | # %%
|
25 |
| -# 3. Collapse data by area extrema (average over spatial dimensions): |
| 25 | +# 3. Collapse the SST data by area extrema (extrema over spatial dimensions): |
26 | 26 | am_max = sst.collapse("area: maximum") # equivalent to "X Y: maximum"
|
27 | 27 | am_min = sst.collapse("area: minimum") # equivalent to "X Y: minimum"
|
28 | 28 |
|
|
38 | 38 | # the four seasons, along with our description of them, as a value, with
|
39 | 39 | # the key of the string encoding the colour we want to plot these
|
40 | 40 | # trendlines in. This structure will be iterated over to make our plot:
|
41 |
| -colours_seasons_map = { |
| 41 | +colours_seasons_mapping = { |
42 | 42 | "red": (cf.mam(), "Mean across MAM: March, April and May"),
|
43 | 43 | "blue": (cf.jja(), "Mean across JJA: June, July and August"),
|
44 | 44 | "green": (cf.son(), "Mean across SON: September, October and November"),
|
|
61 | 61 | # "T: mean" collapse setting the season as the grouping:
|
62 | 62 | cfp.gpos(1)
|
63 | 63 | cfp.gset(xmin="1980-01-01", xmax="2022-12-01", ymin=304, ymax=312)
|
64 |
| -for colour, season_query in colours_seasons_map.items(): |
| 64 | +for colour, season_query in colours_seasons_mapping.items(): |
65 | 65 | query_on_season, season_description = season_query
|
66 |
| - am_sub = am_max.collapse("T: mean", group=query_on_season) |
| 66 | + am_max_collapse = am_max.collapse("T: mean", group=query_on_season) |
67 | 67 | cfp.lineplot(
|
68 |
| - am_sub, |
| 68 | + am_max_collapse, |
69 | 69 | color=colour,
|
70 | 70 | markeredgecolor=colour,
|
71 | 71 | marker="o",
|
|
85 | 85 | # mapping and doing a "T: mean" collapse setting the season as the grouping:
|
86 | 86 | cfp.gpos(2)
|
87 | 87 | cfp.gset(xmin="1980-01-01", xmax="2022-12-01", ymin=269, ymax=272)
|
88 |
| -for colour, season_query in colours_seasons_map.items(): |
| 88 | +for colour, season_query in colours_seasons_mapping.items(): |
89 | 89 | query_on_season, season_description = season_query
|
90 |
| - am_sub = am_min.collapse("T: mean", group=query_on_season) |
| 90 | + am_min_collapse = am_min.collapse("T: mean", group=query_on_season) |
91 | 91 | cfp.lineplot(
|
92 |
| - am_sub, |
| 92 | + am_min_collapse, |
93 | 93 | color=colour,
|
94 | 94 | markeredgecolor=colour,
|
95 | 95 | marker="o",
|
|
104 | 104 | # %%
|
105 | 105 | # 9. Add an overall title to the plot and close the file to save it:
|
106 | 106 | plt.suptitle(
|
107 |
| - "Global Average Sea Surface Temperature monthly minima\nand maxima " |
108 |
| - "including seasonal means of these extrema", |
| 107 | + "Global mean sea surface temperature (SST) monthly\nminima and maxima " |
| 108 | + "showing seasonal means of these extrema", |
109 | 109 | fontsize=18,
|
110 | 110 | )
|
111 | 111 | cfp.gclose()
|
0 commit comments