Test Case Title |
TC7.8 - Example of how to CreateLastValuesMean.R |
Goal |
TBD |
Prerequisites |
Using a PC with a web browser. You need credentials to access to the Node-Red application. The following functionalities are available only for specific Snap4city users with specific privileges. |
Expected successful result |
TBD |
Steps |
|
It’s possible to compute the average on the last 2 hours of a specific measure on a specific sensor category using the function “lastHourMean”.
Function Parameters:
- city (It's possible to choose a city between Helsinki and Antwerp)
- sensorCategory (For each city is possible to choose the category of sensors)
- varName (For each category is possible to choose (only) one numeric measure/variable)
If the chosen city is "Helsinki", it’s possible to select a sensorCategory between "Noise_level_sensor" and "Weather_sensor". The varName option related to "Noise_level_sensor" category is "noiseLAeq", while the varName options related to "Weather_sensor" are "airTemperature", "airHumidity" or "windSpeed".
Example:
If the chosen city is "Antwerp", the only sensorCategory to select is "Weather_sensor". The varName options related to "Weather_sensor" are "airTemperature", "airHumidity" or "windSpeed".
Example:
NB: It can be possible that for some serviceUri the chosen varName measures are all equal to "null". In this case the mean will be equal to NA and there will be a message in the Json string that states, "No Available Measures".
The last saved average value can be get using the GetLastSavedValuesAvg2h.R script, using the function "GetLastSavedValuesAvg2h" and the function parameter city, and sensorCategory, varName
Example: GetLastSavedValuesAvg2h (“Helsinki”, “Noise_level_sensor”, “noiseLAeq”)
Get: CreateLastValuesMean.R https://www.snap4city.org/download/video/CreateLastValuesMean.R
Get: GetLastSavedValuesAvg2h.R https://www.snap4city.org/download/video/GetLastSavedValuesAvg2h.R