Update src/seismic_hazard_forecasting.py
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
def my_trivial_task(x):
|
||||||
|
"""
|
||||||
|
A function that does a trivial task
|
||||||
|
"""
|
||||||
|
return x * x
|
||||||
|
|
||||||
def main(catalog_file, mc_file, pdf_file, m_file, m_select, mag_label, mc, m_max,
|
def main(catalog_file, mc_file, pdf_file, m_file, m_select, mag_label, mc, m_max,
|
||||||
m_kde_method, xy_select, grid_dim, xy_win_method, rate_select, time_win_duration,
|
m_kde_method, xy_select, grid_dim, xy_win_method, rate_select, time_win_duration,
|
||||||
@@ -454,7 +458,7 @@ verbose: {verbose}")
|
|||||||
|
|
||||||
start = timer()
|
start = timer()
|
||||||
|
|
||||||
use_pp = False
|
use_pp = True
|
||||||
|
|
||||||
if use_pp: # use dask parallel computing
|
if use_pp: # use dask parallel computing
|
||||||
pbar = ProgressBar()
|
pbar = ProgressBar()
|
||||||
@@ -465,13 +469,17 @@ verbose: {verbose}")
|
|||||||
for imt in products:
|
for imt in products:
|
||||||
logger.info(f"Estimating {imt}")
|
logger.info(f"Estimating {imt}")
|
||||||
|
|
||||||
imls = [dask.delayed(compute_IMT_exceedance)(rx_lat[i], rx_lon[i], distances[i].flatten(), fr, p, lambdas,
|
#imls = [dask.delayed(compute_IMT_exceedance)(rx_lat[i], rx_lon[i], distances[i].flatten(), fr, p, lambdas,
|
||||||
forecast_len, lambdas_perc, m_range, m_pdf, m_cdf, model,
|
# forecast_len, lambdas_perc, m_range, m_pdf, m_cdf, model,
|
||||||
log_level=logging.DEBUG, imt=imt, IMT_min=0.0, IMT_max=2.0, rx_label=i,
|
# log_level=logging.DEBUG, imt=imt, IMT_min=0.0, IMT_max=2.0, rx_label=i,
|
||||||
rtol=0.1, use_cython=True) for i in iter]
|
# rtol=0.1, use_cython=True) for i in iter]
|
||||||
|
imls = [dask.delayed(my_trivial_task)(i) for i in iter]
|
||||||
iml = dask.compute(*imls)
|
iml = dask.compute(*imls)
|
||||||
iml_grid_raw.append(list(iml))
|
iml_grid_raw.append(list(iml))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
iml_grid_raw = []
|
iml_grid_raw = []
|
||||||
iter = indices
|
iter = indices
|
||||||
|
Reference in New Issue
Block a user