Skip to main content

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

Project description

logo

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

If you are using Conda/Anaconda, you can also install via pip. However, this may result in some dependency issues, rendering PyThat inoperable.

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.

After starting at version 0.27 all data is read for all valid indicators and combined to a dataset. The old version with indexing should still work, however.

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'D:\Pycharm\PyThat\examples\M486 Dispersion 40 mT.h5'

# Get dataset from file
data = MeasurementTree(path, override=True).dataset
print(data)

# Get variable name from printout
interesting_data_name = "2,1: Acquire spectrum"
interesting_data = data[interesting_data_name] 

# Select and plot data
interesting_data.sel(dict(Frequency=slice(5, 15, None))).plot(col='Set Field')
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.33.tar.gz (10.7 kB view hashes)

Uploaded source

Built Distribution

PyThat-0.0.33-py3-none-any.whl (10.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page