Skip to content

Commit

Permalink
BICAS: Create bicas.ga (pkg for GA code)
Browse files Browse the repository at this point in the history
Mv bicas.gamods-->ga.mods.
Mv bicas.{-->ga.}derive_output_dataset_GAs

modified:   readme.txt
renamed:    src/+bicas/+gamods/Database.m -> src/+bicas/+ga/+mods/Database.m
renamed:    src/+bicas/+gamods/Database___UTEST.m -> src/+bicas/+ga/+mods/Database___UTEST.m
renamed:    src/+bicas/+gamods/DsiEntry.m -> src/+bicas/+ga/+mods/DsiEntry.m
renamed:    src/+bicas/+gamods/DsiEntry___UTEST.m -> src/+bicas/+ga/+mods/DsiEntry___UTEST.m
renamed:    src/+bicas/+gamods/VersionEntry.m -> src/+bicas/+ga/+mods/VersionEntry.m
renamed:    src/+bicas/+gamods/VersionEntry___UTEST.m -> src/+bicas/+ga/+mods/VersionEntry___UTEST.m
renamed:    src/+bicas/derive_output_dataset_GAs.m -> src/+bicas/+ga/derive_output_dataset_GAs.m
modified:   src/+bicas/+tools/+rct/create_RCT.m
modified:   src/+bicas/+vht/generate_VHT_dataset.m
modified:   src/+bicas/const.m
modified:   src/+bicas/execute_SWM.m
  • Loading branch information
ErikPGJ committed Jul 23, 2024
1 parent 19d6e06 commit 1a32adf
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 88 deletions.
6 changes: 3 additions & 3 deletions mission/solar_orbiter/bicas/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ FV
GA
(CDF) Global Attribute(s).
GMDB
"GA MODS DataBase", i.e. class bicas.gamods.Database.
"GA MODS DataBase", i.e. class bicas.ga.mods.Database.
GMDE
"GA MODS DSI Entry", i.e. class bicas.gamods.DsiEntry.
"GA MODS DSI Entry", i.e. class bicas.ga.mods.DsiEntry.
GMVE
"GA MODS Version Entry", i.e. class bicas.gamods.VersionEntry.
"GA MODS Version Entry", i.e. class bicas.ga.mods.VersionEntry.
ICD
Interface Control Document
ITF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
% (1) with a lot of overlap between dataset IDs and entries, and
% (2) that conforms to certain format specified by the RCS ICD.
%
% Contains map DSI-->bicas.gamods.DsiEntry.
% Contains map DSI-->bicas.ga.mods.DsiEntry.
%
% MUTABLE. HANDLE CLASS.
%
Expand Down Expand Up @@ -43,7 +43,7 @@


% Constructor. Creates database which is initialized with empty
% bicas.gamods.DsiEntry for specified DSIs.
% bicas.ga.mods.DsiEntry for specified DSIs.
function obj = Database(dsiCa)
obj.DsiGmdeMap = containers.Map('KeyType', 'char', 'ValueType', 'Any');

Expand All @@ -63,7 +63,7 @@

% NOTE: Effectively (additional) assertion on that "dsi" is a
% valid key.
obj.DsiGmdeMap(dsi) = bicas.gamods.DsiEntry();
obj.DsiGmdeMap(dsi) = bicas.ga.mods.DsiEntry();
end

end
Expand All @@ -73,7 +73,7 @@
% Add one GMVE to multiple DSIs.
function add_GMVE(obj, dsiCa, Gmve)
irf.assert.castring_set(dsiCa)
assert(isa(Gmve, 'bicas.gamods.VersionEntry'))
assert(isa(Gmve, 'bicas.ga.mods.VersionEntry'))

for i = 1:numel(dsiCa)
dsi = dsiCa{i};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%
% matlab.unittest automatic test code for bicas.gamods.Database.
% matlab.unittest automatic test code for bicas.ga.mods.Database.
%
%
% Author: Erik P G Johansson, IRF, Uppsala, Sweden
Expand All @@ -22,8 +22,8 @@ function test0(testCase)
% Constructor
% ===========

Gmdb = bicas.gamods.Database({});
Gmdb = bicas.gamods.Database({'DSI_1', 'DSI_2'});
Gmdb = bicas.ga.mods.Database({});
Gmdb = bicas.ga.mods.Database({'DSI_1', 'DSI_2'});



