Exemple #1
0
def model_batch_sc_buoy(project_root):
    
    import test_paths
    
    display_images = display_processed_images(True)
    
    batchFileDirectory = 'input/batches/'
    batchFileName = input("\n Please enter the name of the batch file or 'X' to exit : ")
    batchFile = os.path.join(batchFileDirectory, batchFileName)
    
    if (batchFile[(batchFile.rfind('/') + 1):].upper()) != 'X':
        valid_data = test_paths.main([batchFile, "-tfile"])
        
        if not valid_data:
            batchFile = input("\n The batch file you entered is invalid, please try again ('X' - exit): ")
            
            if batchFile.upper() != 'X':
                valid_data = test_paths.main([batchFile, "-tfile"])
            
    
        if batchFile.upper() != 'X':
            
            # Read in the file
            scenes = open(batchFile).readlines()
            
            counter = 0
            error_list = {"errors":[]}
            
            for scene in scenes:
                
                counter += 1
                
                if not is_valid_id(scene):
                    
                    error = {}
                    error["idx"] = counter
                    error["scene"] = scene
                    
                    error_list["errors"].append(error)
            
            
            if (len(error_list['errors']) > 0):
                
                sys.stdout.write("\n\n*********************************************************************\n")
                sys.stdout.write("*  !!!   The following errors were found in your batch file   !!!   *\n")
                sys.stdout.write("*********************************************************************\n")
            
                for error in error_list['errors']:
                    sys.stdout.write("  line : %5s         scene : %s" % (error['idx'], error['scene']))
                    
                sys.stdout.write("\n\n")
                
                input("Press Enter to continue...")
                    
            else:
            
                # Launch batch process job
                Model('menu', 'batch', 'sc', 'buoy', batchFile, 'merra', display_images, project_root, False, None)
Exemple #2
0
    def process_batch_buoy_sc_ids(self, master, source_file, show_images):

        self.create_watchdogs(master,
                              self.path_dictionary['statusfile_absolute_path'],
                              self.path_dictionary['outputfile_absolute_path'])

        Model('tarca_gui', 'batch', 'sc', 'buoy', source_file, 'merra',
              show_images, master.project_root, False, None,
              self.path_dictionary['statusfile_absolute_path_and_filename'],
              self.path_dictionary['outputfile_absolute_path_and_filename'])

        self.process_complete = True

        self.kill_watchdogs()

        self.clear_watch_files(master)
Exemple #3
0
    def process_toa_sc(self, master, scene_id, show_images, partial_data):

        self.create_watchdogs(master,
                              self.path_dictionary['statusfile_absolute_path'],
                              self.path_dictionary['outputfile_absolute_path'])

        Model('tarca_gui', 'single', 'sc', 'toa', scene_id, 'merra',
              show_images, master.project_root, False, partial_data,
              self.path_dictionary['statusfile_absolute_path_and_filename'],
              self.path_dictionary['outputfile_absolute_path_and_filename'])

        self.process_complete = True

        self.kill_watchdogs()

        self.clear_watch_files(master)
Exemple #4
0
def model_single_sc_buoy(project_root):
    
    display_images = display_processed_images(False)
    
    sceneId = input("\n Please enter the Scene ID to continue or 'X' to exit : ")
    
    if sceneId.upper() != 'X':
        valid_data = is_valid_id(sceneId)
    
        if not valid_data:
            while not valid_data:
                sceneId = input("\n The Scene ID you entered is invalid, please try again ('X' - exit) : ")
                
                if sceneId.upper() != 'X':
                    valid_data = is_valid_id(sceneId)
                else:
                    break
    
        if sceneId.upper() != 'X':            
            
            # Launch single scene ID process job
            Model('menu', 'single', 'sc', 'buoy', sceneId, 'merra', display_images, project_root, False, None)
