Skip to content

Commit

Permalink
fix flashing environmental layers
Browse files Browse the repository at this point in the history
  • Loading branch information
satellitestudiodesign committed Jul 31, 2024
1 parent b64e1d9 commit 987005f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class FourwingsHeatmapTileLayer extends CompositeLayer<FourwingsHeatmapTi

updateColorDomain = debounce(() => {
requestAnimationFrame(() => {
const { comparisonMode, aggregationOperation } = this.props
const { comparisonMode } = this.props
const { colorDomain: oldColorDomain } = this.state
const newColorDomain = this._calculateColorDomain()
let avgChange = Infinity
Expand All @@ -267,10 +267,7 @@ export class FourwingsHeatmapTileLayer extends CompositeLayer<FourwingsHeatmapTi
)
}
)
} else if (
comparisonMode === FourwingsComparisonMode.Compare &&
aggregationOperation === FourwingsAggregationOperation.Sum
) {
} else if (comparisonMode === FourwingsComparisonMode.Compare) {
change = (oldColorDomain as number[]).map((oldValue, i) => {
const newValue = newColorDomain[i] as number
return (Math.abs(newValue - oldValue) / oldValue) * 100 || 0
Expand Down
7 changes: 4 additions & 3 deletions libs/deck-layers/src/utils/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export function removeOutliers({
/* FourwingsAggregationOperation */
aggregationOperation?: 'avg' | 'sum'
}) {
const meanValue = mean(allValues)
const allValuesCleaned = allValues.filter(Boolean)
const meanValue = mean(allValuesCleaned)
const deviationScale = aggregationOperation === 'avg' ? 2 : 1
const standardDeviationValue = standardDeviation(allValues)
const standardDeviationValue = standardDeviation(allValuesCleaned)
const upperCut = meanValue + standardDeviationValue * deviationScale
const lowerCut = meanValue - standardDeviationValue * deviationScale
return allValues.filter((a) => a >= lowerCut && a <= upperCut)
return allValuesCleaned.filter((a) => a >= lowerCut && a <= upperCut)
}

0 comments on commit 987005f

Please sign in to comment.