Introduction
Introduction Statistics Contact Development Disclaimer Help
tnetcdf.jl - Granular.jl - Julia package for granular dynamics simulation
git clone git://src.adamsgaard.dk/Granular.jl
Log
Files
Refs
README
LICENSE
---
tnetcdf.jl (1825B)
---
1 #!/usr/bin/env julia
2
3 # Check if NetCDF files are read correctly from the disk.
4
5 @test_throws ErrorException Granular.readOceanStateNetCDF("nonexistentfi…
6 @test_throws ErrorException Granular.readOceanGridNetCDF("nonexistentfil…
7
8 @info "Testing dimensions of content read from Baltic test case"
9 ocean = Granular.readOceanNetCDF("Baltic/00010101.ocean_month.nc",
10 "Baltic/ocean_hgrid.nc")
11 @test ocean.time / (24. * 60. * 60.) ≈ [.5, 1.5, 2.5, 3.5, 4.5]
12 @test size(ocean.xq) == (24, 15)
13 @test size(ocean.yq) == (24, 15)
14 @test size(ocean.xh) == (23, 14)
15 @test size(ocean.yh) == (23, 14)
16 @test size(ocean.u) == (24, 15, 63, 5)
17 @test size(ocean.v) == (24, 15, 63, 5)
18 @test size(ocean.h) == (23, 14, 63, 5)
19 @test size(ocean.e) == (23, 14, 64, 5)
20
21 @info "Testing ocean state interpolation"
22 @test_throws ErrorException Granular.interpolateOceanState(ocean, time=0…
23 @test_throws ErrorException Granular.interpolateOceanState(ocean, time=1…
24 u1, v1, h1, e1 = Granular.interpolateOceanState(ocean, ocean.time[1])
25 u2, v2, h2, e2 = Granular.interpolateOceanState(ocean, ocean.time[2])
26 @test_throws ErrorException Granular.interpolateOceanState(ocean, -1.)
27 u1_5, v1_5, h1_5, e1_5 = Granular.interpolateOceanState(ocean,
28 ocean.time[1] + (ocean.time[2] - ocean.time[1]) / 2.)
29 @test u1 ≈ ocean.u[:, :, :, 1]
30 @test v1 ≈ ocean.v[:, :, :, 1]
31 @test h1 ≈ ocean.h[:, :, :, 1]
32 @test e1 ≈ ocean.e[:, :, :, 1]
33 @test u2 ≈ ocean.u[:, :, :, 2]
34 @test v2 ≈ ocean.v[:, :, :, 2]
35 @test h2 ≈ ocean.h[:, :, :, 2]
36 @test e2 ≈ ocean.e[:, :, :, 2]
37 @test u1_5 ≈ (ocean.u[:, :, :, 1] + ocean.u[:, :, :, 2]) / 2.
38 @test v1_5 ≈ (ocean.v[:, :, :, 1] + ocean.v[:, :, :, 2]) / 2.
39 @test h1_5 ≈ (ocean.h[:, :, :, 1] + ocean.h[:, :, :, 2]) / 2.
40 @test e1_5 ≈ (ocean.e[:, :, :, 1] + ocean.e[:, :, :, 2]) / 2.
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.