def addWriteNode(self, graph, output, key): # add write node nodeID = self.nodeID+"_write_"+str(GPFAlgorithm.nodeIDNum) GPFAlgorithm.nodeIDNum +=1 node = ET.SubElement(graph, "node", {"id":nodeID}) operator = ET.SubElement(node, "operator") operator.text = "Write" # add source sources = ET.SubElement(node, "sources") ET.SubElement(sources, "sourceProduct", {"refid":self.nodeID}) # add some options parametersNode = ET.SubElement(node, "parameters") parameter = ET.SubElement(parametersNode, "file") parameter.text = str(output.value) parameter = ET.SubElement(parametersNode, "formatName") if output.value.lower().endswith(".dim"): parameter.text = "BEAM-DIMAP" elif output.value.lower().endswith(".hdr"): parameter.text = "ENVI" else: if key == GPFUtils.beamKey(): parameter.text = "GeoTIFF" else: parameter.text = "GeoTIFF-BigTIFF" return graph
def initializeSettings(self): AlgorithmProvider.initializeSettings(self) ProcessingConfig.addSetting( Setting(self.getDescription(), GPFUtils.BEAM_FOLDER, "BEAM install directory", GPFUtils.programPath(GPFUtils.beamKey()))) ProcessingConfig.addSetting( Setting(self.getDescription(), GPFUtils.BEAM_THREADS, "Maximum number of parallel (native) threads", 4))
def createAlgsList(self): self.preloadedAlgs = [] folder = GPFUtils.gpfDescriptionPath(GPFUtils.beamKey()) for descriptionFile in os.listdir(folder): if descriptionFile.endswith("txt"): try: alg = BEAMAlgorithm(os.path.join(folder, descriptionFile)) if alg.name.strip() != "": self.preloadedAlgs.append(alg) else: ProcessingLog.addToLog( ProcessingLog.LOG_ERROR, "Could not open BEAM algorithm: " + descriptionFile) except Exception, e: ProcessingLog.addToLog( ProcessingLog.LOG_ERROR, "Could not open BEAM algorithm: " + descriptionFile)
def helpFile(self): GPFAlgorithm.helpFile(self, GPFUtils.beamKey())
def processAlgorithm(self, progress): GPFAlgorithm.processAlgorithm(self, GPFUtils.beamKey(), progress)
def __init__(self, descriptionfile): GPFAlgorithm.__init__(self, descriptionfile) self.programKey = GPFUtils.beamKey()