Read BATSRUS output and related Tecplot ASCII .dat and binary .plt datasets
Project description
The batread project is a Python library for reading
SWMF/BATSRUS
output and related Tecplot ASCII .dat and binary .plt datasets. The project also includes a use case in the form of a quicklook command, bat-quick, for visualising two-dimensional SWMF/BATSRUS output.
Installation
After cloning this repository, the project may be installed with pip in the regular way:
cd <project>
pip install .
This installs the reader functionality only. To use the quicklook plotting command, install the graphics extra:
pip install .[graphics]
Python code to access file data
This code reads a dataset named <file> and stores the dataset variable named Rho [g/cm^3] in a local variable named density_g_cm3.
from batread import Dataset
ds = Dataset.from_file('<file>')
print(ds)
density_g_cm3 = ds['Rho [g/cm^3]']
Running the quicklook command
A simple 'quicklook' shell command is included which permits plotting of two-dimensional slices of the SWMF/BATSRUS results. Irregularly gridded data is accepted. The quicklook command uses the plot function in basicplot.py but this may be extended by the user.
The quicklook command requires the graphics extra:
pip install .[graphics]
To create a quicklook .png file from the included file examples/x=0_var_2_n00000000.plt
run
cd examples
bat-quick x=0_var_2_n00000000.plt
This will create a file named ql-x-0-var-2-n00000000-plt-rho-g-cm-3.png; the name comprises the prefix ql, the file name, and the name of the plotted variable. Non-alphanumeric characters are normalised to dashes in the output file name.
A wildcard pattern may be used; in this case one .png file is created for each file matching the wildcard pattern:
bat-quick x*.plt
Development and testing
To install the project in editable mode and enable testing do
cd <project>
pip install --editable .[tests]
Now it is possible to run the test suite by typing
pytest
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file batread-1.1.0.tar.gz.
File metadata
- Download URL: batread-1.1.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00e85c19b57d0292312dbf1f6c28cda2987d4da6470d4223db869d4f96ed1918
|
|
| MD5 |
61dda5505b130afb2849782c73481c38
|
|
| BLAKE2b-256 |
ab8f0bab985e736e840a4f7704ef36ac0c159a7617bc5ebf0df46b1260e2e0bf
|
File details
Details for the file batread-1.1.0-py3-none-any.whl.
File metadata
- Download URL: batread-1.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9601206b768b5aa8c6b5d2044e14bf2eae4d89f886347af364299457cdcc6d61
|
|
| MD5 |
1ca7734e10e70124b9f0339472749283
|
|
| BLAKE2b-256 |
d0f149298b334908b19028725faada8138062db520139d7d1557116ce8c258b5
|