Commit baa1f9cd authored by Kolokolnikova's avatar Kolokolnikova
Browse files

Implemented Normalization functions

for ranges of PV-values
parent e1e18a32
/* TODO: issue #128
write a function which normalizes each value from the pvPotential array
and
*/
\ No newline at end of file
*/
var minAndMaxPvPotentials = [];
function setMinAndMax(pvPotentialValue) {
let pvPotentials = [];
pvPotentialSurfaces.forEach(t => {
for (const [key, value] of Object.entries(t.attributes.pvPotential)) {
if (key === pvPotentialValue) {
pvPotentials.push(value);
}
}
});
pvPotentials = pvPotentials.sort(function(a, b) { return a - b; });
minAndMaxPvPotentials.push(pvPotentials[0]);
minAndMaxPvPotentials.push(pvPotentials[pvPotentials.length - 1]);
}
function getNormalizedValue(selectedPvPotentialValue) {
var normalizedValue;
if(minAndMaxPvPotentials[1]-minAndMaxPvPotentials[0]!==0){
normalizedValue = (selectedPvPotentialValue-minAndMaxPvPotentials[0])/(minAndMaxPvPotentials[1]-minAndMaxPvPotentials[0]);
}
else{
normalizedValue=1;
}
return normalizedValue;
}
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