Eliminate scipy RuntimeWarning when reading NetCDF restart files
Due to a bug that was uncovered in mdtraj with scipy's NetCDF implementation regarding mmapping, scipy started issuing the following warning if any NetCDF variable objects had references remaining after closing the file: /.../lib/python2.7/site-packages/scipy/io/netcdf.py:287: RuntimeWarning: Cannot close a netcdf_file opened with mmap=True, when netcdf_variables or arrays referring to its data still exist. All data arrays obtained from such files refer directly to data on disk, and must be copied before the file can be cleanly closed. (See netcdf_file docstring for more information on mmap.) We were already copying data to avoid segfaults on some scipy versions, but there were still references to variables that went out of scope shortly after the NetCDF file was closed. Simply deleting these references gets rid of the warning.
Showing
Please register or sign in to comment