if type(max_bin) is str and (max_bin.upper() == "AUTO"):
maxval = round(np.nanmax(masked_array), 8) // Auto bins will detect maxval to use for calculating labels/bins
if type(min_bin) is str and (min_bin.upper() == "AUTO"):
b = round(np.nanmin(masked_array), 8) // If bin_min is auto then overwrite starting value
// Calculate histogram
hist_val = [float(l[0]) for l in cv2.calcHist([masked_array.astype(np.float32)], [0], None, [bins], [b, maxval])]
After Change
// Calculate observed min and max pixel values of the masked array
observed_max = np.nanmax(masked_array)
observed_min = np.nanmin(masked_array)
// Auto calculate max_bin if set
if type(max_bin) is str and (max_bin.upper() == "AUTO"):
maxval = round(observed_max, 8) // Auto bins will detect maxval to use for calculating labels/bins
if type(min_bin) is str and (min_bin.upper() == "AUTO"):
b = round(observed_min, 8) // If bin_min is auto then overwrite starting value
// Print a warning if observed min/max outside user defined range
if observed_max > maxval or observed_min < b: