Skip to main content

Read BATSRUS output and related Tecplot ASCII .dat and binary .plt datasets

Project description

Python package Codacy Badge Codacy Badge DOI Code style: black

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.dataset 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


Download files

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

Source Distribution

batread-1.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

batread-1.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file batread-1.0.tar.gz.

File metadata

  • Download URL: batread-1.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for batread-1.0.tar.gz
Algorithm Hash digest
SHA256 0b01f5d4a6068ad6d4e8a7f2ab51fb99312173219a8c7071074a2a7aa381571a
MD5 8642ae33d2c22fccd508789e86c85f12
BLAKE2b-256 5ac0287344bce22e80bc5dd38bf21776ed0f3ff9beca97b68fdd891ad010ad91

See more details on using hashes here.

File details

Details for the file batread-1.0-py3-none-any.whl.

File metadata

  • Download URL: batread-1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for batread-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 873970c3064f7da800dd41fe246b6e2ef9d195a960058acda61538bc9df64ffc
MD5 6f500ce799e3f0436699f40aa26e47e0
BLAKE2b-256 c1f02a1a6602cd1f1759040d0b7c74da5116599616f276cbfb9bf0481353bf81

See more details on using hashes here.

Supported by

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