Skip to main content

Read Thatec h5 formatting and convert it to netcdf files and xarray objects.

Project description

Project Description

This is a community package which helps reading .h5 files created by ThatecOS and converting them to xarray objects and netcdf files. This software is not maintained by and has no affiliations to THATec Innovation GmbH.

Installation

$ pip install PyThat

If not happened automatically, install following dependencies: netcdf4, scipy, h5netcdf, h5py, xarray

Usage

The package reconstructs the measurement tree and lets the user choose the row containing an indicator. It then uses the metadata from the measurement tree to construct an xarray object with n+m dimensions, where n is the dimension of the indicator in the specified row and m the number of indents/loops.

Since xarray is built around labeled arrays, it also reconstructs the coord and dims attributes of the xarray objects. For use of xarray see the documentation.

from PyThat import MeasurementTree
import xarray as xr
import matplotlib.pyplot as plt

# define path to h5 file, can be relative or absolute path
path = r'M486 Dispersion 40 mT.h5'

index = None
# Optional: If the index is known beforehand, it can be specified here.
# Otherwise the user will be asked to choose by a popup.
# index = (2,1)

measurement_tree = MeasurementTree(path, index=index)
data: xr.DataArray = measurement_tree.array

# data can now be used as a usual xarray object
data.plot()
plt.show()

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

PyThat-0.0.24.tar.gz (8.1 kB view hashes)

Uploaded Source

Built Distribution

PyThat-0.0.24-py3-none-any.whl (8.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