A converter from AMR Block data (BoxLib) to H5 covered grids
Project description
AMR Block data to H5 converter
This python package can be used to convert AMR block data files to the H5 format with covered grid arrays at the maximum refinement level.
Right now only 2D AMR files are supported, support for 3D dataset will likely be for the creation of slices as creating a 3D covered grid array would not be practical in terms of file size.
This python package relies heavily on the yt
package to read AMR plotfiles.
Installation
pip install amr2h5
Usage
- The
AMR2H5Converter
class creates a single.h5
file from a AMR plotfile directory. All the fields are keept and the AMR Level is added to the dataset. Thex
andy
coordinates at the highest refinement level are added as 1D arrays. Thereturn_opened
option can be used to dynamically read plotfiles into 2D arrays. - The
H5Reader
class reads all the data from a converted AMR plotfile into a dictionnary with all the fields as keys and 2D arrays for all the dataset. Thefast_field
option can be used to read a single field (faster), this is usefull when analyzing time series data for a single field.
Example
from amr2h5 import AMR2H5Converter
from amr2h5 import H5Reader
# Convert a single plotfile
AMR2H5Converter('plt02000') # New file plt02000.h5 is created
# Convert and read a single plotfile
# New file plt02000.h5 is created and read
dataset = AMR2H5Converter('plt02000', return_opened=True)
# Read a converted file
dataset = H5Reader('plt02000.h5') # dataset is a dict with the whole dataset
# Reader a single field from file (faster)
# dataset_temp contains only coordinates and 'temp' field
dataset_temp = H5Reader('plt02000.h5', fast_field='temp')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
amr2h5-0.0.3.tar.gz
(17.4 MB
view details)
Built Distribution
File details
Details for the file amr2h5-0.0.3.tar.gz
.
File metadata
- Download URL: amr2h5-0.0.3.tar.gz
- Upload date:
- Size: 17.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b17c6ece0a4ea1191d522141062eef1436bac504b10d6a956f559867fb6836e4 |
|
MD5 | 75a063514a512ca77ee41ae6b217b3b0 |
|
BLAKE2b-256 | ee4b432af38047f82e87e376e42c55b8d641dc3b16540241b638bff7b8859fee |
File details
Details for the file amr2h5-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: amr2h5-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66dbd18d9b347c197fdb89d8e33a6e1649e1bfcc3aeda812e837ae1a714679de |
|
MD5 | 98dc21bb5c75ac556ebe4405125e78e9 |
|
BLAKE2b-256 | 2964ed695c75580239c05d69cf9fd23c70fe196157055ff481b9544e3a6ba00c |