// Use for/of loop - we need to maintain the order of execution of the async operations
for(constpromiseofmetadataPlusObsPromiseArray){
// Resolved value of a single promise
constresolvedPromise=awaitpromise;
combinedResolvedPromises.push(resolvedPromise);
}
returncombinedResolvedPromises;
}catch(err){
console.error(err);
}
};
/**
/**
* Retrieve all the Observations from an array of Observations promises
* Retrieve all the Observations from an array of Observations promises
* @async
* @async
...
@@ -955,55 +1030,55 @@ const getObservationsFromMultipleDatastreams = async function (
...
@@ -955,55 +1030,55 @@ const getObservationsFromMultipleDatastreams = async function (
};
};
/**
/**
* Retrieve the metadata from multiple Datastreams and the Observations corresponding to these Datastreams
* Retrieve the metadata from a single Datastream or multiple Datastreams and the Observations corresponding to the Datastream(s)
* @async
* @param {String} baseUrl Base URL of the STA server
* @param {Array} bldgSensorSamplingRateArr A 3*N array containing buildings, sensors & sampling rates as strings, e.g. ["101", "rl", "60min"]
* @param {Object} urlParamObj The URL parameters to be sent together with the GET request
* @returns {Promise} A promise that contains a N*2 array (the first element is an array of Observations and the second element is an array of Datastream metadata objects) when fulfilled
* @param {Array} bldgSensorSamplingRateArr A N*1 array (where N >= 1) containing a nested array of buildings, sensors & sampling rates as strings, i.e. [["101", "rl", "15min"]] or [["101", "rl", "15min"], ["102", "vl", "60min"]] or [["101", "rl", "15min"], ["102", "vl", "60min"], ["225", "vl", "60min"]], etc
* @returns {Promise} A promise that contains a 1*2 array (the first element is an array that contans N Observations arrays; and the second element is an array of N Datastream metadata objects) when fulfilled