energy_analysis.chile_fleet.io#
Strict hourly schema validation and bounded, per-site Arrow scans.
- energy_analysis.chile_fleet.io.read_table(path)[source]#
Read a small registry or CSV; production hourly inputs should be Parquet.
- Parameters:
path (Path)
- Return type:
DataFrame
- energy_analysis.chile_fleet.io.normalize_ids(values)[source]#
Keep stable string identifiers; reject missing and whitespace-only IDs.
- Parameters:
values (Series)
- Return type:
Series
- energy_analysis.chile_fleet.io.parse_utc(values)[source]#
Reject naive civil times, then normalize explicit offsets to UTC.
- Parameters:
values (Series)
- Return type:
DatetimeIndex
- energy_analysis.chile_fleet.io.validate_hourly(frame, *, require_actual=True)[source]#
Validate site-hour keys without replacing zero, missing or negative values.
- Parameters:
frame (DataFrame)
require_actual (bool)
- Return type:
DataFrame
- energy_analysis.chile_fleet.io.boolean_values(values, label)[source]#
Decode bool/0/1/string booleans without Python’s truthy-string trap.
- Parameters:
values (Series)
label (str)
- Return type:
Series
- energy_analysis.chile_fleet.io.load_sites(path)[source]#
Preserve every registry row, including sites lacking coordinates or data.
- Parameters:
path (Path)
- Return type:
DataFrame
- class energy_analysis.chile_fleet.io.SiteDataSource(path, *, require_actual=True)[source]#
Bases:
objectRead one site at a time, using Arrow predicate pushdown for Parquet.
CSV is a convenience for small files (at most one million rows). Partition production datasets by site_id to avoid scanning unrelated row groups.
- Parameters:
path (Path)
require_actual (bool)
- energy_analysis.chile_fleet.io.input_files(path)[source]#
- Parameters:
path (Path)
- Return type:
Iterator[Path]
- energy_analysis.chile_fleet.io.fingerprint(path, *, contents=True)[source]#
Hash all source files once; no tokens or request URLs enter provenance.
- Parameters:
path (Path)
contents (bool)
- Return type:
dict[str, object]
- energy_analysis.chile_fleet.io.json_safe(value)[source]#
JSON serialization with explicit nulls for nonfinite scientific values.
- Parameters:
value (object)
- Return type:
object
- energy_analysis.chile_fleet.io.write_json(path, value)[source]#
- Parameters:
path (Path)
value (object)
- Return type:
None
- energy_analysis.chile_fleet.io.row_mapping(frame)[source]#
- Parameters:
frame (DataFrame)
- Return type:
Iterator[dict[str, object]]