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
...@@ -846,6 +846,29 @@ const formatSTAResponseForScatterPlot = function (obsArrayOne, obsArrayTwo) { ...@@ -846,6 +846,29 @@ const formatSTAResponseForScatterPlot = function (obsArrayOne, obsArrayTwo) {
obsArrayTwoTimestamp obsArrayTwoTimestamp
); );
console.log(missingTimestamp); 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 () => { (async () => {
......
Markdown is supported
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