Exporters (batdata.exporters)#

Tools for exporting battery data into a format usable by other tools

Base Class (b.exporters.base)#

Interface definitions

class batdata.exporters.base.DatasetExporter#

Bases: object

Tool which exports data from a BatteryDataset to disk in a specific format

Implementing an Exporter#

export(dataset: BatteryDataset, path: Path)#

Write the dataset to disk in a specific path

All files from the dataset must be placed in the provided directory

Parameters:
  • dataset – Dataset to be exported

  • path – Output path

Battery Archive (b.exporters.ba)#

Tools for streamlining upload to Battery Archive

class batdata.exporters.ba.BatteryArchiveExporter(chunk_size: int = 100000)#

Bases: DatasetExporter

Export data into CSV files that follow the format definitions used in BatteryArchive

The exporter writes files for each table in the Battery Archive SQL schema with column names matches to their definitions.

chunk_size: int = 100000#

Maximum number of rows to write to disk in a single CSV file

export(dataset: BatteryDataset, path: Path)#

Write the dataset to disk in a specific path

All files from the dataset must be placed in the provided directory

Parameters:
  • dataset – Dataset to be exported

  • path – Output path

write_cycle_stats(cell_id: str, data: DataFrame, path: Path)#

Write the cycle stats to disk

Parameters:
  • cell_id – Name of the cell

  • data – Cycle stats dataframe

  • path – Path to the output directory

write_metadata(cell_id: str, metadata: BatteryMetadata, path: Path)#

Write the metadata into a JSON file

Parameters:
  • cell_id – ID for the cell

  • metadata – Metadata to be written

  • path – Path in which to write the data

write_timeseries(cell_id: str, data: DataFrame, path: Path)#

Write the time series dataset

Parameters:
  • cell_id – Name for the cell, used as a foreign key to map between tables

  • data – Time series data to write to disk

  • path – Root path for writing cycling data