epsproc.util.xrIO module

ePSproc Xarray IO util functions

Various tools for use in Xarray file IO.

27/06/22 Split out from core IO.py, to extend backend options and support.

Now additionally wrapped therein for flexible handling of multiple backends.

epsproc.util.xrIO.combineComplex(dataR, dataI)[source]

Combine R+I floats into complex form.


Combine Re + Im Xarray Dataset and coordinates to complex values

Note: not general, assumes formatting as defined by splitComplexXR()

epsproc.util.xrIO.sanitizeAttrsNetCDF(data, dictHandling='wrap')[source]

Sanitize Xarray DataArray attributes for file IO.

Note this may be lossy:

  • Empty data > string.

  • Dictionaries removed, wrapped to string, or left alone (nested dicts not supported in attrs for most (all?) file writers). Set dictHandling = ‘del’, ‘wrap’ or anything else to leave as is.

  • Remove all items not of types [str, np.ndarray, int, float, list, tuple]


  • try conversion to string for all attrs?

  • try dict conversions & JSON side-car file IO to avoid lossy saves.


Split complex data into R+I floats.


Split complex-valued Xarray data & coords to Re + Im components

Splits input Xarray into Xarray Dataset with ‘Re’ and ‘Im’ components.