Update src/seismic_hazard_forecasting.py

This commit is contained in:
2026-06-23 03:21:53 +02:00
parent 13b463a15a
commit 92b6eb4880
+14 -14
View File
@@ -768,7 +768,7 @@ verbose: {verbose}")
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=IMT_max, rx_label=i, log_level=logging.DEBUG, imt=imt, IMT_min=0.0, IMT_max=IMT_max, rx_label=i,
rtol=0.01, use_cython=True) for i in iter] rtol=0.1, use_cython=True) for i in iter]
iml = dask.compute(*imls) iml = dask.compute(*imls)
iml_grid_raw.append(list(iml)) iml_grid_raw.append(list(iml))
@@ -805,18 +805,18 @@ verbose: {verbose}")
iml_grid = [[] for _ in range(len(products))] # final ground motion grids iml_grid = [[] for _ in range(len(products))] # final ground motion grids
iml_grid_prep = iml_grid.copy() # temp ground motion grids iml_grid_prep = iml_grid.copy() # temp ground motion grids
if use_AOI or exclude_low_fxy: #if use_AOI or exclude_low_fxy:
for j in range(0, len(products)): for j in range(0, len(products)):
# Reassemble the grid cleanly using the original shape # Reassemble the grid cleanly using the original shape
# Initialize a flat array filled entirely with NaNs # Initialize a flat array filled entirely with NaNs
iml_grid_flat = np.full(num_points, np.nan, dtype=np.float64) iml_grid_flat = np.full(num_points, np.nan, dtype=np.float64)
# Assign the computed values to their exact original 1D index positions # Assign the computed values to their exact original 1D index positions
iml_grid_flat[indices_filtered] = iml_grid_raw[j] iml_grid_flat[indices_filtered] = iml_grid_raw[j]
# Reshape back using the exact shape of your original xx/yy grids # Reshape back using the exact shape of your original xx/yy grids
iml_grid_prep[j] = iml_grid_flat.reshape(grid_shape) iml_grid_prep[j] = iml_grid_flat.reshape(grid_shape)
#for i in indices: #for i in indices:
@@ -834,8 +834,8 @@ verbose: {verbose}")
# else: # else:
# list(map(lambda lst: lst.append(np.nan), # list(map(lambda lst: lst.append(np.nan),
# iml_grid_prep)) # use np.nan to indicate grid point excluded # iml_grid_prep)) # use np.nan to indicate grid point excluded
else: #else:
iml_grid_prep = iml_grid_raw # iml_grid_prep = iml_grid_raw
for j in range(0, len(products)): for j in range(0, len(products)):
vmin = np.nanmin(iml_grid_prep[j]) vmin = np.nanmin(iml_grid_prep[j])