Data Types
Bases: ABC
Abstract interface for data containers.
Overview
Declares the contract for concrete data types used across the project.
- Abstract methods: read_file, get_data, get_units, get_allowed_observables.
- Intended as a minimal API that all data loaders/adapters must implement.
Usage Notes
Implementations should populate an internal representation and match the return expectations used by callers elsewhere in the codebase.
Source code in contracts\data_types.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
Bases: Data
Base implementation providing common behaviors for data types.
Overview
Supplies shared storage and partial method implementations useful to subclasses.
- Manages
raw_dataand_allowed_observables. - Requires a
file_readerconforming toFileReaderFnfor loading raw data. - Implements datetime extraction from filenames,
get_data,get_units, andget_allowed_observables. - Leaves
read_fileabstract so subclasses can:- call
self.file_reader(filepath) - interpret its output into domain-specific observables.
- call
Usage Notes
Subclasses must implement read_file and populate raw_data / _allowed_observables.
get_data raises ValueError for unsupported observables.
Source code in contracts\data_types.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |