commit 0bc36bca783b0a99abb36ce0f150be6365b033a7
parent bedd672cc8bc64cbbb68ad717b963d2391e6b881
Author: Anders Damsgaard <andersd@riseup.net>
Date: Tue, 25 Apr 2017 15:23:57 -0400
add tests of ocean state temporal interpolation
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/test/netcdf.jl b/test/netcdf.jl
@@ -20,3 +20,19 @@ ocean = SeaIce.readOceanNetCDF("Baltic/00010101.ocean_month.nc",
info("Testing ocean state interpolation")
@test_throws ErrorException SeaIce.findContacts!(ocean, time=0.)
@test_throws ErrorException SeaIce.findContacts!(ocean, time=1.e34)
+u1, v1, h1, e1 = SeaIce.interpolateOceanState(ocean, ocean.time[1])
+u2, v2, h2, e2 = SeaIce.interpolateOceanState(ocean, ocean.time[2])
+u1_5, v1_5, h1_5, e1_5 = SeaIce.interpolateOceanState(ocean,
+ ocean.time[1] + (ocean.time[2] - ocean.time[1])/2.)
+@test_approx_eq u1 ocean.u[:, :, :, 1]
+@test_approx_eq v1 ocean.v[:, :, :, 1]
+@test_approx_eq h1 ocean.h[:, :, :, 1]
+@test_approx_eq e1 ocean.e[:, :, :, 1]
+@test_approx_eq u2 ocean.u[:, :, :, 2]
+@test_approx_eq v2 ocean.v[:, :, :, 2]
+@test_approx_eq h2 ocean.h[:, :, :, 2]
+@test_approx_eq e2 ocean.e[:, :, :, 2]
+@test_approx_eq u1_5 (ocean.u[:, :, :, 1] + ocean.u[:, :, :, 2])/2.
+@test_approx_eq v1_5 (ocean.v[:, :, :, 1] + ocean.v[:, :, :, 2])/2.
+@test_approx_eq h1_5 (ocean.h[:, :, :, 1] + ocean.h[:, :, :, 2])/2.
+@test_approx_eq e1_5 (ocean.e[:, :, :, 1] + ocean.e[:, :, :, 2])/2.