Skip to content

Commit b58963c

Browse files
committed
Adjust seismic colorScale to be symmetric around 0
1 parent c73ce2b commit b58963c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frontend/src/modules/Intersection/DataProviderFramework/utils.ts/colorScaleUtils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ export function createGridColorScaleValues(valueRange: [number, number]): { min:
1010

1111
/**
1212
* Create color scale values for seismic data from value range
13+
*
14+
* Seismic color scale should be symmetric around 0, so we calculate the min and max values
1315
*/
1416
export function createSeismicColorScaleValues(valueRange: [number, number]): { min: number; max: number; mid: number } {
1517
const min = Math.min(0.0, valueRange[0]);
1618
const max = Math.max(0.0, valueRange[1]);
1719
const mid = 0;
18-
return { min, max, mid };
20+
21+
// Seismic data should be symmetric around 0
22+
const absMax = Math.max(Math.abs(min), Math.abs(max));
23+
const symmetricMax = absMax;
24+
const symmetricMin = -absMax;
25+
26+
return { min: symmetricMin, max: symmetricMax, mid };
1927
}

0 commit comments

Comments
 (0)