Skip to content

Import: DistOPF → CIM

The importer reads a DistOPF case directory of CSV files and parses each into typed records defined by the LinkML schema.

Basic Usage

from cimhub_distopf.importer.distopf_to_cim import distopf_to_cim

records = distopf_to_cim("/path/to/case/")

The return value is a dict mapping each record class (BusRecord, BranchRecord, GeneratorRecord, CapacitorRecord, BatteryRecord, RegulatorRecord, ScheduleRecord) to a list of parsed instances.

Pipeline

DistOPF CSV  →  DistopfReader  →  LinkML records  →  (CIM FeederModel)

distopf_to_cim wraps DistopfReader, reading each known record type from the case directory.

Work in progress

The importer currently returns DistOPF LinkML records, not fully constructed CIM objects. CIM construction from these records (via the per-type importer converters — bus.py, branch.py, …) is being wired into the importer registry. Until then, use the records directly or rely on the exporter for the mature CIM ↔ DistOPF path.