def _load(self, scale=0.001):
        """Load the Sentinel-2 MSI relative spectral responses
        """

        with open_workbook(self.path) as wb_:
            for sheet in wb_.sheets():
                if sheet.name not in SHEET_HEADERS.keys():
                    continue

                plt_short_name = PLATFORM_SHORT_NAME.get(self.platform_name)
                if plt_short_name != SHEET_HEADERS.get(sheet.name):
                    continue

                wvl = sheet.col_values(0, 1)
                for idx in range(1, sheet.row_len(0)):
                    ch_name = MSI_BAND_NAMES[plt_short_name].get(str(sheet.col_values(idx, 0, 1)[0]))
                    if ch_name != self.bandname:
                        continue

                    resp = sheet.col_values(idx, 1)
                    resp = np.array(resp)
                    resp = np.where(resp == '', 0, resp).astype('float32')
                    mask = np.less_equal(resp, 0.00001)
                    wvl0 = np.ma.masked_array(wvl, mask=mask)
                    wvl_mask = np.ma.masked_outside(wvl, wvl0.min() - 2, wvl0.max() + 2)

                    wvl = wvl_mask.compressed()
                    resp = np.ma.masked_array(resp, mask=wvl_mask.mask).compressed()
                    self.rsr = {'wavelength': wvl / 1000., 'response': resp}

                    break

                break
def _load ( self , scale = 0.001 ) : with open_workbook ( self . path ) as wb_ : for sheet in wb_ . sheets ( ) : if sheet . name not in SHEET_HEADERS . keys ( ) : continue plt_short_name = PLATFORM_SHORT_NAME . get ( self . platform_name ) if plt_short_name != SHEET_HEADERS . get ( sheet . name ) : continue wvl = sheet . col_values ( 0 , 1 ) for idx in range ( 1 , sheet . row_len ( 0 ) ) : ch_name = MSI_BAND_NAMES [ plt_short_name ] . get ( str ( sheet . col_values ( idx , 0 , 1 ) [ 0 ] ) ) if ch_name != self . bandname : continue resp = sheet . col_values ( idx , 1 ) resp = np . array ( resp ) resp = np . where ( resp == '' , 0 , resp ) . astype ( 'float32' ) mask = np . less_equal ( resp , 0.00001 ) wvl0 = np . ma . masked_array ( wvl , mask = mask ) wvl_mask = np . ma . masked_outside ( wvl , wvl0 . min ( ) - 2 , wvl0 . max ( ) + 2 ) wvl = wvl_mask . compressed ( ) resp = np . ma . masked_array ( resp , mask = wvl_mask . mask ) . compressed ( ) self . rsr = { 'wavelength' : wvl / 1000. , 'response' : resp } break break
Load the Sentinel-2 MSI relative spectral responses