interpolation is always used on the final grid

This commit is contained in:
2025-09-12 10:37:03 +02:00
parent f7eb39c43c
commit fe9d886499

View File

@@ -524,22 +524,16 @@ verbose: {verbose}")
up_factor = 4 up_factor = 4
iml_grid_hd = resize(iml_grid_tmp, (up_factor * len(iml_grid_tmp), up_factor * len(iml_grid_tmp)), iml_grid_hd = resize(iml_grid_tmp, (up_factor * len(iml_grid_tmp), up_factor * len(iml_grid_tmp)),
mode='reflect', anti_aliasing=False) mode='reflect', anti_aliasing=False)
interp_method = 'bilinear'
trim_thresh = vmin trim_thresh = vmin
iml_grid_hd[iml_grid_hd < trim_thresh] = np.nan iml_grid_hd[iml_grid_hd < trim_thresh] = np.nan
else: else:
iml_grid_hd = iml_grid_tmp iml_grid_hd = iml_grid_tmp
interp_method = 'none'
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
#vmin_hd = min(x for x in iml_grid_hd.flatten() if not isnan(x)) #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 = max(x for x in iml_grid_hd.flatten() if not isnan(x))
# trim edges so the grid is not so blocky
#trim_thresh = vmin
#iml_grid_hd[iml_grid_hd < trim_thresh] = np.nan
# generate image overlay # generate image overlay
north, south = lat.max(), lat.min() # Latitude range north, south = lat.max(), lat.min() # Latitude range
east, west = lon.max(), lon.min() # Longitude range east, west = lon.max(), lon.min() # Longitude range
@@ -551,7 +545,7 @@ verbose: {verbose}")
cmap_name = 'YlOrRd' cmap_name = 'YlOrRd'
cmap = plt.get_cmap(cmap_name) cmap = plt.get_cmap(cmap_name)
fig, ax = plt.subplots(figsize=(6, 6)) fig, ax = plt.subplots(figsize=(6, 6))
ax.imshow(iml_grid_hd, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax, interpolation=interp_method) ax.imshow(iml_grid_hd, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax, interpolation='bilinear')
ax.axis('off') ax.axis('off')
# Save the figure # Save the figure