metadata#

pyleem.metadata.convert_win_filetime(timestamp)[source]#

Convert Windows filetime to datetime string.

Windows filetime is a 64-bit value representing 100-nanosecond intervals since January 1, 1601 (UTC). To further convert to local time, need to add the timezone offset.

Parameters:

timestamp (int) – Windows filetime value.

Returns:

Formatted datetime string (YYYY/MM/DD HH:MM:SS.ffffff).

Return type:

str

pyleem.metadata.get_metadata_fixed_header(metabytes)[source]#

Extract and parse metadata from UView .dat file header.

Parameters:

metabytes (bytes) – Raw metadata bytes from file header.

Returns:

Dictionary of metadata entries as (value, unit) tuples.

Return type:

dict

pyleem.metadata.is_tag_in_range(tag, range)[source]#

Check whether tag’s base value is within range.

UView uses the highest bit to mark image overlay. This function masks that bit before checking range. Range min and max can be the same value for a single tag.

Parameters:
  • tag (int) – Integer tag value (0-255).

  • range (tuple) – Tuple (min_base, max_base) defining range.

Returns:

True if base tag is within range, False otherwise.

Return type:

bool

pyleem.metadata.parse_leem_data(data)[source]#

Parse LEEM-specific metadata from extra data block.

LEEM data contains tagged metadata with various formats including standard values, gauge readings, and camera settings.

Parameters:

data (bytes) – LEEM metadata bytes.

Returns:

Dictionary of metadata as (value, unit) tuples.

Return type:

dict

Raises:

ValueError – If an unrecognized tag value is encountered.