Skip to main content

Imas2xarray is a tool reading IMAS data in hdf5 format into xarray.

Project description

Documentation Status Tests PyPI - Python Version PyPI Coverage DOI

imas2xarray banner


Imas2xarray is a library that makes it as simple and intuitive as possible to read and write IMAS data in HDF5 format with Python. There is no need to manually define the paths or fiddle with the different dimensions and long keys.


>>> from imas2xarray import to_xarray
>>> path = '/pfs/work/g2aho/public/imasdb/test/3/92436/1/'
>>> ids = 'equilibrium'
>>> ds = to_xarray(path, ids)
>>> ds
Dimensions:         (time: 1, rho_tor_norm: 101, ion: 4)
  * time            (time) float64 50.04
  * rho_tor_norm    (rho_tor_norm) float64 0.0 0.01 0.02 0.03 ... 0.98 0.99 1.0
Dimensions without coordinates: ion
Data variables: (12/14)
    q               (time, rho_tor_norm) float64 0.7887 0.7888 ... 4.262 4.845
    collisionality  (time, rho_tor_norm) float64 23.23 7.554 ... 7.31 10.19
    t_i_ave         (time, rho_tor_norm) float64 1.036e+04 1.036e+04 ... 508.4
    ...              ...
    n_e             (time, rho_tor_norm) float64 7.976e+19 ... 1.742e+19
    p_i             (time, ion, rho_tor_norm) float64 1.242e+05 ... 0.2948
    n_e_tot         (time, rho_tor_norm) float64 7.976e+19 ... 1.742e+19


>>> from imas2xarray import to_imas
>>> ds['t_e'] *= 1.1
>>> to_imas(
>>>     path,
>>>     dataset=ds,
>>>     ids=ids
>>> )

For more advanced use-cases and examples, please see the documentation.

Installing imas2xarray

To install:

pip install imas2xarray

Imas2xarray is supported on Python versions 3.9 or newer.


Check out our Contributing Guidelines to get started with development.

Suggestions, improvements, and edits are most welcome.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imas2xarray-0.4.0.tar.gz (20.8 kB view hashes)

Uploaded Source

Built Distribution

imas2xarray-0.4.0-py3-none-any.whl (18.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page