Beispiel #1
0
    def prepareRawLandsat(self):
        """
        Get path to scenes from metadata and convert all to radiance
        """
        tempPath = os.path.dirname(os.path.abspath(__file__)) + '\\temp\\'
        metadataPath = self.ui.satTabMTLPathLine.text()
        mtl_dict = l8_lst_swa_common_lib.readBasicMetadata(metadataPath)
        metadataBasePath = os.path.dirname(metadataPath)
        #print 'step1'
        ### B4, B5, B10, B11 to radiance
        B4Radiance = l8_lst_swa_common_lib.Landsat8_DN_to_radiance(1,metadataBasePath + '/' + mtl_dict['mtl_band4'],4,metadataPath)
        B5Radiance = l8_lst_swa_common_lib.Landsat8_DN_to_radiance(1,metadataBasePath + '/' + mtl_dict['mtl_band5'],5,metadataPath)
        #print 'step2'

        B10BrightnessTemperature = l8_lst_swa_common_lib.Landsat8_simple_temperature(1,metadataBasePath + '/' + mtl_dict['mtl_band10'],10,metadataPath)
        B11BrightnessTemperature = l8_lst_swa_common_lib.Landsat8_simple_temperature(1,metadataBasePath + '/' + mtl_dict['mtl_band11'],11,metadataPath)
        #print 'step3'

        ### NDVI Array
        NDVIArray = (B5Radiance - B4Radiance) / (B5Radiance + B4Radiance)
        del B4Radiance
        del B5Radiance
        #print 'done'

        getLSEByNDVIVectorized = np.vectorize(l8_lst_swa_core.getLSEByNDVI)
        LSE10Array = getLSEByNDVIVectorized(NDVIArray, 10)
        LSE11Array = getLSEByNDVIVectorized(NDVIArray, 11)
        print 'done'
        return mtl_dict, B10BrightnessTemperature, B11BrightnessTemperature, LSE10Array, LSE11Array
Beispiel #2
0
    def mtlCheck(self):
        """
        Check if metadata file is correct and all scenes are available
        """
        if not self.ui.satTabMTLPathLine.text():
            QtGui.QMessageBox.critical(None, "Error", 'Input MTL file not specified')
            return
        metadataPath = self.ui.satTabMTLPathLine.text()
        metadataBasePath = os.path.dirname(metadataPath)
        # Check if all files available
        try:
            mtl_dict = l8_lst_swa_common_lib.readBasicMetadata(metadataPath)
        except:
            QtGui.QMessageBox.critical(None, "Error", 'Invalid metadata')
            self.readyInterface()
            return

        # Check if extra data available
        #if not (os.path.isfile(metadataBasePath + '/' + mtl_dict['mtl_band4']) and os.path.isfile(
        #                metadataBasePath + '/' + mtl_dict['mtl_band5']) and os.path.isfile(
        #                metadataBasePath + '/' + mtl_dict['mtl_band10']) and os.path.isfile(metadataBasePath + '/' + mtl_dict['mtl_band11'])):
        #    QtGui.QMessageBox.critical(None, "Error", 'Some of needed landsat files not exists')
        #    return

        self.ui.statusSatelliteCheckBox.setChecked(True)