GEMS-3D / examples /load_model_and_forward.py
anomy4pub's picture
Add files using upload-large-folder tool
4c9c9d3 verified
Raw
History Blame Contribute Delete
777 Bytes
import numpy as np
from pathlib import Path
root = Path(__file__).resolve().parents[1]
model_path = next((root / "models" / "train").glob("*/*/*/model_bundle.npz"))
rel = model_path.relative_to(root / "models" / "train")
forward_path = root / "forward" / "train" / rel.with_name("forward_bundle.npz")
with np.load(model_path, allow_pickle=True) as bundle:
print("model_path", model_path)
print("vp_model", bundle["vp_model"].shape, bundle["vp_model"].dtype)
print("anomaly_type", bundle["anomaly_type"].item())
with np.load(forward_path, allow_pickle=True) as bundle:
print("forward_path", forward_path)
for key in ("gravity_status", "magnetic_status", "mt_status", "seismic_status"):
if key in bundle:
print(key, bundle[key].item())