x3pio
Read and write ISO 25178-72 x3p files (.x3p) in Python.
x3p is the format of ISO 25178-72:2017 and Amd 1:2020 for the storage and exchange of topography and profile data. It stores profiles, surfaces on a regular or an irregular grid, in one or several layers, and point clouds as 3-D coordinates in a right-handed coordinate system, together with the metadata of the measurement and optional files of a vendor.
Installation
pip install x3pio
Usage
import numpy as np
import x3pio
# The metadata describes the measurement. The standard asks for a creation date, which a new
# file sets to now if the record has none, and for the kind of probing system.
metadata = x3pio.Metadata(
creator="Jane Doe",
instrument=x3pio.Instrument("Acme Metrology", "Scanner 3000", "12345", "firmware 2.1"),
probing_system=x3pio.ProbingSystem(x3pio.ProbingType.NON_CONTACTING, "confocal, 50x objective"),
comment="Reference artefact",
)
heights = np.zeros((480, 640)) # in metres
x3pio.write("surface.x3p", heights, x_scale=1e-6, y_scale=1e-6, metadata=metadata)
x3p = x3pio.read("surface.x3p")
print(type(x3p).__name__, len(x3p.layers)) # Surface 1
print(x3p.layers[0].z.shape) # (480, 640), the heights in metres
print(x3p.layers[0].points().shape) # (480, 640, 3), x, y and z in metres
print(x3p.metadata.instrument.model) # Scanner 3000
x3pio.read returns a Profile, a Surface or a PointCloud, according to the file. The data
is in the layers: x3p.layers holds them. A layer gives its heights z, its coordinates x and
y and its points(), which are in the global coordinate system. A point that was not measured is
NaN. A point cloud has exactly one layer, which is its layer, and x3pio.write_points writes
it.
The arrays of a layer belong to the file: change them in place and save the file again, or give
a file other layers with with_layers, which keeps its metadata.
Without metadata, a new file names x3pio as its software. x3pio.info(path) reads the
description of a file, its axes, shape, metadata and vendor files, without reading the data.
Documentation
- x3p Format: what an x3p file contains.
- Examples: a short script for each topic, in
the
examples/folder.
Command Line
x3pio info surface.x3p
x3pio convert -s xml surface.x3p surface_xml.x3p
x3pio convert -t int16 surface.x3p surface_int16.x3p
x3pio convert -r ISO5436_2000 surface.x3p surface_2000.x3p
convert changes the storage form (-s, xml or binary), the z data type (-t) and the
revision (-r) independently and repairs deviations of the source. With -f/--fix it drops
what cannot be written instead of failing: metadata without a date or a probing type, and vendor
extensions when converting to ISO 25178-72:2017. The command line also runs as python -m x3pio.
Development
python3 -m venv .venv # Windows: python -m venv .venv
source .venv/bin/activate # Windows (PowerShell): .venv\Scripts\Activate.ps1
pip install -e . --group dev
pre-commit install
pytest
pre-commit run --all-files
pip-audit
References
Metadata
Release files for x3pio 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| x3pio-1.1.0.tar.gz | 2.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| x3pio-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.1 MB
Release files / x3pio-1.1.0.tar.gz
| Download URL | x3pio-1.1.0.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37f737de35dd8d8bd6831bec98b2d154a901b4c625a3ccbc51646a4eddfbb4f6
|
|
BLAKE2b-256 checksum How to use checksums |
40de6cb4047a04d6411d61208823487033f1e37e5d25194b9814876401694a06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.
Transparency logRelease files / x3pio-1.1.0-py3-none-any.whl
| Download URL | x3pio-1.1.0-py3-none-any.whl |
|---|---|
| Size | 77.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85d487241c5b2bc38da6b38b63b8b0b3dcff86e294ebfbf43321a60ee9125c5a
|
|
BLAKE2b-256 checksum How to use checksums |
532eb86cf51d7d38d0c5cb75fbeee4a3bbba8eae7f4703fe24e7076612331799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.
Transparency log