@@ -13,8 +13,8 @@ export async function GetArray(varOveride?: string) {
1313 const { compress, xSlice, ySlice, zSlice, coarsen, kernelSize, kernelDepth, fetchNC, setCurrentChunks, setArraySize } = useZarrStore . getState ( ) ;
1414 const { cache } = useCacheStore . getState ( ) ;
1515 const fetcher = fetchNC ? NCFetcher ( ) : zarrFetcher ( )
16-
17- const meta = await fetcher . getMetadata ( varOveride ?? variable ) ;
16+ const targetVariable = varOveride ?? variable ;
17+ const meta = await fetcher . getMetadata ( targetVariable ) ;
1818 const { shape, chunkShape, fillValue, dtype } = meta ;
1919 const rank = shape . length ;
2020 const hasZ = rank >= 3 ;
@@ -60,7 +60,7 @@ export async function GetArray(varOveride?: string) {
6060 for ( let y = yDim . start ; y < yDim . end ; y ++ ) {
6161 for ( let x = xDim . start ; x < xDim . end ; x ++ ) {
6262 const chunkID = `z${ z } _y${ y } _x${ x } ` ;
63- const cacheBase = rank > 3 ? `${ initStore } _${ variable } _${ idx4D } ` : `${ initStore } _${ variable } ` ;
63+ const cacheBase = rank > 3 ? `${ initStore } _${ targetVariable } _${ idx4D } ` : `${ initStore } _${ targetVariable } ` ;
6464 const cacheName = `${ cacheBase } _chunk_${ chunkID } ` ;
6565 const cachedChunk = cache . get ( cacheName ) ;
6666 const isCacheValid = cachedChunk &&
@@ -79,7 +79,7 @@ export async function GetArray(varOveride?: string) {
7979 [ zDim . start , yDim . start , xDim . start ]
8080 ) ;
8181 } else {
82- const raw = await fetcher . fetchChunk ( { variable, rank, shape, chunkShape, x, y, z, xDimIndex, yDimIndex, zDimIndex, idx4D } ) ;
82+ const raw = await fetcher . fetchChunk ( { variable : targetVariable , rank, shape, chunkShape, x, y, z, xDimIndex, yDimIndex, zDimIndex, idx4D } ) ;
8383
8484 const rawData = fillValue ? raw . data . map ( ( v : number ) => v === fillValue ? NaN : v ) : raw . data ; // Don't map if no fillvalue
8585
0 commit comments