Skip to content

Commit 3bfa10c

Browse files
committed
Merge main_plates into cmd function
1 parent c01eeba commit 3bfa10c

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

stagpy/plates.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -324,26 +324,6 @@ def plot_scalar_field(step, fieldname, ridges, trenches):
324324
saveplot(fig, f'plates_zoom_{fieldname}', step.isnap)
325325

326326

327-
def main_plates(sdat):
328-
"""Plot several plates information."""
329-
# averaged horizontal surface velocity needed for redimensionalisation
330-
isurf = _isurf(next(iter(sdat.walk)))
331-
vrms_surf = sdat.walk.filter(rprofs=True)\
332-
.rprofs_averaged['vhrms'].values[isurf]
333-
334-
with open(f'plates_trenches_{sdat.walk.stepstr}.dat', 'w') as fid:
335-
fid.write('# istep time time_My phi_trench vel_trench '
336-
'distance phi_cont age_trench_My\n')
337-
338-
for step in sdat.walk.filter(fields=['T']):
339-
# could check other fields too
340-
trenches, ridges, itrenches = detect_plates(step)
341-
342-
_write_trench_diagnostics(step, vrms_surf, itrenches, fid)
343-
plot_at_surface(step, conf.plates.plot, trenches, ridges)
344-
plot_scalar_field(step, conf.plates.field, ridges, trenches)
345-
346-
347327
def cmd():
348328
"""Implementation of plates subcommand.
349329
@@ -355,7 +335,21 @@ def cmd():
355335
"""
356336
sdat = StagyyData()
357337
if not conf.plates.vzcheck:
358-
main_plates(sdat)
338+
isurf = _isurf(next(iter(sdat.walk)))
339+
vrms_surf = sdat.walk.filter(rprofs=True)\
340+
.rprofs_averaged['vhrms'].values[isurf]
341+
342+
with open(f'plates_trenches_{sdat.walk.stepstr}.dat', 'w') as fid:
343+
fid.write('# istep time time_My phi_trench vel_trench '
344+
'distance phi_cont age_trench_My\n')
345+
346+
for step in sdat.walk.filter(fields=['T']):
347+
# could check other fields too
348+
trenches, ridges, itrenches = detect_plates(step)
349+
350+
_write_trench_diagnostics(step, vrms_surf, itrenches, fid)
351+
plot_at_surface(step, conf.plates.plot, trenches, ridges)
352+
plot_scalar_field(step, conf.plates.field, ridges, trenches)
359353
else:
360354
nb_plates = []
361355
time = []

0 commit comments

Comments
 (0)