geopulse.io.hdf5
Schema-versioned HDF5 reader/writer.
Every file written by GeoPulse carries a schema_version attribute at the
root. The reader migrates older schemas forward automatically so that files
written by previous versions remain readable. Writers always emit the current
schema.
Layout (schema v1):
/
attrs:
schema_version int
geopulse_version str
created_utc str (ISO-8601)
description str
source/ (optional)
attrs: {station_id, latitude_deg, longitude_deg, sampling_rate_Hz}
time_s, bx_T, by_T, bz_T datasets
earth/ (optional)
attrs: {model_name, tier}
impedance/ group with impedance-specific layout
results/ (optional)
efield/ Ex_Vm, Ey_Vm
gic/ node_ids, currents_A
Module Attributes
Integer schema version — bump on any breaking change to the layout. |
Functions
|
Read an HDF5 file, migrating older schemas forward. |
|
Write results to HDF5 with the current schema version. |
- geopulse.io.hdf5.CURRENT_SCHEMA_VERSION: int = 1
Integer schema version — bump on any breaking change to the layout.
- geopulse.io.hdf5.write_results(path, description='', **groups)[source]
Write results to HDF5 with the current schema version.
- Parameters:
- Return type:
Examples
>>> import numpy as np, tempfile, os >>> tmp = tempfile.NamedTemporaryFile(suffix='.h5', delete=False).name >>> write_results(tmp, description="demo", ... source={"time_s": np.arange(10.0)}) >>> data = read_results(tmp) >>> data["source"]["time_s"].shape (10,) >>> os.unlink(tmp)