Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
-------
PVLModule label for the given NumPy array.
Usage: self.label = _create_label(array)
"""
if len(array.shape) == 3:
bands = array.shape[0]
lines = array.shape[1]
line_samples = array.shape[2]
else:
bands = 1
lines = array.shape[0]
line_samples = array.shape[1]
record_bytes = line_samples * array.itemsize
label_module = pvl.PVLModule([
('PDS_VERSION_ID', 'PDS3'),
('RECORD_TYPE', 'FIXED_LENGTH'),
('RECORD_BYTES', record_bytes),
('LABEL_RECORDS', 1),
('^IMAGE', 1),
('IMAGE',
{'BANDS': bands,
'LINES': lines,
'LINE_SAMPLES': line_samples,
'MAXIMUM': 0,
'MEAN': 0,
'MEDIAN': 0,
'MINIMUM': 0,
'SAMPLE_BITS': array.itemsize * 8,
'SAMPLE_TYPE': 'MSB_INTEGER',
'STANDARD_DEVIATION': 0})