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.2.tar.gz (9.8 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.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: seissolxdmfwriter-0.4.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for seissolxdmfwriter-0.4.2.tar.gz
Algorithm Hash digest
SHA256 de79e5ea168f88821bb9a86205bddfc878d6fff5f3f6b0ff142d38a181ae4635
MD5 765f6f86c1ac32a53b38d937a58e6c65
BLAKE2b-256 ff2211cbaba948109f4b59319154a563a0befb143d5769990fe68da1b343d886

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for seissolxdmfwriter-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb175045f95a7262d716c7008e7023f1ac725244637a58fe284c27efc887517a
MD5 e1c40ce83d0bac770c21a17882f8d888
BLAKE2b-256 5952981f858d8575277fad8daff8747d632fbfa8f9f800713ff3931539f28076

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