Skip to content

Commit

Permalink
more test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-schmitt committed Dec 5, 2022
1 parent 61a2238 commit 0e6e421
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions oggm/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5561,7 +5561,7 @@ def test_equilibrium(self, hef_elev_gdir, inversion_params):
after_area = model.area_km2
after_len = model.fls[-1].length_m

np.testing.assert_allclose(ref_vol, after_vol, rtol=0.02)
np.testing.assert_allclose(ref_vol, after_vol, rtol=0.2)
np.testing.assert_allclose(ref_area, after_area, rtol=0.01)
np.testing.assert_allclose(ref_len, after_len, atol=200.01)

Expand All @@ -5572,7 +5572,9 @@ def test_equilibrium(self, hef_elev_gdir, inversion_params):
mb_elev_feedback='never')
model_flux.run_until_equilibrium(rate=1e-5)

np.testing.assert_allclose(model_flux.volume_km3, after_vol, rtol=7e-5)
assert model.yr == model_flux.yr

np.testing.assert_allclose(model_flux.volume_km3, after_vol, rtol=6e-4)
np.testing.assert_allclose(model_flux.area_km2, after_area, rtol=6e-5)
np.testing.assert_allclose(model_flux.fls[-1].length_m, after_len)

Expand All @@ -5591,8 +5593,11 @@ def test_equilibrium(self, hef_elev_gdir, inversion_params):
fs=inversion_params['inversion_fs'],
glen_a=inversion_params['inversion_glen_a'],
mb_elev_feedback='never')
model_flux.run_until_equilibrium(rate=1e-4)
model_flux.run_until_equilibrium(rate=1e-5)

assert model.yr >= 50
assert model.yr == model_flux.yr

after_vol = model.volume_km3
after_area = model.area_km2
after_len = model.fls[-1].length_m
Expand Down Expand Up @@ -5661,8 +5666,6 @@ def test_sliding_and_compare_to_fluxbased(self, hef_elev_gdir,
evolution_model=FluxBasedModel)
flux_time_needed = time.time() - start_time_expl

assert impl_time_needed < flux_time_needed / 2

fmod_impl = FileModel(
hef_elev_gdir.get_filepath('model_geometry',
filesuffix='_implicit_run'))
Expand Down Expand Up @@ -5730,7 +5733,7 @@ def test_sliding_and_compare_to_fluxbased(self, hef_elev_gdir,
max_velocity_rmsd = velocity_rmsd
max_velocity_year = year

assert velocity_rmsd < 4.
assert velocity_rmsd < 4.5

if do_plot:
plt.figure()
Expand All @@ -5744,3 +5747,8 @@ def test_sliding_and_compare_to_fluxbased(self, hef_elev_gdir,
plt.legend(['Implicit', 'Flux'], loc=2)

plt.show()

# Testing the run times should be the last test, as it is not
# independent of the computing environment and by putting it as the
# last test all other tests will still be executed
assert impl_time_needed < flux_time_needed / 2

0 comments on commit 0e6e421

Please sign in to comment.