Solve the following exception that occurs when the directory name of the saved
datasets does not yet exist:

Traceback (most recent call last):
  File "test_energy_rms.py", line 318, in <module>
    ncfile = netcdf.Dataset(netcdf_filename, 'w', version='NETCDF4')
  File "netCDF4.pyx", line 1386, in netCDF4.Dataset.__init__ (netCDF4.c:19148)
RuntimeError: Permission denied

also remove redundant line.