Ejemplo n.º 1
0
def runSimamp(outdir, hname='z.rdr'):
    from iscesys.StdOEL.StdOELPy import create_writer

    #####Run simamp
    stdWriter = create_writer("log", "", True, filename='sim.log')
    objShade = isceobj.createSimamplitude()
    objShade.setStdWriter(stdWriter)

    hgtImage = isceobj.createImage()
    hgtImage.load(os.path.join(outdir, hname) + '.xml')
    hgtImage.setAccessMode('read')
    hgtImage.createImage()

    simImage = isceobj.createImage()
    simImage.setFilename(os.path.join(outdir, 'simamp.rdr'))
    simImage.dataType = 'FLOAT'
    simImage.setAccessMode('write')
    simImage.setWidth(hgtImage.getWidth())
    simImage.createImage()

    objShade.simamplitude(hgtImage, simImage, shade=3.0)

    simImage.renderHdr()
    hgtImage.finalizeImage()
    simImage.finalizeImage()
    return
def runShadecpx2rg(self):

    imageAmp = self._insar.getResampAmpImage()
    widthAmp = imageAmp.getWidth()
    endian = self._insar.getMachineEndianness()

    filenameSimAmp = self._insar.getSimAmpImageName()
    objSimAmp = isceobj.createImage()
    widthSimAmp = widthAmp
    objSimAmp.initImage(filenameSimAmp, 'read', widthSimAmp, 'FLOAT')

    imageSimAmp = isceobj.createImage()
    IU.copyAttributes(objSimAmp, imageSimAmp)
    self._insar.setSimAmpImage(imageSimAmp)
    objSimAmp.setAccessMode('write')
    objSimAmp.createImage()
    filenameHt = self._insar.getHeightFilename()
    widthHgtImage = widthAmp  # they have same width by construction
    objHgtImage = isceobj.createImage()
    objHgtImage.initImage(filenameHt, 'read', widthHgtImage, 'FLOAT')
    imageHgt = isceobj.createImage()
    IU.copyAttributes(objHgtImage, imageHgt)
    self._insar.setHeightTopoImage(imageHgt)

    objHgtImage.createImage()

    logger.info("Running Shadecpx2rg")
    objShade = isceobj.createSimamplitude()
    #set the tag used in the outfile. each message is precided by this tag
    #is the writer is not of "file" type the call has no effect
    self._stdWriter.setFileTag("simamplitude", "log")
    self._stdWriter.setFileTag("simamplitude", "err")
    self._stdWriter.setFileTag("simamplitude", "out")
    objShade.setStdWriter(self._stdWriter)

    shade = self._insar.getShadeFactor()

    objShade.simamplitude(objHgtImage, objSimAmp, shade=shade)

    # Record the inputs and outputs
    from isceobj.Catalog import recordInputsAndOutputs
    recordInputsAndOutputs(self._insar.procDoc, objShade, "runSimamplitude", \
                  logger, "runSimamplitude")

    objHgtImage.finalizeImage()
    objSimAmp.finalizeImage()
    objSimAmp.renderHdr()
def run(widthAmp, infos, stdWriter, catalog=None, sceneid='NO_ID'):
    logger.info("Running shadecpx2rg: %s" % sceneid)

    endian = infos['machineEndianness']
    filenameSimAmp = infos['outputPath'] + '.' + infos['simAmpImageName']
    filenameHt = infos['outputPath'] + '.' + infos['heightFilename']
    shade = infos['shadeFactor']

    objSimAmp = isceobj.createImage()
    widthSimAmp = widthAmp
    objSimAmp.initImage(filenameSimAmp, 'read', widthSimAmp, 'FLOAT')

    imageSimAmp = isceobj.createImage()
    IU.copyAttributes(objSimAmp, imageSimAmp)

    objSimAmp.setAccessMode('write')
    objSimAmp.createImage()

    widthHgtImage = widthAmp  # they have same width by construction
    objHgtImage = isceobj.createImage()
    objHgtImage.initImage(filenameHt, 'read', widthHgtImage, 'FLOAT')
    imageHgt = isceobj.createImage()
    IU.copyAttributes(objHgtImage, imageHgt)

    objHgtImage.createImage()

    objShade = isceobj.createSimamplitude()
    #set the tag used in the outfile. each message is precided by this tag
    #if the writer is not of "file" type the call has no effect
    objShade.stdWriter = stdWriter.set_file_tags("simamplitude", "log", "err",
                                                 "out")

    objShade.simamplitude(objHgtImage, objSimAmp, shade=shade)

    if catalog is not None:
        # Record the inputs and outputs
        isceobj.Catalog.recordInputsAndOutputs(catalog, objShade,
                                               "runSimamplitude.%s" % sceneid,
                                               logger,
                                               "runSimamplitude.%s" % sceneid)

    objHgtImage.finalizeImage()
    objSimAmp.finalizeImage()
    objSimAmp.renderHdr()

    return imageSimAmp, imageHgt
Ejemplo n.º 4
0
def runShadecpx2rg(self):

    width = self.insar.formSLC1.slcImage.getWidth()
    filenameSimAmp = self._insar.getSimAmpImageName()
    objSimAmp = isceobj.createImage()
    widthSimAmp = width
    objSimAmp.initImage(filenameSimAmp,'read',widthSimAmp,'FLOAT')
    
    imageSimAmp = isceobj.createImage()
    IU.copyAttributes(objSimAmp, imageSimAmp)
    self._insar.setSimAmpImage(imageSimAmp) 
    objSimAmp.setAccessMode('write')
    objSimAmp.createImage()
    filenameHt = self._insar.getHeightFilename()
    widthHgtImage = width # they have same width by construction
    objHgtImage = isceobj.createImage()
    objHgtImage.initImage(filenameHt,'read',widthHgtImage,'DOUBLE')
    imageHgt = isceobj.createImage()
    IU.copyAttributes(objHgtImage, imageHgt)
    self._insar.setHeightTopoImage(imageHgt) 
    objHgtImage.setCaster('read','FLOAT')
    objHgtImage.createImage()
   
    logger.info("Running Shadecpx2rg")
    objShade = isceobj.createSimamplitude()
    #set the tag used in the outfile. each message is precided by this tag
    #is the writer is not of "file" type the call has no effect
    self._stdWriter.setFileTag("simamplitude", "log")
    self._stdWriter.setFileTag("simamplitude", "err")
    self._stdWriter.setFileTag("simamplitude", "out")
    objShade.setStdWriter(self._stdWriter)

    shade = self._insar.getShadeFactor()

    objShade.simamplitude(objHgtImage, objSimAmp, shade=shade)

    objHgtImage.finalizeImage()
    objSimAmp.finalizeImage()
    objSimAmp.renderHdr()