Skip to content

Commit 09ed0ee

Browse files
committed
Info learned +dimensional switch
1 parent 1508f24 commit 09ed0ee

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

stagpy/args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _sub(cmd, *sections):
2626
('time', _sub(time_series, 'core', 'plot', 'scaling')),
2727
('refstate', _sub(refstate, 'core', 'plot')),
2828
('plates', _sub(plates, 'core', 'plot', 'scaling')),
29-
('info', _sub(commands.info_cmd, 'core')),
29+
('info', _sub(commands.info_cmd, 'core', 'scaling')),
3030
('var', _sub(commands.var_cmd)),
3131
('version', _sub(commands.version_cmd)),
3232
('config', _sub(commands.config_cmd)),

stagpy/commands.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import sys
88

99
import loam.tools
10+
import pandas
1011

1112
from . import conf, phyvars, __version__
1213
from . import stagyydata
@@ -49,7 +50,23 @@ def info_cmd():
4950
print(', snapshot {}/{}'.format(step.isnap, lsnap.isnap))
5051
else:
5152
print()
52-
print(indent(step.timeinfo.loc[varlist].to_string(), ' '))
53+
series = step.timeinfo.loc[varlist]
54+
if conf.scaling.dimensional:
55+
series = series.copy()
56+
dimensions = []
57+
for var, val in series.iteritems():
58+
dim = phyvars.TIME.get(var) or phyvars.TIME_EXTRA.get(var)
59+
dim = dim.dim if dim is not None else '1'
60+
if dim == '1':
61+
dimensions.append('')
62+
else:
63+
series[var], dim = sdat.scale(val, dim)
64+
dimensions.append(dim)
65+
series = pandas.concat(
66+
[series,
67+
pandas.DataFrame(data=dimensions, index=series.index)],
68+
axis=1)
69+
print(indent(series.to_string(header=False), ' '))
5370
print()
5471

5572

0 commit comments

Comments
 (0)