File size: 4,929 Bytes
5ab75a9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | function DB = EliminateBadDBEntries(DB,ZeroCovFlag,MaxSigmaFlag,ObsTimeFlag,verbose)
% EliminateBadDBEntries - Eliminate bad OCMDB entries
%
% Syntax: DB = EliminateBadDBEntries(DB,ZeroCovFlag,MaxSigmaFlag,...
% ObsTimeFlag,verbose)
%
% =========================================================================
%
% Copyright (c) 2025 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================
%
% Description: Eliminate bad OCMDB entries
%
% =========================================================================
%
% Input:
%
% DB - initial OCM DB table
%
% ZeroCovFlag - Optional - Bool indicating whether to apply a filter for
% DB entries with a zero covariance value
% (default = true)
%
% MaxSigmaFlag - Optional - Bool indicating whether to apply a maximum
% RIC sigma value filter. Cutoff is hardcoded to 9.9 times
% theradius of the Earth
% (default = true)
%
% ObsTimeFlag - Optional - Bool indicating whether to apply a filter for
% DB entries with secondary last obs time entered as
% '1969-12-31'
% (default = true)
%
% verbose - Optional - bool indicating whether to print optional
% output strings
% (default = false)
%
% =========================================================================
%
% Output:
%
% DB - OCM DB table with filtered entries removed
%
% =========================================================================
%
% Dependencies:
%
% None
%
% =========================================================================
%
% Subfunctions:
%
% None
%
% =========================================================================
%
% Initial version: Apr 2022; Latest update: Apr 2022
%
% ----------------- BEGIN CODE -----------------
% Initializations and defaults
Nargin = nargin;
if Nargin < 2 || isempty(ZeroCovFlag); ZeroCovFlag = true; end
if Nargin < 3 || isempty(MaxSigmaFlag); MaxSigmaFlag = true; end
if Nargin < 4 || isempty(ObsTimeFlag); ObsTimeFlag = true; end
if Nargin < 5 || isempty(verbose); verbose = false; end
if verbose
[Nconj0,~] = size(DB);
disp([current_timestring() ' Executing EliminateBadDBEntries']);
disp([' Nconj = ' num2str(Nconj0) ' in input DB array']);
end
% Apply zero-covariance filter
if ZeroCovFlag
% Covariance indices
ndxCOV1 = (73:93);
ndxCOV2 = (133:153);
maxCOV1 = max(DB(:,ndxCOV1),[],2);
maxCOV2 = max(DB(:,ndxCOV2),[],2);
ndx = maxCOV1 <= 0 | maxCOV2 <= 0;
if any(ndx)
ndx = ~ndx;
DB = DB(ndx,:);
end
if verbose
[Nconj1,~] = size(DB);
disp([' Nconj = ' num2str(Nconj1) ' with two non-zero UVW covariances']);
end
end
% Apply max UVW sigma filter
if MaxSigmaFlag
% Cutoff for acceptable UVW sigma values
Re_km = 6378.137;
UVWmaxsigma = 9.9*Re_km;
UVWmaxsigma2 = (UVWmaxsigma*1e3)^2;
ndxUVW = [73 79 84 133 139 144];
UVWsigma2 = max(DB(:,ndxUVW),[],2);
ndx = UVWsigma2 >= UVWmaxsigma2;
if any(ndx)
ndx = ~ndx;
DB = DB(ndx,:);
end
if verbose
[Nconj2,~] = size(DB);
disp([' Nconj = ' num2str(Nconj2) ' after eliminating 10*Re position sigmas']);
end
end
% Apply a filter for DB entries with secondary last obs time entered as
% '1969-12-31'; these are likely(?) events with secondary ephemeris data
if ObsTimeFlag
ndx = (DB(:,97) == 1969) & (DB(:,98) == 12) & (DB(:,99) == 31) & ...
(DB(:,100) == 0) & (DB(:,101) == 0) & ...
(DB(:,102) == 0) & (DB(:,103) == 0);
if any(ndx)
ndx = ~ndx;
DB = DB(ndx,:);
end
if verbose
[Nconj3,~] = size(DB);
disp([' Nconj = ' num2str(Nconj3) ' after eliminating 1969-12-31 secondaries']);
end
end
return
end
% ----------------- END OF CODE ------------------
%
% Please record any changes to the software in the change history
% shown below:
%
% ----------------- CHANGE HISTORY ------------------
% Developer | Date | Description
% ---------------------------------------------------
% D. Hall | 2022-Apr-11 | Initial version.
% =========================================================================
%
% Copyright (c) 2025 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% ========================================================================= |