impose requirement of minimum size of range of output data to do image processing
This commit is contained in:
@@ -519,8 +519,8 @@ verbose: {verbose}")
|
||||
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 if there are at least 10 grid values
|
||||
if np.count_nonzero(iml_grid_tmp) >= 10:
|
||||
# upscale the grid 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 = 4
|
||||
iml_grid_hd = resize(iml_grid_tmp, (up_factor * len(iml_grid_tmp), up_factor * len(iml_grid_tmp)),
|
||||
mode='reflect', anti_aliasing=False)
|
||||
@@ -529,9 +529,10 @@ verbose: {verbose}")
|
||||
|
||||
iml_grid_hd[iml_grid_hd == 0.0] = np.nan # change zeroes back to nan
|
||||
|
||||
# trim edges so the grid is not so blocky
|
||||
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))
|
||||
|
||||
# trim edges so the grid is not so blocky
|
||||
trim_thresh = vmin
|
||||
iml_grid_hd[iml_grid_hd < trim_thresh] = np.nan
|
||||
|
||||
|
Reference in New Issue
Block a user