Skip to content

Commit 2977583

Browse files
committed
Switch for continent shading on plates plots
1 parent 59ea1c2 commit 2977583

File tree

3 files changed

+14
-41
lines changed

3 files changed

+14
-41
lines changed

stagpy/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ def _index_collection(arg):
188188
('stress', switch_opt(
189189
False, None,
190190
'Plot deviatoric stress instead of velocity on field plots')),
191+
('continents', switch_opt(True, None,
192+
'Whether to shade continents on plots')),
191193
('vzcheck', switch_opt(False, None,
192194
'activate Colin\'s version with vz checking')),
193195
('timeprofile', switch_opt(False, None,

stagpy/phyvars.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,8 @@
265265
Varp = namedtuple('Varp', ['description'])
266266
PLATES = OrderedDict((
267267
('c', Varp('Composition')),
268-
('eta', Varp('Viscosity')),
269268
('sc', Varp('Topography')),
270269
('age', Varp('Age')),
271-
('str', Varp('Stress')),
272-
('ed', Varp('Strain rate')),
273270
))
274271

275272
SCALES = {

stagpy/plates.py

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -560,18 +560,18 @@ def plot_scalar_field(step, fieldname, ridges, trenches):
560560
"""Plot scalar field with plate information."""
561561
fig, axis, _, _ = field.plot_scalar(step, fieldname)
562562

563-
# plotting continents
564-
concfld = step.fields['c'].values[0, :, :, 0]
565-
continentsfld = np.ma.masked_where(
566-
concfld < 3, concfld) # plotting continents, to-do
567-
continentsfld = continentsfld / continentsfld
568-
cbar = conf.field.colorbar
569-
conf.field.colorbar = False
570-
field.plot_scalar(step, 'c', continentsfld, axis,
571-
cmap='cool_r', vmin=0, vmax=0)
572-
cmap2 = plt.cm.ocean
573-
cmap2.set_over('m')
574-
conf.field.colorbar = cbar
563+
if conf.plates.continents:
564+
concfld = step.fields['c'].values[0, :, :, 0]
565+
continentsfld = np.ma.masked_where(
566+
concfld < 3, concfld) # plotting continents, to-do
567+
continentsfld = continentsfld / continentsfld
568+
cbar = conf.field.colorbar
569+
conf.field.colorbar = False
570+
field.plot_scalar(step, 'c', continentsfld, axis,
571+
cmap='cool_r', vmin=0, vmax=0)
572+
cmap2 = plt.cm.ocean
573+
cmap2.set_over('m')
574+
conf.field.colorbar = cbar
575575

576576
# plotting velocity vectors
577577
field.plot_vec(axis, step, 'sx' if conf.plates.stress else 'v')
@@ -630,7 +630,6 @@ def main_plates(sdat):
630630
timestep = step.isnap
631631
print('Treating snapshot', timestep)
632632

633-
rcmb = step.geom.rcmb
634633
# topography
635634
fname = sdat.filename('sc', timestep=timestep, suffix='.dat')
636635
topo = np.genfromtxt(str(fname))
@@ -648,31 +647,6 @@ def main_plates(sdat):
648647
# plot scalar field with position of trenches and ridges
649648
plot_scalar_field(step, conf.plates.field, ridges, trenches)
650649

651-
# plot stress field with position of trenches and ridges
652-
if 'str' in conf.plates.plot:
653-
fig, axis, _, _ = field.plot_scalar(step, 'sII',
654-
vmin=0, vmax=300)
655-
656-
# Annotation with time and step
657-
axis.text(1., 0.9, str(round(time, 0)) + ' My',
658-
transform=axis.transAxes)
659-
axis.text(1., 0.1, str(timestep),
660-
transform=axis.transAxes)
661-
662-
# Put arrow where ridges and trenches are
663-
plot_plate_limits_field(axis, rcmb, ridges, trenches)
664-
665-
saveplot(fig, 's', timestep, close=conf.plates.zoom is None)
666-
667-
# Zoom
668-
if conf.plates.zoom is not None:
669-
axis.set_xlim(xzoom - ladd, xzoom + radd)
670-
axis.set_ylim(yzoom - dadd, yzoom + uadd)
671-
saveplot(fig, 'szoom', timestep)
672-
673-
# calculate stresses in the lithosphere
674-
lithospheric_stress(step, trenches, ridges, time)
675-
676650

677651
def cmd():
678652
"""Implementation of plates subcommand.

0 commit comments

Comments
 (0)