2.7.3.2. pycsamt.airborne.io#
Common native-I/O dispatcher for airborne EM deliveries.
No vendor reader is registered by default. Technology adapters already accept decoded scientific arrays; native readers should enter this registry only when their actual delivery schema has been verified from a representative file or an authoritative format specification.
Architecturally this module mirrors pycsamt.io.formats /
pycsamt.io.transfer (detect_tf_format(),
read_transfer_function()): a
AirborneFormatDefinition registry
resolved by detector-then-extension, dispatched through one stable
public entry point. The two are deliberately not the same registry,
because they operate on different units of work: pycsamt.io
readers/writers exchange one site’s transfer function (EDI/EMTF XML),
while this module exchanges a whole-survey
AirborneEMDataset (many flight lines,
each with many samples). AirborneIOError is a RuntimeError
rather than TransferFunctionFormatError’s
ValueError for the same reason it exists at all right now: every
failure currently reachable here is “no native reader/writer is
registered for this technology yet” – a capability gap, not bad user
input – because, per the project roadmap, no vendor has supplied a
delivery sample to validate a native decoder against (see
pycsamt.airborne.mobilemt for why that is permanent for
MobileMT specifically). Should a genuine format-detection-from-bad-
input failure mode be added later, reconsider this rather than
assuming that day is today.
Functions
|
Return native formats with a registered reader. |
|
Return native formats with a registered writer. |
|
Read one verified native airborne delivery into the common dataset. |
|
Write a dataset through a verified native airborne writer. |
Exceptions
Raised when no defensible native airborne I/O path is available. |
- exception pycsamt.airborne.io.AirborneIOError[source]
Bases:
RuntimeErrorRaised when no defensible native airborne I/O path is available.
See the module docstring for why this is a
RuntimeErrorrather than aValueError.
- pycsamt.airborne.io.read_airborne(source, *, format=None, technology=None, **kwargs)[source]
Read one verified native airborne delivery into the common dataset.
- Parameters:
source (Any) – Delivery to read: typically a path, though the concrete type accepted depends on the registered reader. Passing an existing
AirborneEMDatasetis an intentional no-op when format is not explicitly requested, so pipeline code can call this uniformly whether it already has a dataset or a raw delivery.format (str, optional) – Explicit registered format name or alias. When omitted, content/extension-based detection selects the format.
technology (str, optional) – Restrict resolution to one technology’s formats; see
_resolved_format().**kwargs – Forwarded to the selected format’s registered reader.
- Returns:
The dataset produced by the resolved reader, or source itself when it already was one and format was omitted.
- Return type:
- Raises:
AirborneIOError – If no reader can be resolved for source (see
_resolved_format()), or if the resolved format has no registered reader, or if that reader does not return anAirborneEMDataset.
- pycsamt.airborne.io.write_airborne(dataset, target, *, format=None, technology=None, **kwargs)[source]
Write a dataset through a verified native airborne writer.
- Parameters:
dataset (AirborneEMDataset) – Dataset to serialize.
target (Any) – Output destination. When format is omitted, target must be a path/string with an extension that resolves unambiguously via
detect_airborne_format().format (str, optional) – Explicit registered format name or alias.
technology (str, optional) – Restrict resolution to one technology’s formats; see
_resolved_format().**kwargs – Forwarded to the selected format’s registered writer.
- Returns:
Whatever the resolved writer returns; not constrained by this dispatcher.
- Return type:
Any
- Raises:
TypeError – If dataset is not an
AirborneEMDataset.AirborneIOError – If format is omitted and cannot be inferred from target, if no writer can otherwise be resolved (see
_resolved_format()), or if the resolved format has no registered writer.
- pycsamt.airborne.io.available_airborne_readers(*, technology=None)[source]
Return native formats with a registered reader.
- Parameters:
technology (str, optional) – Restrict to one technology’s formats;
Nonelists across all registered technologies.- Returns:
Canonical format names currently readable. Empty until a native reader has been registered for at least one format; see the module docstring.
- Return type:
- Raises:
AirborneIOError – If technology is given but not registered.
- pycsamt.airborne.io.available_airborne_writers(*, technology=None)[source]
Return native formats with a registered writer.
- Parameters:
technology (str, optional) – Restrict to one technology’s formats;
Nonelists across all registered technologies.- Returns:
Canonical format names currently writable. Empty until a native writer has been registered for at least one format; see the module docstring.
- Return type:
- Raises:
AirborneIOError – If technology is given but not registered.