tadd tests of ocean state temporal interpolation - Granular.jl - Julia package for granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/Granular.jl
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 0bc36bca783b0a99abb36ce0f150be6365b033a7
(DIR) parent bedd672cc8bc64cbbb68ad717b963d2391e6b881
(HTM) Author: Anders Damsgaard <andersd@riseup.net>
Date: Tue, 25 Apr 2017 15:23:57 -0400
add tests of ocean state temporal interpolation
Diffstat:
M test/netcdf.jl | 16 ++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/test/netcdf.jl b/test/netcdf.jl
t@@ -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.