Skip to content

Commit

Permalink
Small renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
micheles committed Oct 15, 2024
1 parent bc0da75 commit fa3406f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion openquake/calculators/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def extract_median_spectra(dstore, what):
qdict = parse(what)
[site_id] = qdict['site_id']
[poe_id] = qdict['poe_id']
dset = dstore['log_median_spectra']
dset = dstore['median_spectra']
dic = json.loads(dset.attrs['json'])
spectra = dset[:, site_id, :, :, poe_id] # (Gt, 3, M)
return ArrayWrapper(spectra, dict(
Expand Down
6 changes: 3 additions & 3 deletions openquake/calculators/postproc/median_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def main(dstore, csm):
# save the median_spectrum
Gr = len(csm.src_groups) # number of groups
P = len(oq.poes)
log_median_spectra = np.zeros((Gr, N, 3, M, P), np.float32)
median_spectra = np.zeros((Gr, N, 3, M, P), np.float32)
tot_w = np.zeros((N, M, P))

# create median_spectrum_disagg datasets
Expand All @@ -191,9 +191,9 @@ def main(dstore, csm):
for arr in out:
hdf5.extend(dstore[f'median_spectrum_disagg/grp{grp_id}'], arr)
else:
log_median_spectra[grp_id, site_id] = out
median_spectra[grp_id, site_id] = out
tot_w[site_id] += out[2]
dstore.create_dset("median_spectra", log_median_spectra)
dstore.create_dset("median_spectra", median_spectra)
dstore.set_shape_descr("median_spectra", grp_id=Gr,
site_id=N, kind=['mea', 'sig', 'wei'],
period=periods, poe=oq.poes)
Expand Down
2 changes: 1 addition & 1 deletion openquake/calculators/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ def view_log_median_spectrum(token, dstore):
sid = int(token.split(':')[1])
else:
sid = 0
dset = dstore['log_median_spectra']
dset = dstore['median_spectra']
periods = [imt.period for imt in dstore['oqparam'].imt_periods()]
res = numpy.zeros(len(periods), dt('period value'))
res['period'] = periods
Expand Down
2 changes: 1 addition & 1 deletion openquake/commands/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def make_figure_uhs(extractors, what):
uhs = ex.get(what)
for kind in uhs.kind:
got[ex.calc_id, kind] = uhs[kind][0] # 1 site
if 'log_median_spectra' in ex.dstore:
if 'median_spectra' in ex.dstore:
spec[ex.calc_id] = ex.get(
f'median_spectra?site_id={uhs.site_id[0]}')[:] # (M, P)
oq = ex.oqparam
Expand Down

0 comments on commit fa3406f

Please sign in to comment.