def __callback_run_analysis ():
     if self.__input_string.get() <> 'Required' and self.__output_string.get() <> 'REQUIRED':
     
         # Write variables to .var file
         VAR.set_variable("INPUT_FOLDER", "STRING", self.__input_string.get())
         VAR.set_variable("OUTPUT_FOLDER", "STRING", self.__output_string.get())
         
         # Remove GUI window and destroy it.
         try: master.destroy()
         except: pass
         try: self.root.destroy()
         except: pass
         
         # RUN APPLICATION
         try: # Import needs to be here in case ARCPY not found. Crashes on import if not
             print 'STARTING RGI ANALYSIS'
             import glacier_scripts.rgi_analyze as ANALYZE  
             ANALYZE.rgi_analysis(self.__input_string.get(), self.__output_string.get(), VAR)
             print 'FINISHED RGI ANALYSIS'
         except:
             tkMessageBox.showwarning ('Warning', 'Could NOT Analyze Folder. Check folder paths.')
     else: 
         tkMessageBox.showwarning ('Warning', 'You must select Input and Output Folders.')
Beispiel #2
0
sys.path.append (os.path.dirname(os.path.dirname(__file__)))

import glacier_scripts.rgi_analyze as rgi_analyze
import glacier_utilities.general_utilities.variables as VAR
import arcpy as ARCPY                                      #@UnresolvedImport

# Read parameter values from ArcGIS tool input
# 1 - The folder containing RGI layers to be analyzed
# 2 - The output folder where processed files are placed
# 3 - Start the variables object

try: rgi_folder = ARCPY.GetParameterAsText(0)
except: ARCPY.AddError('RGI Input File Error')

try: rgi_output = ARCPY.GetParameterAsText(1)
except: ARCPY.AddError('RGI Output Folder Error')

try: variables = VAR.Variables()
except: ARCPY.AddError('Could Not Initialize Variables')

# Run the analysis on rgi layers
try:
    rgi_analyze.rgi_analysis(rgi_folder, rgi_output, variables)
except:
    ARCPY.AddError('Errors generated during function execution')

# Driver - Currently Does nothing
def driver():
    pass
if __name__ == '__main__':
    driver()