@@ -252,7 +252,7 @@ export async function GetArray(): Promise<{
252252 const hasTimeChunks = is4D ? fullShape [ 1 ] / chunkShape [ 0 ] > 1 : fullShape [ 0 ] / chunkShape [ 0 ] > 1
253253
254254 //---- Strategy 1. Download whole array (No time chunks) ----//
255- if ( ! hasTimeChunks ) { // No chunking along time axis, can download whole array at once
255+ if ( ! hasTimeChunks ) {
256256 setStatus ( "Downloading..." )
257257 const chunk = await fetchWithRetry (
258258 ( ) => is4D ? zarr . get ( outVar , [ idx4D , null , null , null ] ) : zarr . get ( outVar ) ,
@@ -264,6 +264,7 @@ export async function GetArray(): Promise<{
264264 throw new Error ( "BigInt arrays not supported." ) ;
265265 }
266266 const shape = is4D ? outVar . shape . slice ( 1 ) : outVar . shape ;
267+
267268 setStrides ( chunk . stride ) // Need strides for the point cloud
268269 const [ typedArray , scalingFactor ] = ToFloat16 ( chunk . data as Float32Array , null )
269270 const cacheChunk = {
@@ -309,6 +310,10 @@ export async function GetArray(): Promise<{
309310 setArraySize ( totalElements ) ;
310311 setCurrentChunks ( { x : [ xDim . start , xDim . end ] , y : [ yDim . start , yDim . end ] , z : [ zDim . start , zDim . end ] } ) ; //These are used to stitch timeseries data
311312 }
313+ if ( totalElements > 1e9 ) {
314+ useErrorStore . getState ( ) . setError ( 'largeArray' ) ;
315+ throw Error ( "Cannot allocate unbokrne memory segment for array." )
316+ }
312317 const typedArray = new Float16Array ( totalElements ) ;
313318
314319 // State for the loop
0 commit comments