From 337457d49cf0d5ef22981e8eda7ebe46ad0b5f99 Mon Sep 17 00:00:00 2001 From: ftong <95+ftong@noreply.example.org> Date: Mon, 22 Jun 2026 22:58:10 +0200 Subject: [PATCH] Update src/seismic_hazard_forecasting.py --- src/seismic_hazard_forecasting.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/seismic_hazard_forecasting.py b/src/seismic_hazard_forecasting.py index 1b7880e..ee252b0 100644 --- a/src/seismic_hazard_forecasting.py +++ b/src/seismic_hazard_forecasting.py @@ -767,7 +767,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.1, use_cython=True) for i in iter] + rtol=0.1, use_cython=False) for i in iter] iml = dask.compute(*imls) iml_grid_raw.append(list(iml)) @@ -837,19 +837,18 @@ verbose: {verbose}") for j in range(0, len(products)): vmin = min(x for x in iml_grid_prep[j] if x is not np.nan) vmax = max(x for x in iml_grid_prep[j] if x is not np.nan) - iml_grid[j] = np.reshape(iml_grid_prep[j], (nx, ny)).astype( - dtype=np.float64) # this reduces values to 8 decimal places + iml_grid[j] = np.reshape(iml_grid_prep[j], (nx, ny)).astype(dtype=np.float64) # this reduces values to 8 decimal places iml_grid_tmp = np.nan_to_num(iml_grid[j]) # change nans to zeroes # upscale the grid, trim, and interpolate if there are at least 10 grid values with range greater than 0.1 - if np.count_nonzero(iml_grid_tmp) >= 10 and vmax-vmin > 0.1: - up_factor = 1 - iml_grid_hd = resize(iml_grid_tmp, (up_factor * len(iml_grid_tmp), up_factor * len(iml_grid_tmp)), - mode='reflect', anti_aliasing=False) - trim_thresh = vmin - iml_grid_hd[iml_grid_hd < trim_thresh] = np.nan - else: - iml_grid_hd = iml_grid_tmp + #if np.count_nonzero(iml_grid_tmp) >= 10 and vmax-vmin > 0.1: + # up_factor = 1 + # iml_grid_hd = resize(iml_grid_tmp, (up_factor * len(iml_grid_tmp), up_factor * len(iml_grid_tmp)), + # mode='reflect', anti_aliasing=False) + # trim_thresh = vmin + # iml_grid_hd[iml_grid_hd < trim_thresh] = np.nan + #else: + iml_grid_hd = iml_grid_tmp iml_grid_hd[iml_grid_hd == 0.0] = np.nan # change zeroes back to nan