Update src/seismic_hazard_forecasting.py
This commit is contained in:
@@ -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.1, use_cython=False) for i in iter]
|
||||
rtol=0.1, use_cython=True) for i in iter]
|
||||
iml = dask.compute(*imls)
|
||||
iml_grid_raw.append(list(iml))
|
||||
|
||||
@@ -838,10 +838,11 @@ verbose: {verbose}")
|
||||
iml_grid_prep = iml_grid_raw
|
||||
|
||||
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_tmp = np.nan_to_num(iml_grid[j]) # change nans to zeroes
|
||||
vmin = np.nanmin(iml_grid_prep[j])
|
||||
vmax = np.nanmax(iml_grid_prep[j])
|
||||
|
||||
#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:
|
||||
@@ -851,13 +852,13 @@ verbose: {verbose}")
|
||||
# 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_tmp
|
||||
|
||||
iml_grid_hd[iml_grid_hd == 0.0] = np.nan # change zeroes back to nan
|
||||
#iml_grid_hd[iml_grid_hd == 0.0] = np.nan # change zeroes back to nan
|
||||
|
||||
|
||||
iml_grid_hd = iml_grid_prep[j]
|
||||
#vmin_hd = min(x for x in iml_grid_hd.flatten() if not isnan(x))
|
||||
vmax_hd = max(x for x in iml_grid_hd.flatten() if not isnan(x))
|
||||
vmax_hd = np.nanmax(iml_grid_hd.flatten())
|
||||
|
||||
# generate image overlay
|
||||
north, south = lat.max(), lat.min() # Latitude range
|
||||
|
||||
Reference in New Issue
Block a user