Skip to main content

x3pio

CI Docs PyPI

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for x3pio 1.0.0
File Size Uploaded
x3pio-1.0.0.tar.gz 2.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for x3pio 1.0.0
File Interpreter ABI Platform
x3pio-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.1 MB

Release files / x3pio-1.0.0.tar.gz

Download URL x3pio-1.0.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
dc509e73ff04274d3082a8528d83c75d6b8cc38bd07740d569c2f6c491c5c397
BLAKE2b-256 checksum
How to use checksums
2660b67a21c905a874d14a6f922acb46741c42bd2691e6fd8eb1b96be93a9a8f
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 10, 2026.

Transparency log

Release files / x3pio-1.0.0-py3-none-any.whl

Download URL x3pio-1.0.0-py3-none-any.whl
Size 77.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10f250e5205048ebf49eec27f2cdccd8158bae85a270a2aa1ea20b1d164ee445
BLAKE2b-256 checksum
How to use checksums
92b5bddeec2bc8523772f04d54fef270df05ebdb36c2498a223b9eb8e3ed218a
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 10, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.0

2 release files

1.1.0

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page