Skip to content

Commit

Permalink
BICAS: findread: Consolidate, rename top-level function get_nominal_R…
Browse files Browse the repository at this point in the history
…CTDC()
  • Loading branch information
ErikPGJ committed Sep 5, 2024
1 parent 343402b commit 834bde6
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,38 @@
% CON: Testing this function is impossible anyway.
% CON: Conceptually bad. Makes function "less generic".

Rctdc = bicas.proc.L1L2.cal.RctdCollection();

%==========
% BIAS RCT
%==========
[biasRctPath, ~, ~] = bicas.proc.L1L2.cal.rct.findread.read_BRVF(rctDir, L);
BiasRctd = bicas.proc.L1L2.cal.rct.findread.read_RCT_modify_log(...
'BIAS', biasRctPath, L);
Rctdc.add_RCTD('BIAS', {BiasRctd});

%===============
% Non-BIAS RCTs
%===============
if useGactRct
Rctdc = bicas.proc.L1L2.cal.rct.findread.find_read_RCTs_by_BRVF_and_ZVCTI_GACT(...
NonBiasRctdCa = bicas.proc.L1L2.cal.rct.findread.find_read_RCTs_by_ZVCTI_GACT(...
nonBiasRcttid, rctDir, ...
gact, zvcti, zv_BW, ...
L);
gact, zvcti, ...
zv_BW, L);

