Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
- MEDIAN, MEAN
Returns
-------
Update label module for the NumPy array.
Usage: self.label = self._update_label(label, array)
"""
maximum = float(numpy.max(array))
mean = float(numpy.mean(array))
median = float(numpy.median(array))
minimum = float(numpy.min(array))
stdev = float(numpy.std(array, ddof=1))
encoder = pvl.encoder.PDSLabelEncoder
serial_label = pvl.dumps(label, cls=encoder)
label_sz = len(serial_label)
image_pointer = int(label_sz / label['RECORD_BYTES']) + 1
label['^IMAGE'] = image_pointer + 1
label['LABEL_RECORDS'] = image_pointer
label['IMAGE']['MEAN'] = mean
label['IMAGE']['MAXIMUM'] = maximum
label['IMAGE']['MEDIAN'] = median
label['IMAGE']['MINIMUM'] = minimum
label['IMAGE']['STANDARD_DEVIATION'] = stdev
return label