Skip to content

Commit

Permalink
decArgo_20220406_048a commit
Browse files Browse the repository at this point in the history
  • Loading branch information
couppeym committed Nov 24, 2022
1 parent c8726c0 commit 8bfdfd9
Show file tree
Hide file tree
Showing 54 changed files with 5,855 additions and 1,307 deletions.
Binary file not shown.
Binary file modified decArgo_doc/decoder_versions/_argo_decoder_versions.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"TEST020_QUESTIONABLE_ARGOS_POSITION" : "1",
"TEST021_NS_UNPUMPED_SALINITY" : "1",
"TEST022_NS_MIXED_AIR_WATER" : "1",
"TEST023_DEEP_FLOAT" : "1",
"TEST023_DEEP_FLOAT" : "1",
"TEST024_RBR_FLOAT" : "1",
"TEST025_MEDD" : "1",
"TEST057_DOXY" : "1",
"TEST059_NITRATE" : "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"TEST021_NS_UNPUMPED_SALINITY" : "1",
"TEST022_NS_MIXED_AIR_WATER" : "1",
"TEST023_DEEP_FLOAT" : "1",
"TEST024_RBR_FLOAT" : "1",
"TEST025_MEDD" : "1",
"TEST057_DOXY" : "1",
"TEST059_NITRATE" : "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"TEST021_NS_UNPUMPED_SALINITY" : "1",
"TEST022_NS_MIXED_AIR_WATER" : "1",
"TEST023_DEEP_FLOAT" : "1",
"TEST024_RBR_FLOAT" : "1",
"TEST025_MEDD" : "1",
"TEST057_DOXY" : "1",
"TEST059_NITRATE" : "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"TEST021_NS_UNPUMPED_SALINITY" : "1",
"TEST022_NS_MIXED_AIR_WATER" : "1",
"TEST023_DEEP_FLOAT" : "1",
"TEST024_RBR_FLOAT" : "1",
"TEST025_MEDD" : "1",
"TEST057_DOXY" : "1",
"TEST059_NITRATE" : "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ TEST020_QUESTIONABLE_ARGOS_POSITION = 1
TEST021_NS_UNPUMPED_SALINITY = 1
TEST022_NS_MIXED_AIR_WATER = 1
TEST023_DEEP_FLOAT = 1
TEST024_RBR_FLOAT = 1
TEST025_MEDD = 1
TEST057_DOXY = 1
TEST059_NITRATE = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ TEST020_QUESTIONABLE_ARGOS_POSITION = 1
TEST021_NS_UNPUMPED_SALINITY = 1
TEST022_NS_MIXED_AIR_WATER = 1
TEST023_DEEP_FLOAT = 1
TEST024_RBR_FLOAT = 1
TEST025_MEDD = 1
TEST057_DOXY = 1
TEST059_NITRATE = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ TEST020_QUESTIONABLE_ARGOS_POSITION = 1
TEST021_NS_UNPUMPED_SALINITY = 1
TEST022_NS_MIXED_AIR_WATER = 1
TEST023_DEEP_FLOAT = 1
TEST024_RBR_FLOAT = 1
TEST025_MEDD = 1
TEST057_DOXY = 1
TEST059_NITRATE = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ TEST020_QUESTIONABLE_ARGOS_POSITION = 1
TEST021_NS_UNPUMPED_SALINITY = 1
TEST022_NS_MIXED_AIR_WATER = 1
TEST023_DEEP_FLOAT = 1
TEST024_RBR_FLOAT = 1
TEST025_MEDD = 1
TEST057_DOXY = 1
TEST059_NITRATE = 1
Expand Down
1 change: 1 addition & 0 deletions decArgo_soft/soft/_argo_decoder_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"TEST021_NS_UNPUMPED_SALINITY" : "1",
"TEST022_NS_MIXED_AIR_WATER" : "1",
"TEST023_DEEP_FLOAT" : "1",
"TEST024_RBR_FLOAT" : "1",
"TEST025_MEDD" : "1",
"TEST057_DOXY" : "1",
"TEST059_NITRATE" : "1",
Expand Down
1 change: 1 addition & 0 deletions decArgo_soft/soft/_argo_decoder_conf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ TEST020_QUESTIONABLE_ARGOS_POSITION = 1
TEST021_NS_UNPUMPED_SALINITY = 1
TEST022_NS_MIXED_AIR_WATER = 1
TEST023_DEEP_FLOAT = 1
TEST024_RBR_FLOAT = 1
TEST025_MEDD = 1
TEST057_DOXY = 1
TEST059_NITRATE = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function add_rtqc_flags_to_netcdf_profile_and_trajectory_data(a_reportStruct, a_
global g_decArgo_rtqcTest21;
global g_decArgo_rtqcTest22;
global g_decArgo_rtqcTest23;
global g_decArgo_rtqcTest24;
global g_decArgo_rtqcTest25;
global g_decArgo_rtqcTest57;
global g_decArgo_rtqcTest59;
Expand Down Expand Up @@ -93,6 +94,7 @@ function add_rtqc_flags_to_netcdf_profile_and_trajectory_data(a_reportStruct, a_
{'TEST021_NS_UNPUMPED_SALINITY'} {g_decArgo_rtqcTest21} ...
{'TEST022_NS_MIXED_AIR_WATER'} {g_decArgo_rtqcTest22} ...
{'TEST023_DEEP_FLOAT'} {g_decArgo_rtqcTest23} ...
{'TEST024_RBR_FLOAT'} {g_decArgo_rtqcTest24} ...
{'TEST025_MEDD'} {g_decArgo_rtqcTest25} ...
{'TEST057_DOXY'} {g_decArgo_rtqcTest57} ...
{'TEST059_NITRATE'} {g_decArgo_rtqcTest59} ...
Expand All @@ -108,6 +110,7 @@ function add_rtqc_flags_to_netcdf_profile_and_trajectory_data(a_reportStruct, a_
{'TEST015_GREY_LIST_FILE'} {g_decArgo_rtqcGreyList} ...
{'TEST019_METADA_DATA_FILE'} {''} ...
{'TEST021_METADA_DATA_FILE'} {''} ...
{'TEST024_METADA_DATA_FILE'} {''} ...
{'TEST057_METADA_DATA_FILE'} {''} ...
{'TEST062_DARK_BBP700_O'} {''} ...
{'TEST062_DARK_BBP352_O'} {''} ...
Expand Down Expand Up @@ -165,6 +168,21 @@ function add_rtqc_flags_to_netcdf_profile_and_trajectory_data(a_reportStruct, a_
end
end

if (test_to_perform('TEST024_RBR_FLOAT', testToPerformList) == 1)

% add meta file path name
ncMetaFileName = sprintf('%d_meta.nc', floatNum);
ncMetaFilePathName = [g_decArgo_dirOutputNetcdfFile '/' floatNumStr '/' ncMetaFileName];
if ~(exist(ncMetaFilePathName, 'file') == 2)
fprintf('RTQC_WARNING: TEST024: Float #%d: No meta file to perform test#24\n', floatNum);
else
idVal = find(strcmp('TEST024_METADA_DATA_FILE', testMetaData) == 1);
if (~isempty(idVal))
testMetaData{idVal+1} = ncMetaFilePathName;
end
end
end

if (test_to_perform('TEST057_DOXY', testToPerformList) == 1)

% add meta file path name
Expand Down
175 changes: 164 additions & 11 deletions decArgo_soft/soft/sub/add_rtqc_to_profile_file.m
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@
% trajectory
% 01/03/2022 - RNU - V 5.7: Exclude NaN values from get_gebco_elev_point
% output
% 04/04/2022 - RNU - V 5.8: Updated to cope with version 3.6 of Argo Quality
% Control Manual for CTD and Trajectory Data
% TEST #24: set PSAL_QC = '3' for pre-april 2021 RBR
% floats (list g_decArgo_rbrPreApril2021FloatList)
% TEST #19: revised version of Deeepest Pressure Test
% ------------------------------------------------------------------------------
function add_rtqc_to_profile_file(a_floatNum, ...
a_ncMonoProfInputPathFileName, a_ncMonoProfOutputPathFileName, ...
Expand Down Expand Up @@ -234,12 +239,15 @@ function add_rtqc_to_profile_file(a_floatNum, ...
global g_decArgo_decoderIdListBgcFloatAll;
global g_decArgo_decoderIdListProfWithDatedLev;

% list of pre-april 2021 RBR floats
global g_decArgo_rbrPreApril2021FloatList;

% temporary trajectory data
global g_rtqc_trajData;

% program version
global g_decArgo_addRtqcToProfileVersion;
g_decArgo_addRtqcToProfileVersion = '5.7';
g_decArgo_addRtqcToProfileVersion = '5.8';

% Argo data start date
janFirst1997InJulD = gregorian_2_julian_dec_argo('1997/01/01 00:00:00');
Expand Down Expand Up @@ -340,6 +348,7 @@ function add_rtqc_to_profile_file(a_floatNum, ...
{'TEST021_NS_UNPUMPED_SALINITY'} ...
{'TEST022_NS_MIXED_AIR_WATER'} ...
{'TEST023_DEEP_FLOAT'} ...
{'TEST024_RBR_FLOAT'} ...
{'TEST025_MEDD'} ...
{'TEST057_DOXY'} ...
{'TEST059_NITRATE'} ...
Expand Down Expand Up @@ -481,7 +490,7 @@ function add_rtqc_to_profile_file(a_floatNum, ...
testFlagList(15) = 0;
end
else
fprintf('RTQC_WARNING: TEST005: Float #%d: Grey list file needed to perform test #15 - test #15 not performed\n', ...
fprintf('RTQC_WARNING: TEST015: Float #%d: Grey list file needed to perform test #15 - test #15 not performed\n', ...
a_floatNum);
testFlagList(15) = 0;
end
Expand Down Expand Up @@ -627,12 +636,12 @@ function add_rtqc_to_profile_file(a_floatNum, ...
if (~isempty(testMetaId))
ncMetaPathFileName = a_testMetaData{testMetaId+1};
if ~(exist(ncMetaPathFileName, 'file') == 2)
fprintf('RTQC_WARNING: TEST021: Float #%d: Nc meta-data file (%s) not found - test #19 not performed\n', ...
fprintf('RTQC_WARNING: TEST021: Float #%d: Nc meta-data file (%s) not found - test #21 not performed\n', ...
a_floatNum, ncMetaPathFileName);
testFlagList(21) = 0;
end
else
fprintf('RTQC_WARNING: TEST021: Float #%d: Nc meta-data file needed to perform test #19 - test #19 not performed\n', ...
fprintf('RTQC_WARNING: TEST021: Float #%d: Nc meta-data file needed to perform test #21 - test #21 not performed\n', ...
a_floatNum);
testFlagList(21) = 0;
end
Expand Down Expand Up @@ -728,6 +737,84 @@ function add_rtqc_to_profile_file(a_floatNum, ...
end
end

if (testFlagList(24) == 1)
% for pre-april 2021 RBR floats, we need the nc meta-data file path name
testMetaId = find(strcmp('TEST024_METADA_DATA_FILE', a_testMetaData) == 1);
if (~isempty(testMetaId))
ncMetaPathFileName = a_testMetaData{testMetaId+1};
if ~(exist(ncMetaPathFileName, 'file') == 2)
fprintf('RTQC_WARNING: TEST024: Float #%d: Nc meta-data file (%s) not found - test #24 not performed\n', ...
a_floatNum, ncMetaPathFileName);
testFlagList(24) = 0;
end
else
fprintf('RTQC_WARNING: TEST024: Float #%d: Nc meta-data file needed to perform test #24 - test #24 not performed\n', ...
a_floatNum);
testFlagList(24) = 0;
end

if (testFlagList(24) == 1)
% retrieve information from NetCDF meta file
wantedVars = [ ...
{'PARAMETER'} ...
{'PARAMETER_SENSOR'} ...
{'SENSOR'} ...
{'SENSOR_MODEL'} ...
];

% retrieve information from NetCDF meta file
[ncMetaData] = get_data_from_nc_file(ncMetaPathFileName, wantedVars);

if (isempty(parameterMeta))
parameterMeta = [];
idVal = find(strcmp('PARAMETER', ncMetaData) == 1);
if (~isempty(idVal))
parameterMetaTmp = ncMetaData{idVal+1}';

for id = 1:size(parameterMetaTmp, 1)
parameterMeta{end+1} = deblank(parameterMetaTmp(id, :));
end
end
end

if (isempty(parameterSensorMeta))
parameterSensorMeta = [];
idVal = find(strcmp('PARAMETER_SENSOR', ncMetaData) == 1);
if (~isempty(idVal))
parameterSensorMetaTmp = ncMetaData{idVal+1}';

for id = 1:size(parameterSensorMetaTmp, 1)
parameterSensorMeta{end+1} = deblank(parameterSensorMetaTmp(id, :));
end
end
end

if (isempty(sensorMeta))
sensorMeta = [];
idVal = find(strcmp('SENSOR', ncMetaData) == 1);
if (~isempty(idVal))
sensorMetaTmp = ncMetaData{idVal+1}';

for id = 1:size(sensorMetaTmp, 1)
sensorMeta{end+1} = deblank(sensorMetaTmp(id, :));
end
end
end

if (isempty(sensorModelMeta))
sensorModelMeta = [];
idVal = find(strcmp('SENSOR_MODEL', ncMetaData) == 1);
if (~isempty(idVal))
sensorModelMetaTmp = ncMetaData{idVal+1}';

for id = 1:size(sensorModelMetaTmp, 1)
sensorModelMeta{end+1} = deblank(sensorModelMetaTmp(id, :));
end
end
end
end
end

if (testFlagList(57) == 1)
% for DOXY specific test, we need to identify BGC floats
if (~isempty(floatDecoderId) && ~isempty(g_decArgo_decoderIdListBgcFloatAll))
Expand Down Expand Up @@ -2007,7 +2094,7 @@ function add_rtqc_to_profile_file(a_floatNum, ...
% apply the test
if (~isempty(idToFlag))
idToFlagParam = idNoDef(find(ismember(idNoDef, idToFlag) == 1));
paramDataQc(idProf, idToFlagParam) = set_qc(paramDataQc(idProf, idToFlagParam), g_decArgo_qcStrBad);
paramDataQc(idProf, idToFlagParam) = set_qc(paramDataQc(idProf, idToFlagParam), g_decArgo_qcStrCorrectable);
dataStruct.(paramDataQcName) = paramDataQc;

testFailedList(19, idProf) = 1;
Expand Down Expand Up @@ -4099,6 +4186,72 @@ function add_rtqc_to_profile_file(a_floatNum, ...
end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TEST 24: pre-april 2021 RBR floats
%
if (testFlagList(24) == 1)

% Specific test:
% set PSAL_QC = '3' for pre-april 2021 RBR salinity

if (ismember(a_floatNum, g_decArgo_rbrPreApril2021FloatList))

% list of parameters concerned by this test
test24ParameterList1 = [ ...
{'PSAL'} ...
{'PSAL2'} ...
];

% get the name of PSAL parameter assigned to RBR sensor
rbrPsalName = [];
for idP = 1:length(test24ParameterList1)
paramName = test24ParameterList1{idP};
idF = find(strcmp(paramName, parameterMeta) == 1, 1);
if (~isempty(idF))
paramSensor = parameterSensorMeta{idF};
% retrieve the sensor model of this parameter
idF = find(strcmp(paramSensor, sensorMeta) == 1, 1);
if (~isempty(idF))
paramSensorModel = sensorModelMeta(idF);
if (strncmp(paramSensorModel, 'RBR', length('RBR')))
rbrPsalName{end+1} = paramName;
end
end
end
end

if (~isempty(rbrPsalName))

for idP = 1:length(rbrPsalName)
paramName = rbrPsalName{idP};

for idProf = 1:length(juld)

% retrieve PARAM data
[paramData, paramDataQc, paramDataFillValue, ~, paramDataQcName] = ...
get_param_data(paramName, dataStruct, idProf, 'R');

if (~isempty(paramData))

profParam = paramData(idProf, :);

% initialize Qc flags (with QC = '3')
idNoDefParam = find(profParam ~= paramDataFillValue);
paramDataQc(idProf, idNoDefParam) = set_qc(paramDataQc(idProf, idNoDefParam), g_decArgo_qcStrCorrectable);
dataStruct.(paramDataQcName) = paramDataQc;

testDoneList(24, idProf) = 1;
testDoneListForTraj{24, idProf} = [testDoneListForTraj{24, idProf} idNoDefParam];

testFailedList(24, idProf) = 1;
testFailedListForTraj{24, idProf} = [testFailedListForTraj{24, idProf} idNoDefParam];
end
end
end
end
end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TEST 57: DOXY specific test
%
Expand Down Expand Up @@ -5199,11 +5352,11 @@ function add_rtqc_to_profile_file(a_floatNum, ...
testDoneListCFile = testDoneList;
testDoneListCFile([11 57 59 62 63], :) = 0;
testDoneListBFile = testDoneList;
testDoneListBFile([8 14], :) = 0;
testDoneListBFile([8 14 24 25], :) = 0;
testFailedListCFile = testFailedList;
testFailedListCFile([11 57 59 62 63], :) = 0;
testFailedListBFile = testFailedList;
testFailedListBFile([8 14], :) = 0;
testFailedListBFile([8 14 24 25], :) = 0;

% compute the report hex values
testDoneCHex = repmat({''}, length(juld), 1);
Expand Down Expand Up @@ -6145,7 +6298,7 @@ function add_rtqc_to_profile_file(a_floatNum, ...

% ------------------------------------------------------------------------------
% Compute the new threshold for test #19 along the following rules:
% - 10% for profile pressures deeper than 1000 dbar
% - profile pressure + 100 dbars for profile pressures deeper than 1000 dbar
% - for profile pressures shallower than 1000 dbar, the coefficient varies
% linearly between 10% at 1000 dbar and 150% at 10 dbar
%
Expand All @@ -6164,13 +6317,13 @@ function add_rtqc_to_profile_file(a_floatNum, ...
% AUTHORS : Jean-Philippe Rannou (Altran)([email protected])
% ------------------------------------------------------------------------------
% RELEASES :
% 05/17/2019 - RNU - creation
% 04/04/2022 - RNU - creation
% ------------------------------------------------------------------------------
function [o_maxPres] = compute_max_pres_for_rtqc_test19(a_profilePressure)

if (a_profilePressure >= 1000)
% 10 % for profile pressures deeper than 1000 dbar
o_maxPres = a_profilePressure*1.1;
% profile pressure + 100 dbars for profile pressures deeper than 1000 dbar
o_maxPres = a_profilePressure + 100;
else
% for profile pressures shallower than 1000 dbar, the coefficient will
% vary linearly between 150 % at 10 dbar and 10 % at 1000 dbar
Expand Down
Loading

0 comments on commit 8bfdfd9

Please sign in to comment.