From 92b6eb4880244272f9f4b0639a7e6c62e4d1f491 Mon Sep 17 00:00:00 2001 From: ftong <95+ftong@noreply.example.org> Date: Tue, 23 Jun 2026 03:21:53 +0200 Subject: [PATCH] Update src/seismic_hazard_forecasting.py --- src/seismic_hazard_forecasting.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/seismic_hazard_forecasting.py b/src/seismic_hazard_forecasting.py index b9e3ed7..8612321 100644 --- a/src/seismic_hazard_forecasting.py +++ b/src/seismic_hazard_forecasting.py @@ -768,7 +768,7 @@ verbose: {verbose}") 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, 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_grid_raw.append(list(iml)) @@ -805,18 +805,18 @@ verbose: {verbose}") iml_grid = [[] for _ in range(len(products))] # final 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)): - # Reassemble the grid cleanly using the original shape - # Initialize a flat array filled entirely with NaNs - iml_grid_flat = np.full(num_points, np.nan, dtype=np.float64) - - # Assign the computed values to their exact original 1D index positions - iml_grid_flat[indices_filtered] = iml_grid_raw[j] - - # Reshape back using the exact shape of your original xx/yy grids - iml_grid_prep[j] = iml_grid_flat.reshape(grid_shape) + for j in range(0, len(products)): + # Reassemble the grid cleanly using the original shape + # Initialize a flat array filled entirely with NaNs + iml_grid_flat = np.full(num_points, np.nan, dtype=np.float64) + + # Assign the computed values to their exact original 1D index positions + iml_grid_flat[indices_filtered] = iml_grid_raw[j] + + # Reshape back using the exact shape of your original xx/yy grids + iml_grid_prep[j] = iml_grid_flat.reshape(grid_shape) #for i in indices: @@ -834,8 +834,8 @@ verbose: {verbose}") # else: # list(map(lambda lst: lst.append(np.nan), # iml_grid_prep)) # use np.nan to indicate grid point excluded - else: - iml_grid_prep = iml_grid_raw + #else: + # iml_grid_prep = iml_grid_raw for j in range(0, len(products)): vmin = np.nanmin(iml_grid_prep[j])