"""Explore a performance/memory bug relating to multi-file datasets """ import xarray as xr import os #%% Specify the list of files. Repeat the same file to get a mult-file dataset root = os.path.join( 'D:\\', 'Mirror', 'hpcf', 'working', 'hadfield', 'work', 'cook', 'roms', 'sim34', 'run', 'bran-2009-2012-wrfnz-1.20') file = [os.path.join(root, 'roms_avg_0001.nc')] file = file*10 print('Number of files:', len(file)) #%% Create a multi-file dataset with the open_mfdataset function. ds = xr.open_mfdataset(file, concat_dim='ocean_time') print('The dataset has been successfully opened') #%% Print a summary print(ds) print('The dataset has been printed')