Update test_deplete_predictor to check depletion time

Due to where the results are saved for the predictor routine,
at the top of the for loop vs. the end, the positions
are incremented by one in the depletion time. This causes
a value of zero to be returned as the first item in the array
from get_depletion_time.

This save was moved in commit 87aed7a0b0
of PR #1014 to make the restart feature easier.
This commit is contained in:
Andrew Johnson 2019-06-21 14:14:35 -05:00
parent bd0a9a18e4
commit 71d31d6ea6
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB
2 changed files with 4 additions and 2 deletions

View file

@ -103,4 +103,4 @@ def predictor(operator, timesteps, power=None, power_density=None,
op_results = [operator(x[0], power[-1])]
# Create results, write to disk
Results.save(operator, x, op_results, [t, t], p, i_res + len(timesteps), proc_time)
Results.save(operator, x, op_results, [t, t], p, i_res + len(timesteps), None)

View file

@ -38,4 +38,6 @@ def test_predictor(run_in_tmpdir):
# Test structure of depletion time dataset
assert res.get_depletion_time().shape == (len(dt), 1)
dep_time = res.get_depletion_time()
assert dep_time.shape == (len(dt), 1)
assert all(dep_time > 0)