Closed dgagnier closed 5 months ago
athena_read allocates unnecessarily large amount of memory for each quantity, rendering file reading unnecessarily slow or even impossible. (see #586)
if s > 1: if nx1 > 1: block_data = np.repeat(block_data, s, axis=2) if nx2 > 1: block_data = np.repeat(block_data, s, axis=1) if nx3 > 1: block_data = np.repeat(block_data, s, axis=0) data[q][kl_d:ku_d, jl_d:ju_d, il_d:iu_d] = block_data[kl_s:ku_s, jl_s:ju_s, il_s:iu_s]
Allocates an array of size ( 2^s nx1, 2^s nx2, 2^s nx3), in 3D, whatever the selected size of the domain.
if s > 1: if nx1 > 1: block_data = np.repeat(block_data, s, axis=2)[:,:,il_s:iu_s] if nx2 > 1: block_data = np.repeat(block_data, s, axis=1)[:,jl_s:ju_s,:] if nx3 > 1: block_data = np.repeat(block_data, s, axis=0)[kl_s:ku_s,:,:] data[q][kl_d:ku_d, jl_d:ju_d, il_d:iu_d] = block_data else: data[q][kl_d:ku_d, jl_d:ju_d, il_d:iu_d] = block_data[kl_s:ku_s,jl_s:ju_s,il_s:iu_s]
instead applies the selection of block_data's source indices during np.repeat.
Can one of the admins verify this patch?
athena_read allocates unnecessarily large amount of memory for each quantity, rendering file reading unnecessarily slow or even impossible. (see #586)
Prerequisite checklist
Description
Allocates an array of size ( 2^s nx1, 2^s nx2, 2^s nx3), in 3D, whatever the selected size of the domain.
instead applies the selection of block_data's source indices during np.repeat.