read

AAPP_HDF.read(file_info, fields=None, mapping=None, **kwargs)

Read and parse NetCDF files and load them to a xarray.Dataset

Parameters:
  • file_info – Path and name of the file as string or FileInfo object. This can also be a tuple/list of file names or a path with asterisk (this is still not implemented!).

  • fields – List of field names that should be read. The other fields will be ignored. If mapping is given, this should contain the new field names.

  • mapping – A dictionary which is used for renaming the fields. If given, fields must contain the old field names.

  • **kwargs – Additional keyword arguments for xarray.decode_cf() such as mask_and_scale, etc.

Returns:

A xarray.Dataset object.

Examples

from typhon.files import NetCDF4

fh = NetCDF4()
data = fh.read("filename.nc")

# OR if you want to load only some fields:
data = fh.read("filename.nc", fields=["temp", "lat", "lon"])