Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions nshmdb/nshmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,21 @@ def get_fault_names(self) -> set[str]:
name
for (name,) in conn.execute("SELECT name FROM parent_fault").fetchall()
}

def get_fault_ids(self) -> set[int]:
"""Get the list of fault ids in the database.

Returns
-------
set[int]
The list of fault ids.
"""
with self.connection() as conn:
return {
fault_id
for (fault_id,) in conn.execute("SELECT fault_id FROM fault").fetchall()
}

def query(
self,
query_str: str,
Expand Down
3 changes: 3 additions & 0 deletions nshmdb/scripts/nshm_db_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,6 @@ def main(
rupture_fault_join_df.to_sql(
"rupture_faults", conn, index=False, if_exists="append"
)

if __name__ == "__main__":
app()