custom AOI feature, changes to plotting and activity rate calculation #24

Merged
ymlesni merged 50 commits from July2026 into master 2026-07-22 12:43:46 +02:00
Showing only changes of commit 92b6eb4880 - Show all commits
+12 -12
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,
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)
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]
# 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)
# 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])