Skip to content

Commit

Permalink
BICAS: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikPGJ committed Sep 16, 2024
1 parent ec52715 commit 7243eda
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
% See readme.txt for example description of the directory structure in an RCS
% test data package.
%
% ~BUG: For letter versions other than "A", release_notes.txt will only contain
% a reference to the specified version and not previous ones.
%
%
% ARGUMENTS
% =========
% outputParentDir
% letterVersion
% One capital letter to be used in the test package version.
% NOTE: The BICAS version is automatically used.
% One capital letter to be used in the test package version. The first
% RTDP for any given BICAS version must be "A", the second "B" and so on.
% NOTE: The BICAS version does not need to specified since it is
% automatically obtained from BICAS (bicas.const).
% configFile
% JSON file with (1) paths to input CDFs, and (2) expected BICAS source
% directory. See bicas.tools.rtdp.misc___UTEST.create_config_file()
Expand All @@ -31,7 +36,7 @@
%
%
% Author: Erik P G Johansson, IRF, Uppsala, Sweden
function create_RCS_test_data_package(outputParentDir, letterVersion, configFile)
function rtdpDir = create_RCS_test_data_package(outputParentDir, letterVersion, configFile)
% bicas.tools.rtdp.create_RCS_test_data_package('/nonhome_data/SOLAR_ORBITER/bicas_test_packages/temp', 'A', '/nonhome_data/work_files/SOLAR_ORBITER/rtdp_config.json')
%
% PROPOSAL: Better name for function.
Expand All @@ -51,6 +56,6 @@ function create_RCS_test_data_package(outputParentDir, letterVersion, configFile
% rcstdpkg (TD = Test Data)
% rtdp (= RCS Test Data Package)

bicas.tools.rtdp.misc.create_RCS_test_data_package(...
outputParentDir, letterVersion, configFile, false)
rtdpDir = bicas.tools.rtdp.misc.create_RCS_test_data_package(...
outputParentDir, letterVersion, configFile, false);
end
21 changes: 11 additions & 10 deletions mission/solar_orbiter/bicas/src/+bicas/+tools/+rtdp/misc.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
% (or a function handle), which would then be mocked for tests, which
% would be overkill for this application.
%
function create_RCS_test_data_package( ...
function rtdpDir = create_RCS_test_data_package( ...
outputParentDir, letterVersion, configFile, automatedTestRun)
%
% PROPOSAL: Separate function file.
Expand All @@ -58,6 +58,7 @@ function create_RCS_test_data_package( ...
% https://se.mathworks.com/help/matlab/ref/zip.html
% PROPOSAL: Separate command.
% CON: ~Superfluous?
% PROPOSAL: Flag
%
% PROPOSAL: Use bicas.tools.batch functionality.
% Ex: bicas.tools.batch.autocreate_input_BPCIs()
Expand Down Expand Up @@ -123,16 +124,16 @@ function create_RCS_test_data_package( ...
end

% Create root directory.
pkgDirName = bicas.tools.rtdp.misc.create_test_package_directory_name(letterVersion);
pkgDir = bicas.tools.rtdp.misc.mkdir(outputParentDir, pkgDirName);
rtdpDirName = bicas.tools.rtdp.misc.create_RTDP_directory_name(letterVersion);
rtdpDir = bicas.tools.rtdp.misc.mkdir(outputParentDir, rtdpDirName);

bicas.tools.rtdp.misc.create_readme_file(pkgDir)
bicas.tools.rtdp.misc.create_release_notes_file(pkgDir, letterVersion)
bicas.tools.rtdp.misc.create_readme_file(rtdpDir)
bicas.tools.rtdp.misc.create_release_notes_file(rtdpDir, letterVersion)

for iSwm = 1:numel(Swml.List)
Swm = Swml.List(iSwm);

bicas.tools.rtdp.misc.create_SWM_directory(pkgDir, Swm, Config, automatedTestRun)
bicas.tools.rtdp.misc.create_SWM_directory(rtdpDir, Swm, Config, automatedTestRun)
end

end
Expand Down Expand Up @@ -212,13 +213,13 @@ function create_SWM_directory(parentDir, Swm, Config, automatedTestRun)



function pkgDirName = create_test_package_directory_name(letterVersion)
function rtdpDirName = create_RTDP_directory_name(letterVersion)
irf.assert.castring_regexp(letterVersion, '[A-Z]')

% Ex: TESTDATA_RODP_BICAS_V8.2.1A
bicasVerStr = bicas.const.SWD_METADATA('SWD.release.version');

pkgDirName = sprintf('TESTDATA_RODP_BICAS_V%s%s', bicasVerStr, letterVersion);
rtdpDirName = sprintf('TESTDATA_RODP_BICAS_V%s%s', bicasVerStr, letterVersion);
end


Expand All @@ -227,7 +228,7 @@ function create_SWM_directory(parentDir, Swm, Config, automatedTestRun)
newDirPath = fullfile(parentDir, dirName);

% IMPLEMENTATION NOTE: Checking for pre-existing directory for preventing
% the user from overwriting(?) a pre-existing test package.
% the user from overwriting(?) a pre-existing RTDP directory.
irf.assert.path_is_available(newDirPath)

[success, message, errorMessageId] = mkdir(parentDir, dirName);
Expand Down Expand Up @@ -257,7 +258,7 @@ function create_manifest_file(datasetDir, inputFilenamesCa, cohbCa)


function create_readme_file(parentDir)
s = sprintf('Contact person; %s', bicas.tools.rtdp.misc.CONTACT_PERSON);
s = sprintf('Contact person; %s\n', bicas.tools.rtdp.misc.CONTACT_PERSON);

readmePath = fullfile(parentDir, "readme.txt");
irf.fs.write_file(readmePath, uint8(s)')
Expand Down
11 changes: 8 additions & 3 deletions mission/solar_orbiter/bicas/src/+bicas/+tools/+rtdp/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
===========================================
EXAMPLE DIRECTORY TREE FOR RCS TEST PACKAGE
===========================================
MATLAB package for creating RTDPs. See
bicas.tools.rtdp.create_RCS_test_data_package().


==========================================================
EXAMPLE DIRECTORY TREE FOR AN RCS TEST DATA PACKAGE (RTDP)
==========================================================

TESTDATA_RODP_BICAS_V8.2.1A
├── LFR-SBM1-CWF-E
│ ├── expected_outputs
Expand Down

0 comments on commit 7243eda

Please sign in to comment.