Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing the complete SiteCollection #8990

Merged
merged 1 commit into from
Sep 8, 2023
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
2 changes: 2 additions & 0 deletions openquake/calculators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,8 @@ def _read_risk_data(self):
self.sitecol.calculate_z2pt5()

self.datastore['sitecol'] = self.sitecol
if self.sitecol is not self.sitecol.complete:
self.datastore['complete'] = self.sitecol.complete

# store amplification functions if any
if 'amplification' in oq.inputs:
Expand Down
4 changes: 3 additions & 1 deletion openquake/calculators/export/hazard.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ def export_gmf_data_csv(ekey, dstore):
# exporting sitemesh
f = dstore.build_fname('sitemesh', '', 'csv')
sitecol = dstore['sitecol']
if 'complete' in dstore:
sitecol.complete = dstore['complete']
names = sitecol.array.dtype.names
arr = sitecol[['lon', 'lat']]
if 'custom_site_id' in names:
Expand All @@ -423,7 +425,7 @@ def export_gmf_data_csv(ekey, dstore):
# exporting gmfs
df = dstore.read_df('gmf_data').sort_values(['eid', 'sid'])
if 'custom_site_id' in names:
df['csi'] = decode(sitecol.custom_site_id[df.sid])
df['csi'] = decode(sitecol.complete.custom_site_id[df.sid])
ren = {'csi': 'custom_site_id', 'eid': 'event_id'}
del df['sid']
else:
Expand Down
Loading