* Create 24-hour time strings for a time interval delimited by a start time and an end time. It is assumed that the start time is at "00:00:00" and the end time is at "23:45:00" (when the sampling rate of observations is 15 min) or "23:00:00" (when the sampling rate of observations is 60 min)
* Create 24-hour time strings for a time interval delimited by a start time and an end time. It is assumed that the start time is at "00:00:00" and the end time is at "23:45:00" (when the sampling rate of observations is 15 min) or "23:00:00" (when the sampling rate of observations is 60 min)
* @param {String} phenomenonSamplingRate The sampling rate of the phenomenon of interest represented as a string, e.g. "15min", "60min"
* @param {String} phenomenonSamplingRate The sampling rate of the phenomenon of interest represented as a string, e.g. "15min", "60min"
* @returns {Array} An array of two 24-hour strings representing the start time and end time
* @returns {Array} An array of two 24-hour strings representing the start time and end time
* Calculate the sum of observation values within a time interval delimited by a start date and end date. The start date may be the same as the end date.
* Calculate the indexes of the start and end timestamps
* @param {Array} obsArray An array of observations (timestamp + value) that is response from SensorThings API
* @param {Array} obsTimestampArr An array of observations timestamps
* @param {String} samplingRate The sampling rate of observations as a string, e.g. "15min", "60min"
* @param {String} samplingRate The sampling rate of observations as a string, e.g. "15min", "60min"
* @param {String} startDate A 24-hour date string representing the start date
* @param {String} startDate A 24-hour date string representing the start date
* @param {String} endDate A 24-hour date string representing the end date
* @param {String} endDate A 24-hour date string representing the end date
* @returns {Number} A floating-point number representing the sum of observation values
* @returns {Array} A 1*2 array tht contains integers representing the start index and end index respectively
@@ -117,27 +113,74 @@ const calculateSumOfObservationValuesWithinDatesInterval = function (
...
@@ -117,27 +113,74 @@ const calculateSumOfObservationValuesWithinDatesInterval = function (
endIso8601DateTimeString
endIso8601DateTimeString
);
);
return[indexStartTimestamp,indexEndTimestamp];
};
/**
* Extract the set of observation values that fall within a time interval delimited by a start date and end date. The start date may be the same as the end date.
* @param {Array} obsArray An array of observations (timestamp + value) that is response from SensorThings API
* @param {String} samplingRate The sampling rate of observations as a string, e.g. "15min", "60min"
* @param {String} startDate A 24-hour date string representing the start date
* @param {String} endDate A 24-hour date string representing the end date
* @returns {Array} An array of observation values that fall within our time interval
* Calculate the average (arithmetic mean) of observation values that fall within a time interval delimited by the first day and last day of a calendar month
* @param {Array} obsValuesForMonthIntervalArr An array of observation values that fall within one calendar month
* @returns {Number} A floating-point number representing the average (arithmetic mean) of observation values within one calendar month
* Calculate the average (arithmetic mean) of observation values within a time interval delimited by a start date and end date. The time interval may be daily or monthly
* @param {Array} obsNestedArr A 1*N array that contains N nested arrays of observations (timestamp + value)
* @param {String} samplingRate The sampling rate of observations as a string, e.g. "15min", "60min"
* @param {Array} uniqueCalendarDatesOrMonthsArr A 1*N array of unique calendar dates or calendar months strings
* @param {String} aggregationInterval The aggregation interval as a string e.g. "daily", "monthly"
* @returns {Array} A 1*N array that contains N nested arrays of average (arithmetic mean) values
* Format a computed aggregation result to make it suitable for a column chart
* Format a computed aggregation result to make it suitable for a column chart
* @param {Array} calendarDatesMonthsStrArr An array of unique calendar dates strings (in "YYYY-MM-DD" fromat) or unique calendar months strings (in "YYYY-MM" format)
* @param {Array} calendarDatesMonthsStrArr An array of unique calendar dates strings (in "YYYY-MM-DD" fromat) or unique calendar months strings (in "YYYY-MM" format)
...
@@ -123,6 +127,8 @@ const drawColumnChartHighcharts = function (
...
@@ -123,6 +127,8 @@ const drawColumnChartHighcharts = function (
* Determines the timestamps that are missing from a smaller set of observations. Based on the comparison of two observation arrays, where one array is larger than the other
* Determines the timestamps that are missing from a smaller set of observations. Based on the comparison of two observation arrays, where one array is larger than the other
* @param {Array} obsTimestampArrayOne An array of timestamps for the first set of observations
* @param {Array} obsTimestampArrayOne An array of timestamps for the first set of observations
...
@@ -323,13 +325,23 @@ const drawScatterPlotHighcharts = function (
...
@@ -323,13 +325,23 @@ const drawScatterPlotHighcharts = function (