This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import math | |
def compute_scale_and_offset(min_value: (int, float, np.number), max_value: (int, float, np.number), dtype: np.dtype): | |
""" | |
Computes the scale (slope) and offset for a dataset using a min value, max value, and the required np.dtype. | |
It leaves one value at the lower extreme to use for the nan fillvalue. | |
These are the min values set asside for the fillvalue (up to 64 bits). | |
int8: -128 |