Rctdc.add_RCTD(nonBiasRcttid, NonBiasRctdCa);
else
Rctdc = bicas.proc.L1L2.cal.rct.findread.find_read_RCTs_by_BRVF_and_regexp(...
NonBiasRctd = bicas.proc.L1L2.cal.rct.findread.find_read_nonBIAS_RCTs_by_regexp(...
nonBiasRcttid, rctDir, Bso, L);

Rctdc.add_RCTD(nonBiasRcttid, {NonBiasRctd});
end
end



% (1) Load one BIAS RCT using the BRVF, and
% (2) load one non-BIAS RCT by only using assumptions on filenames (and
% directory).
% Load one non-BIAS RCT by only using assumptions on filenames (and
% directory).
%
%
% NOTES
Expand All @@ -83,103 +99,24 @@
%
% RETURN VALUE
% ============
% Rctdc
% Returns RCTDC that can be used to initialize an instance
% of bicas.proc.L1L2.cal.Cal even if there is no ZVCTI+GACT.
% NOTE: Exactly one RCT per RCTTID.
% NonBiasRctd
% NOTE: Exactly one RCT (not cell array).
%
function Rctdc = find_read_RCTs_by_BRVF_and_regexp(...
function NonBiasRctd = find_read_nonBIAS_RCTs_by_regexp(...
nonBiasRcttid, rctDir, Bso, L)
assert(ischar(nonBiasRcttid) & ~strcmp(nonBiasRcttid, 'BIAS'))

Rctdc = bicas.proc.L1L2.cal.RctdCollection();

%==========
% BIAS RCT
%==========
[biasRctPath, ~, ~] = read_BRVF(rctDir, L);
BiasRctd = bicas.proc.L1L2.cal.rct.findread.read_RCT_modify_log(...
'BIAS', biasRctPath, L);
Rctdc.add_RCTD('BIAS', {BiasRctd});
assert(ischar(nonBiasRcttid) & ~strcmp(nonBiasRcttid, 'BIAS'))

%==============
% Non-BIAS RCT
%==============
% Find path to RCT.
settingKey = bicas.proc.L1L2.cal.rct.RctData.RCTD_METADATA_MAP(...
nonBiasRcttid).filenameRegexpSettingKey;

filenameRegexp = Bso.get_fv(settingKey);
filePath = bicas.proc.L1L2.cal.rct.findread.get_RCT_path_by_regexp(...
rctDir, filenameRegexp, L);

% Read RCT file.
NonBiasRctd = bicas.proc.L1L2.cal.rct.findread.read_RCT_modify_log(...
nonBiasRcttid, filePath, L);

% NOTE: Placing all non-BIAS RCT data inside 1x1 cell arrays so that
% they are stored analogously with when using L1R ZVCTI1+GACT.
Rctdc.add_RCTD(nonBiasRcttid, {NonBiasRctd});
end



% (1) Load one BIAS RCT by regular expression.
% (2) Load one or multiple non-BIAS RCT(s) for one selected RCTTID using
% ZVCTI, GACT, and ZV "BW".
%
%
% IMPLEMENTATION NOTE
% ===================
% May load MULTIPLE RCTs with the same RCTTID, but will only load those RCTs
% which are actually needed, as indicated by ZVCTI and ZV "BW". This is
% necessary since GACT may reference unnecessary RCTs of types not
% recognized by BICAS (LFR's ROC-SGSE_CAL_RCT-LFR-VHF_V01.cdf /2019-12-16),
% and which are therefore unreadable by BICAS (BICAS will crash).
%
%
% ARGUMENTS
% =========
% nonBiasRcttid
% RCTTID for one *non-BIAS* RCT.
% gact
% 1D cell array of strings.
% zvcti
% zv_BW
% Either
% (1) [] (as for TDS data), or
% (2) LFR input dataset zVariable BW.
%
%
% RETURN VALUE
% ============
% Rctdc
% Returns RCTDC that can be used to initialize an instance
% of bicas.proc.L1L2.cal.Cal.
%
function Rctdc = find_read_RCTs_by_BRVF_and_ZVCTI_GACT(...
nonBiasRcttid, rctDir, gact, zvcti, zv_BW, L)

assert(ischar(nonBiasRcttid) & ~strcmp(nonBiasRcttid, 'BIAS'))

Rctdc = bicas.proc.L1L2.cal.RctdCollection();

%==========
% BIAS RCT
%==========
[biasRctPath, ~, ~] = bicas.proc.L1L2.cal.rct.findread.read_BRVF(rctDir, L);
BiasRctd = bicas.proc.L1L2.cal.rct.findread.read_RCT_modify_log(...
'BIAS', biasRctPath, L);
Rctdc.add_RCTD('BIAS', {BiasRctd});

%=========================================
% Read potentially MULTIPLE NON-BIAS RCTs
%=========================================
NonBiasRctdCa = bicas.proc.L1L2.cal.rct.findread.find_read_RCTs_by_ZVCTI_GACT(...
nonBiasRcttid, rctDir, ...
gact, zvcti, ...
zv_BW, L);
Rctdc.add_RCTD(nonBiasRcttid, NonBiasRctdCa);
end


Expand Down Expand Up @@ -312,8 +249,17 @@



% Potentially reads MULTIPLE NON-BIAS RCTs (for the same RCTDID) from
% filenames indirectly specified by arguments "gact" and "zvcti".
% Load RCTs from filenames indirectly specified by arguments "gact" and
% "zvcti".
%
% IMPLEMENTATION NOTE
% ===================
% May load MULTIPLE RCTs with the same RCTTID, but will only load those
% RCTs which are actually needed, as indicated byGACT, ZVCTI and ZV "BW".
% This is necessary since GACT may reference unnecessary RCTs of types not
% recognized by BICAS (LFR's ROC-SGSE_CAL_RCT-LFR-VHF_V01.cdf /2019-12-16),
% and which are therefore unreadable by BICAS (BICAS will crash).
%
%
% ARGUMENTS
% =========
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
% The nominal use is that the caller first initializes (argument)
% RCTDC
% (1) by loading RCTs using
% bicas.proc.L1L2.cal.rct.findread.find_read_RCTs_by_BRVF_and_regexp(),
% bicas.proc.L1L2.cal.rct.findread.find_read_nonBIAS_RCTs_by_regexp(),
% (2) by loading RCT(s) using
% bicas.proc.L1L2.cal.rct.findread.find_read_RCTs_by_BRVF_and_ZVCTI_GACT()
% or
Expand Down

0 comments on commit 834bde6

Please sign in to comment.