Commit a9db75af authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

New function: get index of missing observations

Currently, this function is only available in the scope of the
function that formats observations for the scatter plot chart.

Get the index of the observations that are available in the first
array but are missing from the second array.
parent 11981299
Showing with 23 additions and 0 deletions
+23 -0
......@@ -846,6 +846,29 @@ const formatSTAResponseForScatterPlot = function (obsArrayOne, obsArrayTwo) {
obsArrayTwoTimestamp
);
console.log(missingTimestamp);
/**
*
* @param {Array} missingTimestampsArr An array of strings representing the missing timestamps
* @param {Array} firstObsTimestampArr An array of timestamps for the first set of observations
* @returns {Array} An array of the indexes of the missing observations
*/
const getIndexOfMissingObservation = function (
missingTimestampsArr,
firstObsTimestampArr
) {
const indexesMissingObs = missingTimestampsArr.map((index) =>
firstObsTimestampArr.indexOf(index)
);
// console.log(indexes);
return indexesMissingObs;
};
const indexesMissingObsArr = getIndexOfMissingObservation(
missingTimestamp,
obsArrayOneTimestamp
);
};
(async () => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment