コード例 #1
0
    def checkHeaders(self):
        """Checks to make sure headers (with cell size, number of cols, etc) match for input rasters."""  
        if self.options.data_type == 'network':
            return
        match_files = []
        if self.options.use_polygons == True:
            match_files.append(self.options.polygon_file)
        if 'advanced' not in self.options.scenario.lower():
            filetype = CSIO._guess_file_type(self.options.point_file)
            if filetype == CSIO.FILE_TYPE_AAGRID:
                match_files.append(self.options.point_file)
        else:
            filetype = CSIO._guess_file_type(self.options.ground_file)
            if filetype == CSIO.FILE_TYPE_AAGRID:
                match_files.append(self.options.ground_file)
            filetype = CSIO._guess_file_type(self.options.source_file)
            if filetype == CSIO.FILE_TYPE_AAGRID:
                match_files.append(self.options.source_file)
        if self.options.use_mask == True:
            match_files.append(self.options.mask_file)
        headers_match = CSIO.match_headers(self.options.habitat_file, match_files)

        if headers_match == False:
            result = wx.MessageDialog(None, "Raster map headers do not match.  Circuitscape can try to resample maps to match the resistance map (Beta code, no guarantees). \n\nNote:all maps MUST be in the same projection.  Some focal nodes or short-circuit regions may be lost. \n\nUsing the 'Export to Circuitscape' tool or the Circuitscape for ArcGIS toolbox is a better bet.\n\nContinue?", "Warning", wx.YES_NO).ShowModal()  # @UndefinedVariable
            return (result == wx.ID_NO) # @UndefinedVariable
        return False