I have a number of .npz files that potentially vary in shape and I'd like to find which file has the larges shape. The npzs have 2 arrays within in them, and I'm looking for the largest of the 2nd. The following snippet works, but it takes longer than I expected to return shapes. Is this the most efficient way of achieving this? I'm worried about scaling because it currently takes a couple seconds to find the max shape[1] and I'm only looping through 4 arrays
frameMax =0
for f in npzs:
d = np.load(f,mmap_mode='r')
if d['arr_0'].shape[1]>frameMax:
frameMax = d['arr_0'].shape[1]
d=None