Expand All @@ -32,16 +32,16 @@ function test0(testCase)
% ==========

% Add GMVE to zero DSIs.
Gmve0 = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment for zero DSIs.'});
Gmve0 = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment for zero DSIs.'});
Gmdb.add_GMVE({}, Gmve0)

% Add to one DSI.
Gmve1 = bicas.gamods.VersionEntry('2020-01-01', '3.0.0', {...
Gmve1 = bicas.ga.mods.VersionEntry('2020-01-01', '3.0.0', {...
'Comment1.'});
Gmdb.add_GMVE({'DSI_1'}, Gmve1)

% Add to two DSIs.
Gmve2 = bicas.gamods.VersionEntry('2021-01-01', '4.0.0', {...
Gmve2 = bicas.ga.mods.VersionEntry('2021-01-01', '4.0.0', {...
'Comment2.'});
Gmdb.add_GMVE({'DSI_1', 'DSI_2'}, Gmve2)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%
% Class that represents the GA "MODS" information for one DSI.
% Contains list of instances of bicas.gamods.VersionEntry.
% Contains list of instances of bicas.ga.mods.VersionEntry.
%
%
% MUTABLE. HANDLE CLASS.
Expand Down Expand Up @@ -35,7 +35,7 @@


function obj = DsiEntry()
obj.GmveAr = bicas.gamods.VersionEntry.empty(0, 1);
obj.GmveAr = bicas.ga.mods.VersionEntry.empty(0, 1);
end


Expand All @@ -58,7 +58,7 @@
% NOTE: There is no constraint on the BICAS version number(!).
function add_GMVE(obj, GmveNew)

assert(isa(GmveNew, 'bicas.gamods.VersionEntry'))
assert(isa(GmveNew, 'bicas.ga.mods.VersionEntry'))

if isempty(obj.GmveAr)
obj.GmveAr(1, 1) = GmveNew;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%
% matlab.unittest automatic test code for bicas.gamods.DsiEntry.
% matlab.unittest automatic test code for bicas.ga.mods.DsiEntry.
%
%
% Author: Erik P G Johansson, IRF, Uppsala, Sweden
Expand All @@ -18,9 +18,9 @@


function test_add_GMVE___one(testCase)
Gmde = bicas.gamods.DsiEntry();
Gmde = bicas.ga.mods.DsiEntry();

Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment1.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment1.'});
Gmde.add_GMVE(Gmve)

actStrCa = Gmde.get_MODS_strings_CA();
Expand All @@ -33,13 +33,13 @@ function test_add_GMVE___one(testCase)


function test_add_GMVE___reuse_date(testCase)
Gmde = bicas.gamods.DsiEntry();
Gmde = bicas.ga.mods.DsiEntry();

Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmde.add_GMVE(Gmve)

% Add entry with reused date (different BICAS version).
Gmve = bicas.gamods.VersionEntry('2020-01-01', '2.0.0', {'Comment 2.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '2.0.0', {'Comment 2.'});
Gmde.add_GMVE(Gmve)

actStrCa = Gmde.get_MODS_strings_CA();
Expand All @@ -53,13 +53,13 @@ function test_add_GMVE___reuse_date(testCase)


function test_add_GMVE___reuse_BICAS_version(testCase)
Gmde = bicas.gamods.DsiEntry();
Gmde = bicas.ga.mods.DsiEntry();

Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmde.add_GMVE(Gmve)

% Add entry with reused BICAS version (different date).
Gmve = bicas.gamods.VersionEntry('2021-01-01', '1.0.0', {'Comment 2.'});
Gmve = bicas.ga.mods.VersionEntry('2021-01-01', '1.0.0', {'Comment 2.'});
Gmde.add_GMVE(Gmve)

actStrCa = Gmde.get_MODS_strings_CA();
Expand All @@ -74,14 +74,14 @@ function test_add_GMVE___reuse_BICAS_version(testCase)

% First and second GMDE have identical dates and BICAS version.
function test_add_GMVE___reuse_date_BICAS_version_1(testCase)
Gmde = bicas.gamods.DsiEntry();
Gmde = bicas.ga.mods.DsiEntry();

% Add entry.
Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmde.add_GMVE(Gmve)

% Add entry with reused date and BICAS version.
Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment 2.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment 2.'});
Gmde.add_GMVE(Gmve)

actStrCa = Gmde.get_MODS_strings_CA();
Expand All @@ -95,16 +95,16 @@ function test_add_GMVE___reuse_date_BICAS_version_1(testCase)
% second and third GMDE have identical dates and BICAS version, i.e.
% there is another GMDE not involved in the merger of GMDEs.
function test_add_GMVE___reuse_date_BICAS_version_2(testCase)
Gmde = bicas.gamods.DsiEntry();
Gmde = bicas.ga.mods.DsiEntry();

% Add entry.
Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmde.add_GMVE(Gmve)
Gmve = bicas.gamods.VersionEntry('2021-01-01', '2.0.0', {'Comment 2.'});
Gmve = bicas.ga.mods.VersionEntry('2021-01-01', '2.0.0', {'Comment 2.'});
Gmde.add_GMVE(Gmve)

% Add entry with reused date and BICAS version.
Gmve = bicas.gamods.VersionEntry('2021-01-01', '2.0.0', {'Comment 3.'});
Gmve = bicas.ga.mods.VersionEntry('2021-01-01', '2.0.0', {'Comment 3.'});
Gmde.add_GMVE(Gmve)

actStrCa = Gmde.get_MODS_strings_CA();
Expand All @@ -119,21 +119,21 @@ function test_add_GMVE___reuse_date_BICAS_version_2(testCase)

function test_add_GMVE___reuse_date_illegal(testCase)

Gmde = bicas.gamods.DsiEntry();
Gmde = bicas.ga.mods.DsiEntry();

Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.0.0', {'Comment 1.'});
Gmde.add_GMVE(Gmve)

% Add entry with reused date (different BICAS version).
Gmve = bicas.gamods.VersionEntry('2020-01-01', '2.0.0', {'Comment 2.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '2.0.0', {'Comment 2.'});
Gmde.add_GMVE(Gmve)

% Add entry with reused BICAS version (different date).
Gmve = bicas.gamods.VersionEntry('2021-01-01', '2.0.0', {'Comment 3.'});
Gmve = bicas.ga.mods.VersionEntry('2021-01-01', '2.0.0', {'Comment 3.'});
Gmde.add_GMVE(Gmve)

% Add entry with reused date (non-last) and BICAS version -- ILLEGAL
Gmve = bicas.gamods.VersionEntry('2020-01-01', '2.0.0', {'Comment 4.'});
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '2.0.0', {'Comment 4.'});
testCase.assertError(...
@() Gmde.add_GMVE(Gmve), ...
?MException)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%
% Class that represents the data in one GA "MODS" entry for one unique
% combination of (1) DSI and (2) dataset version. One such entry can then be
% "applied" to multiple DSIs via bicas.gamods.Database. One entry contains a
% "applied" to multiple DSIs via bicas.ga.mods.Database. One entry contains a
% date (of a BICAS version), a BICAS version number, and a list of comments. One
% entry does NOT contain the DSI or dataset version. That is for the owner of
% the object to store.
Expand Down Expand Up @@ -43,7 +43,7 @@
'20[1-9][0-9]-[0-1][0-9]-[0-3][0-9]')
% NOTE: Version string without initial "V".
irf.assert.castring_regexp(bicasVersionStr, '[0-9]+.[0-9]+.[0-9]+')
bicas.gamods.VersionEntry.assert_commentsCa(commentsCa)
bicas.ga.mods.VersionEntry.assert_commentsCa(commentsCa)

obj.dateStr = dateStr;
obj.bicasVersionStr = bicasVersionStr;
Expand All @@ -54,7 +54,7 @@

% NOTE: Does not modify the object, but returns a modified object(!).
function obj = add_comments(obj, commentsCa)
obj = bicas.gamods.VersionEntry(...
obj = bicas.ga.mods.VersionEntry(...
obj.dateStr, obj.bicasVersionStr, ...
[obj.commentsCa; commentsCa(:)]);
end
Expand All @@ -78,7 +78,7 @@
assert(strcmp(obj1.dateStr, obj2.dateStr))
assert(strcmp(obj1.bicasVersionStr, obj2.bicasVersionStr))

obj = bicas.gamods.VersionEntry(obj1.dateStr, obj1.bicasVersionStr, ...
obj = bicas.ga.mods.VersionEntry(obj1.dateStr, obj1.bicasVersionStr, ...
[obj1.commentsCa; obj2.commentsCa]);
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%
% matlab.unittest automatic test code for bicas.gamods.VersionEntry.
% matlab.unittest automatic test code for bicas.ga.mods.VersionEntry.
%
%
% Author: Erik P G Johansson, IRF, Uppsala, Sweden
Expand All @@ -24,15 +24,15 @@ function test_constructor(testCase)

function test_constructor_exc(varargin)
testCase.verifyError(...
@() bicas.gamods.VersionEntry(varargin{:}), ...
@() bicas.ga.mods.VersionEntry(varargin{:}), ...
?MException)
end
end



function test_add_comments(testCase)
Gmve1 = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {'Comment1.'});
Gmve1 = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {'Comment1.'});
Gmve2 = Gmve1.add_comments({'Comment2.'});

testCase.verifyEqual(Gmve1.bicasVersionStr, Gmve2.bicasVersionStr)
Expand All @@ -41,24 +41,24 @@ function test_add_comments(testCase)
testCase.verifyEqual(Gmve1.commentsCa, {'Comment1.'})
testCase.verifyEqual(Gmve2.commentsCa, {'Comment1.'; 'Comment2.'})

testCase.verifyError(@() bicas.gamods.VersionEntry('2020-01-01', '1.2.3', ...
testCase.verifyError(@() bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', ...
{}), ...
?MException)
testCase.verifyError(@() bicas.gamods.VersionEntry('2020-01-01', '1.2.3', ...
testCase.verifyError(@() bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', ...
{'Comment without trailing period'}), ...
?MException)
end



function test_get_str(testCase)
Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {...
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {...
'A first comment.'});
actStr = Gmve.get_str();
expStr = '2020-01-01 -- V1.2.3 -- A first comment.';
testCase.verifyEqual(actStr, expStr)

Gmve = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {...
Gmve = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {...
'A first comment.', 'A second comment.'});
actStr = Gmve.get_str();
expStr = '2020-01-01 -- V1.2.3 -- A first comment. | A second comment.';
Expand All @@ -71,11 +71,11 @@ function test_plus_legal(testCase)
% NOTE: Class has assertions against duplicated comment strings and
% submitting zero comment strings. Can therefore not that in tests.

GMVE_1 = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {...
GMVE_1 = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {...
'Comment 1.'});
GMVE_2 = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {...
GMVE_2 = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {...
'Comment 2.'});
GMVE_3 = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {...
GMVE_3 = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {...
'Comment 3a.', 'Comment 3b.'});

GMVE_4 = GMVE_1 + GMVE_2;
Expand Down Expand Up @@ -105,16 +105,16 @@ function test_exc(GmveA, GmveB)
end

% Incompatible date strings.
GMVE_1 = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {...
GMVE_1 = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {...
'Comment 1.'});
GMVE_2 = bicas.gamods.VersionEntry('2020-01-02', '1.2.3', {...
GMVE_2 = bicas.ga.mods.VersionEntry('2020-01-02', '1.2.3', {...
'Comment 2.'});
test_exc(GMVE_1, GMVE_2)

% Incompatible BICAS version numbers.
GMVE_3 = bicas.gamods.VersionEntry('2020-01-01', '1.2.3', {...
GMVE_3 = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.3', {...
'Comment 1.'});
GMVE_4 = bicas.gamods.VersionEntry('2020-01-01', '1.2.9', {...
GMVE_4 = bicas.ga.mods.VersionEntry('2020-01-01', '1.2.9', {...
'Comment 2.'});
test_exc(GMVE_3, GMVE_4)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
Bso, L)

% PROPOSAL: Automatic test code.
% PROPOSAL: Replace this function with class/package for separate (public)
% functions.
%
% PROPOSAL: Create class for storing GAs.
% PRO: Can detect accidental overwriting/reuse of keys.
Expand Down Expand Up @@ -206,7 +204,6 @@



% Set GA "Parents".
function Parents = get_GA_Parents(InputDatasetsMap)

Parents = {};
Expand All @@ -230,7 +227,6 @@



% Set GA "SPICE_KERNELS".
function SPICE_KERNELS = get_GA_SPICE_KERNELS(InputDatasetsMap)

keysCa = InputDatasetsMap.keys;
Expand Down
Loading

0 comments on commit 1a32adf

Please sign in to comment.