Skip to main content
`Ctrl`+`K`

# NetCDF (EELSlab) format

The `.nc` format was the default format in HyperSpy’s predecessor, EELSLab, but it has been superseded by HSpy - HyperSpy’s HDF5 Specification in RosettaSciIO. We provide only reading capabilities but we do not support writing to this format.

Note that only NetCDF files written by EELSLab are supported.

To use this format a python netcdf interface, such as netcdf4 must be installed manually because it is not installed by default.

## API functions

rsciio.netcdf.file_reader(filename, lazy=False)

  Read netCDF `.nc` files saved using the HyperSpy predecessor EELSlab.

  Parameters:
    filename `python:str`, `pathlib.Path`

      Filename of the file to read or corresponding pathlib.Path.

    lazy bool, default=False

      Lazy loading is not supported.

  Returns:
    `python:list` of `python:dict`

      List of dictionaries containing the following fields:

      - ‘data’ – multidimensional `numpy.ndarray` or `dask.array.Array`

      - ‘axes’ – list of dictionaries describing the axes containing the fields ‘name’, ‘units’, ‘index_in_array’, and either ‘size’, ‘offset’, and ‘scale’ or a numpy array ‘axis’ containing the full axes vector

      - ‘metadata’ – dictionary containing the parsed metadata

      - ‘original_metadata’ – dictionary containing the full metadata tree from the input file

      When the file contains several datasets, each dataset will be loaded as separate dictionary.