Update src/seismic_hazard_forecasting.py

fix attempt 2
This commit is contained in:
2026-06-22 19:23:13 +02:00
parent 0ef41d72f6
commit 3d4f9138d7
+13
View File
@@ -803,6 +803,19 @@ verbose: {verbose}")
iml_grid_prep = iml_grid.copy() # temp ground motion grids iml_grid_prep = iml_grid.copy() # temp ground motion grids
if use_AOI: if use_AOI:
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: for i in indices:
if i in indices_filtered: if i in indices_filtered:
for j in range(0, len(products)): for j in range(0, len(products)):