Skip to content

Commit d67b982

Browse files
committed
Sfields are properly labeled
1 parent 4257570 commit d67b982

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

stagpy/phyvars.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,26 @@
8383
))
8484

8585
SFIELD = OrderedDict((
86-
('geoid', Varf('Geoid', 'm')),
87-
('topo', Varf('Topography', 'm')),
86+
('topo_top', Varf('Topography at top', 'm')),
87+
('topo_bot', Varf('Topography at bottom', 'm')),
88+
('geoid_top', Varf('Geoid at top', 'm')),
89+
('geoid_bot', Varf('Geoid at bottom', 'm')),
90+
('topo_g_top', Varf('Topography for geoid at top', 'm')),
91+
('topo_g_bot', Varf('Topography for geoid at bottom', 'm')),
92+
('ftop', Varf('Heat flux at top', 'W/m2')),
93+
('fbot', Varf('Heat flux at bottom', 'W/m2')),
94+
('fstop', Varf('Heat flux from spectrum at top', 'W/m2')),
95+
('fsbot', Varf('Heat flux from spectrum at bottom', 'W/m2')),
96+
('crust', Varf('Crustal thickness', 'm')),
8897
))
8998

9099
SFIELD_FILES = OrderedDict((
91-
('g', ['geoid']),
92-
('cs', ['topo']),
100+
('cs', ['topo_bot', 'topo_top']),
101+
('g', ['geoid_bot', 'geoid_top']),
102+
('csg', ['topo_g_bot', 'topo_g_top']),
103+
('hf', ['fbot', 'ftop']),
104+
('hfs', ['fsbot', 'fstop']),
105+
('cr', ['crust']),
93106
))
94107

95108
Varr = namedtuple('Varr', ['description', 'kind', 'dim'])

stagpy/stagyyparsers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,13 @@ def fields(fieldfile, only_header=False, only_istep=False):
377377

378378
# check nb components
379379
nval = 1
380+
sfield = False
380381
if magic > 400:
381382
nval = 4
382383
elif magic > 300:
383384
nval = 3
385+
elif magic > 100:
386+
sfield = True
384387

385388
magic %= 100
386389

@@ -469,6 +472,9 @@ def fields(fieldfile, only_header=False, only_istep=False):
469472
] = np.transpose(data_cpu.reshape(
470473
(nbk, npc[2], npc[1] + header['xyp'],
471474
npc[0] + header['xyp'], nval)))
475+
if sfield:
476+
# for surface fields, variables are written along z direction
477+
flds = np.swapaxes(flds, 0, 3)
472478
return header, flds
473479

474480

0 commit comments

Comments
 (0)