Skip to content

Releases: aschet/sdfio

v2.0.0

Choose a tag to compare

@aschet aschet released this 16 Oct 14:04
9642e6d

Breaking release. The API is renamed to follow the standard, and the header now checks what it is given.

Breaking

  • Renamed: SdfDialect → Revision, SdfHeader → Header, SdfMetadata → Metadata, with_dialect → with_revision, --dialect → --revision.
  • Header.binary is replaced by Header.format. num_points and num_profiles are gone; use sdf.data.shape.
  • SdfFile.data_type and SdfFile.open are removed; use header.data_type and sdfio.read.
  • A Header rejects an unsupported data type, a non-positive z_scale and a non-ASCII manufacturer_id.
  • z_scale now defaults to "auto", and Metadata dates default to "now". None means "not recorded".
  • SdfFormatError is also a ValueError.
  • Codec helpers such as encode_raw and get_data_type are no longer in the top-level API.

New

  • SdfFile.from_array and SdfFile.with_data.
  • with_revision(..., refit_z_scale=True).
  • Revision.rules, for example max_binary_count.
  • Four examples: write, read, modify and plot.

Changed

  • Dates are held as UTC. Older revisions still store local time on disk.
  • Reading tolerates a byte order mark and NaN as BAD.

Fixed

  • A truncated or oversized binary header now raises SdfFormatError instead of struct.error or OverflowError.

v1.4.0

Choose a tag to compare

@aschet aschet released this 10 Oct 13:26

Added SdfFile.points(drop_invalid=False), which returns the points of the grid as a (num_profiles, num_points, 3) array of x, y and z in metres. With drop_invalid=True it returns the (N, 3) array of the measured points, which point cloud libraries take.

Added a description of the format to the documentation, example scripts for the common use cases, and synthetic sample files of each dialect.

v1.3.0

Choose a tag to compare

@aschet aschet released this 30 Sep 20:25

Added the BCR-1.0 data types uint8, uint16 and uint32 (codes 0-2), as DataType.UINT8, UINT16, UINT32. They are BCR-1.0 only.

Added the BCR-1.0 ASCII conventions: ; comments, DataType, Compression and CheckType given as names (INTEGER, NULL, ...) or as a number, and bad data marked by the type's maximum value as a number.

Added reading of ASCII records that end in CR or LF instead of CRLF, and of an upper case A/B as the first magic character. sdfio.MAGICS now includes the upper case variants.

Changed: in BCR-1.0, a floating point value at or above 3.4E+38 (binary32) or 1.7E+308 (binary64) is bad data, as the specification defines, instead of only the largest representable value.

Changed: BCR-1.0 ASCII files now write a non-measured point as the type's maximum instead of BAD, which the BCR-1.0 specification doesn't have. ISO output is unchanged.

Fixed: a valid value that rounds to the invalid-point sentinel of an integer type (for example when converting uint16 to int16) was silently read back as NaN; writing it now fails with an error.

v1.2.1

Choose a tag to compare

@aschet aschet released this 24 Sep 11:06

Fixed: a binary file's ManufacID that's NUL-terminated instead of space-padded (as some real-world writers do, contradicting the standard) is now truncated at the NUL byte on read, instead of the undefined bytes past it being decoded into the value.

v1.2.0

Choose a tag to compare

@aschet aschet released this 23 Sep 20:26

Breaking: ISO-2.0's trailer now requires the tagged Name = Value format (same as the header), not XML, per the final draft of ISO 25178-71:2026. SdfDialect.requires_xml_trailer and SdfFile.trailer_xml are removed.

Breaking: CLI -r/--remove-trailer is removed. -x/--fix-trailer now handles all trailer clean-up, dialect-aware (tagged-format salvage for ISO-2.0, ASCII-only fixups otherwise).

Added SdfFile.trailer_fields to read/write the trailer as a dict of tagged fields, and exported parse_tagged_fields, format_tagged_fields, sanitize_tagged_fields, validate_trailer_ascii, validate_trailer_tagged at the top level.

Fixed: reading a file no longer fails because of a malformed or non-ASCII trailer; only writing still validates it.

Fixed: a spurious blank line before the trailer's closing * in ASCII output.

v1.1.0

Choose a tag to compare

@aschet aschet released this 20 Sep 13:57

Added sdfio.MAGICS, every file magic sdfio can read, for magic-sniffing file type detection.

v1.0.0

Choose a tag to compare

@aschet aschet released this 19 Sep 11:17

Initial release.

  • Read and write ISO 25178-71 SDF files (ASCII and binary), including the pre-standardization BCR-1.0 dialect.
  • NumPy-based SdfFile API and a sdfio CLI (info, convert).
  • Verified against real-world SDF files and against MountainsMap, Gwyddion, and surfalize.