Repository navigation
Releases: aschet/sdfio
Release list
v2.0.0
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.binaryis replaced byHeader.format.num_pointsandnum_profilesare gone; usesdf.data.shape.SdfFile.data_typeandSdfFile.openare removed; useheader.data_typeandsdfio.read.- A
Headerrejects an unsupported data type, a non-positivez_scaleand a non-ASCIImanufacturer_id. z_scalenow defaults to"auto", andMetadatadates default to"now".Nonemeans "not recorded".SdfFormatErroris also aValueError.- Codec helpers such as
encode_rawandget_data_typeare no longer in the top-level API.
New
SdfFile.from_arrayandSdfFile.with_data.with_revision(..., refit_z_scale=True).Revision.rules, for examplemax_binary_count.- Four examples:
write,read,modifyandplot.
Changed
- Dates are held as UTC. Older revisions still store local time on disk.
- Reading tolerates a byte order mark and
NaNasBAD.
Fixed
- A truncated or oversized binary header now raises
SdfFormatErrorinstead ofstruct.errororOverflowError.
v1.4.0
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
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
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
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
v1.0.0
Initial release.
- Read and write ISO 25178-71 SDF files (ASCII and binary), including the pre-standardization BCR-1.0 dialect.
- NumPy-based
SdfFileAPI and asdfioCLI (info,convert). - Verified against real-world SDF files and against MountainsMap, Gwyddion, and surfalize.