Commit 6cbaec1c authored by Jan Klaus Rieck's avatar Jan Klaus Rieck

test timesum()

parent 641e09ce
Pipeline #3639 failed with stage
in 1 minute and 30 seconds
......@@ -487,7 +487,7 @@ def depthave(ds, std_count=False):
+ ' vertical average!')
for gr in grids:
grid = grids[gr]
if ('z_c' in ds.dims) or ('z_l' in ds.dims):
if ('z_c' in ds.dims) ^ ('z_l' in ds.dims):
argu = {'dim': grid['z'], 'skipna': True, 'keep_attrs': True}
arg_count = {'dim': grid['z'], 'keep_attrs': True}
elif ('z_c' in ds.dims) and ('z_l' in ds.dims):
......
......@@ -318,6 +318,26 @@ def test_timeave_raises_keyerror():
xbox.timeave(ds_t_ave)
@pytest.mark.parametrize('monthly',
[True, False])
def test_timesum(monthly):
""" Test timesum().
"""
t_sum = xbox.timesum(ds_2d, monthly=monthly)[0]
assert 't' and 'month' not in t_sum.dims,\
'time summing did not work'
def test_timesum_raises_keyerror():
""" Test whether timeave() raises key error.
"""
ds_t_sum = ds_z_l.sum('t')
with pytest.raises(KeyError):
xbox.timeave(ds_t_sum)
@pytest.mark.parametrize('ds',
[ds, ds_z_c])
def test_depthave(ds):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment