Skip to content

Commit 4b255e1

Browse files
Line wrap comments in NH original recipe 16
1 parent 82021ee commit 4b255e1

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

docs/source/recipes/plot_16_recipe.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,52 @@
11
"""
2-
Plotting Contour Subplots with different Projections
2+
Plotting contour subplots with different projections
33
====================================================
44
5-
In this recipe, we will plot different projections for the same data to illustrate
6-
visually the ones available in order to more visually decide which is suitable.
5+
In this recipe, we will plot different projections for the same
6+
data to illustrate visually the ones available in order to more
7+
visually decide which is suitable.
8+
79
"""
810

911
# %%
1012
# 1. Import cf-python and cf-plot:
1113

1214
import cfplot as cfp
15+
1316
import cf
1417

1518
# %%
1619
# 2. Read the field in:
1720
# Here I've used sample data ggap.nc (and later pressure=850),
1821
# but you could use tas_A1.nc (with time=15)
19-
2022
f = cf.read("~/cfplot_data/ggap.nc")[0]
2123

2224
# %%
2325
# 3. Create the file with subplots:
24-
# If you are changing the number of subplots ensure the number of rows * number
25-
# of columns = the number of subplots/projections
26+
# If you are changing the number of subplots ensure the number of
27+
# rows * number of columns = the number of subplots/projections
2628
# Here we are doing 6 projections so 2x3 is fine
27-
2829
cfp.gopen(rows=2, columns=3, bottom=0.2, file="projections.png")
2930

3031
# %%
3132
# 4. List the projection types being used:
3233
# Here we are using Cylindrical/Default, North Pole Stereographic,
33-
# South Pole Stereographic, Mollweide, Cropped Lambert Conformal and Robinson
34+
# South Pole Stereographic, Mollweide, Cropped Lambert Conformal
35+
# and Robinson.
3436
# However you could also use other such as "rotated", "ortho" or
3537
# "merc", "ukcp", "osgb", or "EuroPP"
3638
# https://ncas-cms.github.io/cf-plot/build/user_guide.html#appendixc
37-
3839
projtypes = ["cyl", "npstere", "spstere", "moll", "lcc", "robin"]
3940

4041
# %%
41-
# 5. We then use a for loop to cycle through all the different projection types:
42-
# Only gpos has 1 added because it can only take 1 as its first value, otherwise there are
43-
# errors. There are if statements for some projections (lcc, OSGB and EuroPP) as they have
42+
# 5. We then use a for loop to cycle through all the different projection
43+
# types:
44+
# Only gpos has 1 added because it can only take 1 as its first value,
45+
# otherwise there are
46+
# errors. There are if statements for some projections (lcc, OSGB and
47+
# EuroPP) as they have
4448
# specific requirements for their contour.
4549
# However, OSGB and EuroPP will require very different data anyway.
46-
4750
for i, proj in enumerate(projtypes):
4851
cfp.gpos(i + 1)
4952
if projtypes[i] == "lcc":
@@ -59,7 +62,9 @@
5962
title=projtypes[i],
6063
colorbar_position=[0.1, 0.1, 0.8, 0.02],
6164
colorbar_orientation="horizontal",
62-
) # to see the marking lines need to be True, but this can be hard to read so if not needed use False
65+
)
66+
# to see the marking lines need to be True, but this can be
67+
# hard to read so if not needed use False
6368
else:
6469
cfp.con(
6570
f.subspace(pressure=850),

0 commit comments

Comments
 (0)