Skip to content

Commit 1338e7f

Browse files
authored
Merge pull request #607 from EarthyScience/jp/getcurrent-fix
Updated GetCurrentArray to use chunkstrides
2 parents 0bebe4e + 122d68c commit 1338e7f

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

src/components/plots/AnalysisWG.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,12 @@ const AnalysisWG = ({ setTexture, }: { setTexture: React.Dispatch<React.SetState
6969
xSlice: state.xSlice
7070
})));
7171
const isMounted = useRef(false)
72-
7372
useEffect(() => {
7473
if (!plotOn){
7574
return
7675
}
77-
const dataArray = GetCurrentArray(analysisStore);
7876
// Guard clauses: exit if not triggered, no operation is selected, or data is invalid.
79-
if (!operation || dataArray.length <= 1) {
77+
if (!operation) {
8078
return;
8179
}
8280
const executeAnalysis = async () => {
@@ -100,7 +98,7 @@ const AnalysisWG = ({ setTexture, }: { setTexture: React.Dispatch<React.SetState
10098
}
10199

102100
// --- 2. Dispatch GPU computation based on the operation ---
103-
const inputArray = analysisMode ? analysisArray : dataArray;
101+
const inputArray = GetCurrentArray(analysisStore)
104102
const shapeInfo = { shape: dataShape, strides};
105103
const kernelParams = { kernelDepth, kernelSize };
106104
// [1538316, 1481, 1]

src/utils/HelperFuncs.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,7 @@ export function GetCurrentArray(overrideStore?:string){
275275
const [xStartIdx, xEndIdx] = currentChunks.x
276276
const [yStartIdx, yEndIdx] = currentChunks.y
277277
const [zStartIdx, zEndIdx] = currentChunks.z
278-
let chunkShape;
279-
let chunkStride;
278+
280279
for (let z = zStartIdx; z < zEndIdx; z++) {
281280
for (let y = yStartIdx; y < yEndIdx; y++) {
282281
for (let x = xStartIdx; x < xEndIdx; x++) {
@@ -285,14 +284,10 @@ export function GetCurrentArray(overrideStore?:string){
285284
const chunk = cache.get(cacheName)
286285
const compressed = chunk.compressed
287286
const thisData = compressed ? DecompressArray(chunk.data) : chunk.data
288-
if (!chunkShape) {
289-
chunkShape = chunk.shape
290-
chunkStride = chunk.stride
291-
}
292287
copyChunkToArray(
293288
thisData,
294-
chunkShape,
295-
chunkStride,
289+
chunk.shape,
290+
chunk.stride,
296291
typedArray,
297292
dataShape,
298293
strides as [number, number, number],

0 commit comments

Comments
 (0)