Skip to content

Commit

Permalink
Update piezometers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoalopez committed Jun 6, 2024
1 parent edf8bcf commit 87138b7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions grain_size_tools/piezometers.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,27 +157,30 @@ def load_piezometers_from_yaml(filepath: str) -> tuple[str, SimpleNamespace]:
database = yaml.safe_load(file)

# get database version
version = database["database"]["version"]
version = database["database_version"]

# get database metadata
metadata = database["metadata"]

# construct simple dataclasses for all mineral phases
quartz = SimpleNamespace(**database["database"]["mineral_phases"]["quartz"])
olivine = SimpleNamespace(**database["database"]["mineral_phases"]["olivine"])
calcite = SimpleNamespace(**database["database"]["mineral_phases"]["calcite"])
feldspar = SimpleNamespace(**database["database"]["mineral_phases"]["feldspar"])
quartz = SimpleNamespace(**database["data"]["quartz"])
olivine = SimpleNamespace(**database["data"]["olivine"])
calcite = SimpleNamespace(**database["data"]["calcite"])
feldspar = SimpleNamespace(**database["data"]["feldspar"])

piezometers = SimpleNamespace(
quartz=quartz, olivine=olivine, calcite=calcite, feldspar=feldspar
)

return version, piezometers
return version, metadata, piezometers


if __name__ == "__main__":
print("===================================================")
print("Welcome to the GrainSizetool piezometers module")
print("===================================================")

version, piezometers = load_piezometers_from_yaml("piezometric_database.yaml")
version, metadata, piezometers = load_piezometers_from_yaml("piezometric_database.yaml")
print(f"Piezometric database v{version} loaded.")
print("")
print("To get or display piezometric properties use:")
Expand Down

0 comments on commit 87138b7

Please sign in to comment.