Coverage for runmacs/processor/mixins/caldatamixin.py : 58%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
'act': ('spatial', 'spectral'), 'alt': ('spatial', 'spectral'), 'wavelength': ('spatial', 'spectral'), 'previewdata': ('spatial', 'spectral', 'color'), }
def partDescription(self): return {'data': {'long_name': 'Unstructured calibration data', 'standard_name': 'unstructured_data'}, 'act': {'long_name': 'Across track angle', 'standard_name': 'act', 'units': self.angleUnit}, 'alt': {'long_name': 'Along track angle', 'standard_name': 'alt', 'units': self.angleUnit}, 'previewdata': defaultPartDescriptions['previewdata'], 'wavelength': {'long_name': 'Wavelength', 'standard_name': 'wavelength', 'units': self.wavelengthUnit} }
def _getAct(self):
def _getAlt(self): fieldId = self.fieldnames.index('alt') return (iter(self['data'].T('fieldid').S(fieldId, fieldId+1)).next() * self.unitConversion(self.angleUnit, 'radians')).astype("float32")
def _getWavelength(self):
def _getPreviewdata(self): normalizer = matplotlib.colors.Normalize() mapper = matplotlib.cm.ScalarMappable(norm=normalizer, cmap='jet') data = iter(self['data'].T('fieldid').S(0,1)).next() mapper.set_clim(*np.percentile(data, (2,98))) data = mapper.to_rgba(data)[...,:3] lo = np.nanmin(data) hi = np.nanmax(data) return (255 * (data-lo) / (hi-lo)).astype('uint8')
cal = CalibrationData() cal.setFieldNames(*self.fieldnames) cal.setSensorShape(self.dataSize['spatial'], self.dataSize['spectral']) cal.creationTime = self.creationTime cal.validFrom = self.validFrom cal.validUntil = self.validUntil cal.optics = self.optics cal.sensorId = self.sensorId cal.symbolicNonlinearityRule = self.symbolicNonlinearityRule cal.calibratedUnit = self.calibratedUnit cal.angleUnit = self.angleUnit cal.wavelengthUnit = self.wavelengthUnit cal.badPixels = self.badPixels cal.binningFactor = self.specbin * self.spatbin cal.data = self['data'].get() return cal |