Skip to content

Commit

Permalink
matlab: modern syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Dec 19, 2024
1 parent 4277566 commit 0fa3862
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
1 change: 0 additions & 1 deletion +msise00/MLint.txt

This file was deleted.

40 changes: 20 additions & 20 deletions +msise00/TestUnit.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function test_ccmc(tc)
time = datetime(2001,2,2,8,0,0);
glat = 60;
glon = -70;
ind = struct("f107s", 163.6666, "f107", 146.7, "Ap", 7);
ind = struct(f107s=163.6666, f107=146.7, Ap=7);
altkm = 400.;

cwd = fileparts(mfilename('fullpath'));
Expand All @@ -17,7 +17,7 @@ function test_ccmc(tc)
fid = fopen(ref_fn);

A = cell2mat(textscan(fid, '%f %f %f %f %f %f %f %f %f %f %f %f', 1, ...
'ReturnOnError', false, 'HeaderLines', 25));
ReturnOnError=false, HeaderLines=25));

A(2:4) = A(2:4) * 1e6; % cm^-3 => m^-3
A(5) = A(5) * 1000; % gram cm^-3 => kg m^-3
Expand All @@ -31,17 +31,17 @@ function test_ccmc(tc)
tc.assertEqual(ind.Ap, atmo.Ap)

tc.verifyEqual(A(1), atmo.altkm)
tc.verifyEqual(A(2), atmo.nO, 'RelTol', 0.01)
tc.verifyEqual(A(3), atmo.nN2, 'RelTol', 0.01)
tc.verifyEqual(A(4), atmo.nO2, 'RelTol', 0.01)
tc.verifyEqual(A(5), atmo.nTotal, 'RelTol', 0.01)
tc.verifyEqual(A(6), atmo.Tn, 'RelTol', 0.01)
tc.verifyEqual(A(7), atmo.Texo, 'RelTol', 0.01)
tc.verifyEqual(A(8), atmo.nHe, 'RelTol', 0.01)
tc.verifyEqual(A(9), atmo.nAr, 'RelTol', 0.01)
tc.verifyEqual(A(10), atmo.nH, 'RelTol', 0.01)
tc.verifyEqual(A(11), atmo.nN, 'RelTol', 0.01)
tc.verifyEqual(A(12), atmo.nOanomalous, 'RelTol', 0.01)
tc.verifyEqual(A(2), atmo.nO, RelTol=0.01)
tc.verifyEqual(A(3), atmo.nN2, RelTol=0.01)
tc.verifyEqual(A(4), atmo.nO2, RelTol=0.01)
tc.verifyEqual(A(5), atmo.nTotal, RelTol=0.01)
tc.verifyEqual(A(6), atmo.Tn, RelTol=0.01)
tc.verifyEqual(A(7), atmo.Texo, RelTol=0.01)
tc.verifyEqual(A(8), atmo.nHe, RelTol=0.01)
tc.verifyEqual(A(9), atmo.nAr, RelTol=0.01)
tc.verifyEqual(A(10), atmo.nH, RelTol=0.01)
tc.verifyEqual(A(11), atmo.nN, RelTol=0.01)
tc.verifyEqual(A(12), atmo.nOanomalous, RelTol=0.01)

end

Expand All @@ -50,16 +50,16 @@ function test_ccmc2(tc)
time = datetime(2018,5,17,21,0,0);
glat = 55;
glon = 120;
ind = struct("f107s", 72.6, "f107", 71.5, "Ap", 9.5);
ind = struct(f107s=72.6, f107=71.5, Ap=9.5);
altkm = 300.;

atmo = msise00.msise00(time, glat, glon, ind, altkm);

tc.verifyEqual(4.874e7, atmo.nN2 / 1e6, "RelTol", 0.01)
tc.verifyEqual(1.622e6, atmo.nO2 / 1e6, "RelTol", 0.01)
tc.verifyEqual(4.874e7, atmo.nN2 / 1e6, RelTol=0.01)
tc.verifyEqual(1.622e6, atmo.nO2 / 1e6, RelTol=0.01)

tc.verifyEqual(794.1, atmo.Tn, "RelTol", 0.01)
tc.verifyEqual(800, atmo.Texo, "RelTol", 0.01)
tc.verifyEqual(794.1, atmo.Tn, RelTol=0.01)
tc.verifyEqual(800, atmo.Texo, RelTol=0.01)

end

Expand All @@ -68,7 +68,7 @@ function test_plot_alt(tc)
time = datetime(2018,5,17,21,0,0);
glat = 55;
glon = 120;
ind = struct("f107s", 72.6, "f107", 71.5, "Ap", 9.5);
ind = struct(f107s=72.6, f107=71.5, Ap=9.5);
altkm = 300.;

atmo = msise00.msise00(time, glat, glon, ind, altkm);
Expand All @@ -85,7 +85,7 @@ function test_plot_time(tc)
time = datetime(2018,5,17,21,0,0);
glat = 55;
glon = 120;
ind = struct("f107s", 72.6, "f107", 71.5, "Ap", 9.5);
ind = struct(f107s=72.6, f107=71.5, Ap=9.5);
altkm = 300.;

atmo = msise00.msise00(time, glat, glon, ind, altkm);
Expand Down
2 changes: 1 addition & 1 deletion +msise00/private/cmake.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function cmake(src_dir)
assert(system("cmake --version") == 0, 'CMake not found')

cmd = "cmake -B" + build_dir + " -S" + src_dir;
if ispc && isempty(getenv("CMAKE_GENERATOR"))
if ispc && isenv("CMAKE_GENERATOR")
cmd = cmd + ' -G "MinGW Makefiles"';
end

Expand Down

0 comments on commit 0fa3862

Please sign in to comment.