NCDF, NC (AMBER NetCDF trajectory)

Coordinate reader

MDAnalysis.coordinates.TRJ.NCDFReader

Coordinate writer

MDAnalysis.coordinates.TRJ.NCDFWriter

AMBER binary trajectories are automatically recognised by the file extension “.ncdf”. The NCDF module uses scipy.io.netcdf and therefore scipy must be installed.

Reading in

Units are assumed to be the following default AMBER units:

  • length: Angstrom

  • time: ps

Currently, if other units are detected, MDAnalysis will raise a NotImplementedError.

Writing out

NCDF files are always written out in ångström and picoseconds.

Although scale_factors can be read from NCDF files, they are not kept or used when writing NCDF files out.

Writing with the netCDF4 module and potential issues

Although scipy.io.netcdf is very fast at reading NetCDF files, it is slow at writing them out. The netCDF4 package is fast at writing (but slow at reading). This requires the compiled netcdf library to be installed. MDAnalysis tries to use netCDF4 for writing if it is available, but will fall back to scipy.io.netcdf if it is not.

AMBER users might have a hard time getting netCDF4 to work with a conda-based installation (as discussed in Issue #506) because of the way that AMBER itself handles netcdf. In this scenario, MDAnalysis will simply switch to the scipy package. If you encounter this error and wish to use the the faster netCDF4 writer, the only solution is to unload the AMBER environment.