Skip to main content

A python writer for SeisSol xdmf output

Project description

seissolxdmfwriter

A python module to write seissol outputs readable by paraview.

import seissolxdmfwriter as sxw
import seissolxdmf as sx
import numpy as np

fn = "test-fault.xdmf"
# Read data from input file using seissolxdmf
sx = sx.seissolxdmf(fn)
geom = sx.ReadGeometry()
connect = sx.ReadConnect()
dt = sx.ReadTimeStep()
outputTimes = sx.ReadTimes()

SRs = sx.ReadData("SRs")
SRd = sx.ReadData("SRd")
SR = np.sqrt(SRs**2 + SRd**2)

# Write the 0,4 and 8th times steps of array SRs and SR in SRtest-fault.xdmf/SRtest-fault.h5
dictTime = {outputTimes[i]: i for i in [0, 4, 8]}
sxw.write(
    "test-fault",
    geom,
    connect,
    {"SRs": SRs, "SR": SR},
    dictTime,
    reduce_precision=True,
    backend="hdf5",
)

# Finally, the module can be use to write data directly from seissolxdmf, limiting
# the memory requirements

sxw.write_from_seissol_output(
    'test-fault-sx',
    sx,
    ['SRs', 'SRd','fault-tag', 'partition'],
    [3,4],
    reduce_precision=True,
    backend="hdf5",
    compression_level=4,
)

The module also encapsulates seissol_output_extractor, which can be used to extract and process data from SeisSol output files, allowing selection of variables, time steps, spatial ranges, and output format. Here is an example of use:

# extracts PSR, Vr and partition, at 2nd and 4th time steps and at simulation time 0.5, from test-fault.xdmf and write into test_new-fault.xdmf
# use seissol_output_extractor --h for additionnal info about the arguments
seissol_output_extractor test-fault.xdmf --time "i2,i4,0.5" --variable PSR Vr partition --add2prefix "_new"

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

seissolxdmfwriter-0.4.5.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

seissolxdmfwriter-0.4.5-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file seissolxdmfwriter-0.4.5.tar.gz.

File metadata

  • Download URL: seissolxdmfwriter-0.4.5.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for seissolxdmfwriter-0.4.5.tar.gz
Algorithm Hash digest
SHA256 025774542df7dc0a680da0df9b57d4cc13253d2de9d4afc1dfb980ffa1dc3a9a
MD5 dfad81fe05bc4654093a1a1fc79e45e9
BLAKE2b-256 fcf7833bbf4fd818e0ada49b7e6b63bc3ba61ef63d733c07ca99f814d2bfcb41

See more details on using hashes here.

File details

Details for the file seissolxdmfwriter-0.4.5-py3-none-any.whl.

File metadata

File hashes

Hashes for seissolxdmfwriter-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fd3b6355256f45e5ba09937294bddb5ba94360b9206e35b675ac26d640fc71a2
MD5 64fee1c9f5b12ff2c51fe5c3ab43ae40
BLAKE2b-256 6fa79e7427195a4357a10cae0e2b122b02c3bffe4e49737a9b02f94d65d683dd

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