mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 23:12:23 +00:00
Merge pull request #1551 from nasa/msl-units
[Example] Add units to MSL example.
This commit is contained in:
commit
6680db0b31
@ -44,31 +44,31 @@ define(
|
||||
{
|
||||
"name": "Min. Air Temperature",
|
||||
"identifier": "min_temp",
|
||||
"units": "degrees",
|
||||
"units": "Degrees (C)",
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"name": "Max. Air Temperature",
|
||||
"identifier": "max_temp",
|
||||
"units": "degrees",
|
||||
"units": "Degrees (C)",
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"name": "Atmospheric Pressure",
|
||||
"identifier": "pressure",
|
||||
"units": "pascals",
|
||||
"units": "Millibars",
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"name": "Min. Ground Temperature",
|
||||
"identifier": "min_gts_temp",
|
||||
"units": "degrees",
|
||||
"units": "Degrees (C)",
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"name": "Max. Ground Temperature",
|
||||
"identifier": "max_gts_temp",
|
||||
"units": "degrees",
|
||||
"units": "Degrees (C)",
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
|
@ -48,6 +48,13 @@ define(
|
||||
this.$http = $http;
|
||||
this.$log = $log;
|
||||
this.promise = undefined;
|
||||
|
||||
this.dataTransforms = {
|
||||
//Convert from pascals to millibars
|
||||
'pressure': function pascalsToMillibars(pascals) {
|
||||
return pascals / 100;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,6 +72,8 @@ define(
|
||||
var self = this,
|
||||
id = request.key;
|
||||
|
||||
var dataTransforms = this.dataTransforms;
|
||||
|
||||
function processResponse(response){
|
||||
var data = [];
|
||||
/*
|
||||
@ -75,13 +84,14 @@ define(
|
||||
* Check that valid data exists
|
||||
*/
|
||||
if (!isNaN(solData[id])) {
|
||||
var dataTransform = dataTransforms[id];
|
||||
/*
|
||||
* Append each data point to the array of values
|
||||
* for this data point property (min. temp, etc).
|
||||
*/
|
||||
data.unshift({
|
||||
date: Date.parse(solData[TERRESTRIAL_DATE]),
|
||||
value: solData[id]
|
||||
value: dataTransform ? dataTransform(solData[id]) : solData[id]
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user