Exemple #5
0
def model_single_sw_lst(project_root):
    
    display_images = False
    partial_data = {}
    
    sceneId = input("\n Please enter the Scene ID to continue or 'X' to exit : ")
    
    if sceneId.upper() != 'X':
        valid_data = is_valid_id(sceneId)
    
        if not valid_data:
            while not valid_data:
                sceneId = input("\n The Scene ID you entered is invalid, please try again ('X' - exit) : ")
                
                if sceneId.upper() != 'X':
                    valid_data = is_valid_id(sceneId)
                else:
                    break
    
        if sceneId.upper() != 'X':
            
            # Get latitude from user
            lat = input("\n Please enter the latitude to use for processing (decimal range -90 to 90) : ")
            
            # Perform data validation        
            if not is_valid_latitude(lat):
                while not is_valid_latitude(lat):
                    lat = input("\n The Latitude you entered is not in the valid range of -90 to 90, please try again : ")
            
            lat = float(lat)
            
            partial_data['lat'] = lat
            
            # Get longitude from user
            lon = input("\n Please enter the longitude to use for processing (decimal range -180  to 180) : ")
            
            # Perform data validation
            if not is_valid_longitude(lon):
                while not is_valid_longitude(lon):
                    lon = input("\n The Longitude you entered is not in the valid range of -180 to 180, please try again : ")
            
            lon = float(lon)
        
            partial_data['lon'] = lon
        
            # Get band 10 emissivity from user
            emis_b10 = input("\n Please enter the emissivity for Band 10 (Press enter for default %s) : " % settings.DEFAULT_EMIS_B10)
            
            # Perform data validation
            if data_entered(emis_b10):
                if not is_valid_emissivity(emis_b10):
                    while not is_valid_emissivity(emis_b10):
                        emis_b10 = input("\n The Emissivity you entered for Band 10 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_EMIS_B10)
                        
                        if not data_entered(emis_b10):
                            emis_b10 = settings.DEFAULT_EMIS_B10
                else:
                    emis_b10 = float(emis_b10)
            else:
                emis_b10 = settings.DEFAULT_EMIS_B10
            
            partial_data['emis_b10'] = emis_b10
            
            # Get band 11 emissivity from user
            emis_b11 = input("\n Please enter the emissivity for Band 11 (Press enter for default %s) : " % settings.DEFAULT_EMIS_B11)
    
            # Perform data validation
            if data_entered(emis_b11):
                if not is_valid_emissivity(emis_b11):
                    while not is_valid_emissivity(emis_b11):
                        emis_b11 = input("\n The Emissivity you entered for Band 11 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_EMIS_B11)
                        
                        if not data_entered(emis_b11):
                            emis_b11 = settings.DEFAULT_EMIS_B10
                else:
                    emis_b11 = float(emis_b11)
            else:
                emis_b11 = settings.DEFAULT_EMIS_B11
            
            partial_data['emis_b11'] = emis_b11
            
            # Ask if gain and bias needs to be added to the equasion
            if add_gain_bias():
                
                partial_data['add_gain_bias'] = True
                
                # Get band 10 gain from user
                gain_b10 = input("\n Please enter the gain for Band 10 (Press enter for default %s) : " % settings.DEFAULT_GAIN_B10)
        
                # Perform data validation
                if data_entered(gain_b10):
                    if not is_number(gain_b10):
                        while not is_number(gain_b10):
                            gain_b10 = input("\n The Gain you entered for Band 10 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_GAIN_B10)
                            
                            if not data_entered(gain_b10):
                                gain_b10 = settings.DEFAULT_GAIN_B10
                    else:
                        gain_b10 = float(gain_b10)
                else:
                    gain_b10 = settings.DEFAULT_GAIN_B10
                
                partial_data['gain_b10'] = gain_b10
                
                # Get band 10 bias from user
                bias_b10 = input("\n Please enter the bias for Band 10 (Press enter for default %s) : " % settings.DEFAULT_BIAS_B10)
        
                # Perform data validation
                if data_entered(bias_b10):
                    if not is_number(bias_b10):
                        while not is_number(bias_b10):
                            bias_b10 = input("\n The Gain you entered for Band 10 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_BIAS_B10)
                            
                            if not data_entered(bias_b10):
                                bias_b10 = settings.DEFAULT_BIAS_B10
                    else:
                        bias_b10 = float(bias_b10)
                else:
                    bias_b10 = settings.DEFAULT_BIAS_B10
                
                partial_data['bias_b10'] = bias_b10
                
                # Get band 11 gain from user
                gain_b11 = input("\n Please enter the gain for Band 11 (Press enter for default %s) : " % settings.DEFAULT_GAIN_B11)
        
                # Perform data validation
                if data_entered(gain_b11):
                    if not is_number(gain_b11):
                        while not is_number(gain_b11):
                            gain_b11 = input("\n The Gain you entered for Band 11 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_GAIN_B11)
                            
                            if not data_entered(gain_b11):
                                gain_b11 = settings.DEFAULT_GAIN_B11
                    else:
                        gain_b11 = float(gain_b11)
                else:
                    gain_b11 = settings.DEFAULT_GAIN_B11
                
                partial_data['gain_b11'] = gain_b11
                
                # Get band 11 bias from user
                bias_b11 = input("\n Please enter the bias for Band 11 (Press enter for default %s) : " % settings.DEFAULT_BIAS_B11)
        
                # Perform data validation
                if data_entered(bias_b11):
                    if not is_number(bias_b11):
                        while not is_number(bias_b11):
                            bias_b11 = input("\n The Gain you entered for Band 11 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_BIAS_B11)
                            
                            if not data_entered(bias_b11):
                                bias_b11 = settings.DEFAULT_BIAS_B11
                    else:
                        bias_b11 = float(bias_b11)
                else:
                    bias_b11 = settings.DEFAULT_BIAS_B11
                
                partial_data['bias_b11'] = bias_b11
            
            else:
                
                partial_data['add_gain_bias'] = False
                
                partial_data['gain_b10'] = 0
                partial_data['gain_b11'] = 0
                partial_data['bias_b10'] = 0
                partial_data['bias_b11'] = 0
                
            
            # Launch single scene ID process job
            Model('menu', 'single', 'sw', 'lst', sceneId, 'merra', display_images, project_root, False, partial_data)
Exemple #6
0
def model_single_sc_toa(project_root):
    
    display_images = False
    partial_data = {}
    
    sceneId = input("\n Please enter the Scene ID to continue or 'X' to exit : ")
    
    if sceneId.upper() != 'X':
        valid_data = is_valid_id(sceneId)
    
        if not valid_data:
            while not valid_data:
                sceneId = input("\n The Scene ID you entered is invalid, please try again ('X' - exit) : ")
                
                if sceneId.upper() != 'X':
                    valid_data = is_valid_id(sceneId)
                else:
                    break
    
        if sceneId.upper() != 'X':
            
            # Get skin temperature from user
            skin_temp = input("\n Please enter the surface temperature : ")
            
            # Perform data validation (200 - 350 K)
            if not is_valid_temp(skin_temp):
                while not is_valid_temp(skin_temp):
                    skin_temp = input("\n The skin temperature you entered is not in the valid range of 200 to 350, please try again : ")
            
            skin_temp = float(skin_temp)
        
            partial_data['skin_temp'] = skin_temp
            
            # Get latitude from user
            lat = input("\n Please enter the latitude for the supplied surface temperature (decimal range -90 to 90) : ")
            
            # Perform data validation        
            if not is_valid_latitude(lat):
                while not is_valid_latitude(lat):
                    lat = input("\n The Latitude you entered is not in the valid range of -90 to 90, please try again : ")
            
            lat = float(lat)
            
            partial_data['lat'] = lat
            
            # Get longitude from user
            lon = input("\n Please enter the longitude for the supplied surface temperature (decimal range -180  to 180) : ")
            
            # Perform data validation
            if not is_valid_longitude(lon):
                while not is_valid_longitude(lon):
                    lon = input("\n The Longitude you entered is not in the valid range of -180 to 180, please try again : ")
            
            lon = float(lon)
        
            partial_data['lon'] = lon
        
            # Get band 10 emissivity from user
            emis_b10 = input("\n Please enter the emissivity for Band 10 (Press enter for default %s) : " % settings.DEFAULT_EMIS_B10)
            
            # Perform data validation
            if data_entered(emis_b10):
                if not is_valid_emissivity(emis_b10):
                    while not is_valid_emissivity(emis_b10):
                        emis_b10 = input("\n The Emissivity you entered for Band 10 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_EMIS_B10)
                        
                        if not data_entered(emis_b10):
                            emis_b10 = settings.DEFAULT_EMIS_B10
                else:
                    emis_b10 = float(emis_b10)
            else:
                emis_b10 = settings.DEFAULT_EMIS_B10
            
            partial_data['emis_b10'] = emis_b10
            
            # Get band 11 emissivity from user
            emis_b11 = input("\n Please enter the emissivity for Band 11 (Press enter for default %s) : " % settings.DEFAULT_EMIS_B11)
    
            # Perform data validation
            if data_entered(emis_b11):
                if not is_valid_emissivity(emis_b11):
                    while not is_valid_emissivity(emis_b11):
                        emis_b11 = input("\n The Emissivity you entered for Band 11 is invalid, please try again (Press enter for default %s) : " % settings.DEFAULT_EMIS_B11)
                        
                        if not data_entered(emis_b11):
                            emis_b11 = settings.DEFAULT_EMIS_B10
                else:
                    emis_b11 = float(emis_b11)
            else:
                emis_b11 = settings.DEFAULT_EMIS_B11
            
            partial_data['emis_b11'] = emis_b11
            
            # Launch single scene ID process job
            Model('menu', 'single', 'sc', 'toa', sceneId, 'merra', display_images, project_root, False, partial_data)