def main(opts): """ crossmul """ # prepare input rasters masterSlc = SLC(hdf5file=opts.master) masterSlcDataset = masterSlc.getSlcDataset(opts.frequency, opts.polarization) masterSlcRaster = Raster('', h5=masterSlcDataset) slaveSlc = SLC(hdf5file=opts.slave) slaveSlcDataset = slaveSlc.getSlcDataset(opts.frequency, opts.polarization) slaveSlcRaster = Raster('', h5=slaveSlcDataset) # prepare mulitlooked interferogram dimensions masterGrid = masterSlc.getRadarGrid(opts.frequency) length = int(masterGrid.length / opts.alks) width = int(masterGrid.width / opts.rlks) # init output directory(s) initDir(opts.intPathAndPrefix) initDir(opts.cohPathAndPrefix) # prepare output rasters driver = gdal.GetDriverByName('ISCE') igramDataset = driver.Create(opts.intPathAndPrefix, width, length, 1, gdal.GDT_CFloat32) igramRaster = Raster('', dataset=igramDataset) cohDataset = driver.Create(opts.cohPathAndPrefix, width, length, 1, gdal.GDT_Float32) cohRaster = Raster('', dataset=cohDataset) # prepare optional rasters if opts.rgoff: rgOffRaster = Raster(opts.rgoff) else: rgOffRaster = None if opts.azband: dopMaster = masterSlc.getDopplerCentroid() dopSlave = slaveSlc.getDopplerCentroid() prf = dopMaster.getRadarGrid(opts.frequency).prf azimuthBandwidth = opts.azband else: dopMaster = dopSlave = None prf = azimuthBandwidth = 0.0 crossmul = Crossmul() crossmul.crossmul(masterSlcRaster, slaveSlcRaster, igramRaster, cohRaster, rngOffset=rgOffRaster, refDoppler=dopMaster, secDoppler=dopSlave, rangeLooks=opts.rlks, azimuthLooks=opts.alks, prf=prf, azimuthBandwidth=azimuthBandwidth)
def main(opts): """ resample SLC """ # prep SLC dataset input productSlc = SLC(hdf5file=opts.product) # get grids needed for resamp object instantiation productGrid = productSlc.getRadarGrid(opts.frequency) # instantiate resamp object based on user input if 'cuda' not in dir(isce3) and opts.gpu: warnings.warn('CUDA resamp not available. Switching to CPU resamp') opts.gpu = False if opts.gpu: resamp = isce3.cuda.image.resampSlc( radarGrid=productGrid, doppler=productSlc.getDopplerCentroid(), wavelength=productGrid.wavelength) else: resamp = isce3.image.resampSlc(radarGrid=productGrid, doppler=productSlc.getDopplerCentroid(), wavelength=productGrid.wavelength) # set number of lines per tile if arg > 0 if opts.linesPerTile: resamp.linesPerTile = opts.linesPerTile # Prepare input rasters inSlcDataset = productSlc.getSlcDataset(opts.frequency, opts.polarization) inSlcRaster = isce3.io.raster(filename='', h5=inSlcDataset) azOffsetRaster = isce3.io.raster( filename=os.path.join(opts.offsetdir, 'azimuth.off')) rgOffsetRaster = isce3.io.raster( filename=os.path.join(opts.offsetdir, 'range.off')) # Init output directory if opts.outFilePath: path, _ = os.path.split(opts.outFilePath) os.makedirs(path, exist_ok=True) # Prepare output raster driver = gdal.GetDriverByName('ISCE') outds = driver.Create(opts.outFilePath, rgOffsetRaster.width, rgOffsetRaster.length, 1, gdal.GDT_CFloat32) outSlcRaster = isce3.io.raster(filename='', dataset=outds) # Run resamp resamp.resamp(inSlc=inSlcRaster, outSlc=outSlcRaster, rgoffRaster=rgOffsetRaster, azoffRaster=azOffsetRaster)
def main(opts): """ resample SLC """ # prep SLC dataset input productSlc = SLC(hdf5file=opts.product) # get grids needed for resamp object instantiation productGrid = productSlc.getRadarGrid(opts.frequency) # instantiate resamp object resamp = ResampSlc(productGrid, productSlc.getDopplerCentroid(), productGrid.wavelength) # set number of lines per tile if arg > 0 if opts.linesPerTile: resamp.linesPerTile = opts.linesPerTile # Prepare input rasters inSlcDataset = productSlc.getSlcDataset(opts.frequency, opts.polarization) inSlcRaster = Raster('', h5=inSlcDataset) azOffsetRaster = Raster( filename=os.path.join(opts.offsetdir, 'azimuth.off')) rgOffsetRaster = Raster(filename=os.path.join(opts.offsetdir, 'range.off')) # Init output directory if opts.outPathAndFile: path, file = os.path.split(opts.outPathAndFile) if not os.path.isdir(path): os.makedirs(path) # Prepare output raster driver = gdal.GetDriverByName('ISCE') slcPathAndName = opts.outPathAndFile outds = driver.Create(os.path.join(slcPathAndName), rgOffsetRaster.width, rgOffsetRaster.length, 1, gdal.GDT_CFloat32) outSlcRaster = Raster('', dataset=outds) # Run resamp resamp.resamp(inSlc=inSlcRaster, outSlc=outSlcRaster, rgoffRaster=rgOffsetRaster, azoffRaster=azOffsetRaster)
def main(opts): """ crossmul """ # prepare input rasters referenceSlc = SLC(hdf5file=opts.reference) referenceSlcDataset = referenceSlc.getSlcDataset(opts.frequency, opts.polarization) referenceSlcRaster = isce3.io.raster(filename='', h5=referenceSlcDataset) secondarySlc = SLC(hdf5file=opts.secondary) if opts.secondaryRaster: secondarySlcRaster = isce3.io.raster(filename=opts.secondaryRaster) else: secondarySlcDataset = secondarySlc.getSlcDataset( opts.frequency, opts.polarization) secondarySlcRaster = isce3.io.raster(filename='', h5=secondarySlcDataset) # prepare mulitlooked interferogram dimensions referenceGrid = referenceSlc.getRadarGrid(opts.frequency) length = int(referenceGrid.length / opts.alks) width = int(referenceGrid.width / opts.rlks) # init output directory(s) getDir = lambda filepath: os.path.split(filepath)[0] os.makedirs(getDir(opts.intFilePath), exist_ok=True) os.makedirs(getDir(opts.cohFilePath), exist_ok=True) # prepare output rasters driver = gdal.GetDriverByName('ISCE') igramDataset = driver.Create(opts.intFilePath, width, length, 1, gdal.GDT_CFloat32) igramRaster = isce3.io.raster(filename='', dataset=igramDataset) # coherence only generated when multilooked enabled if (opts.alks > 1 or opts.rlks > 1): cohDataset = driver.Create(opts.cohFilePath, width, length, 1, gdal.GDT_Float32) cohRaster = isce3.io.raster(filename='', dataset=cohDataset) else: cohRaster = None # prepare optional rasters if opts.rgoff: rgOffRaster = isce3.io.raster(filename=opts.rgoff) else: rgOffRaster = None if opts.azband: dopReference = referenceSlc.getDopplerCentroid() dopSecondary = secondarySlc.getDopplerCentroid() prf = referenceSlc.getSwathMetadata( opts.frequency).nominalAcquisitionPRF azimuthBandwidth = opts.azband else: dopReference = dopSecondary = None prf = azimuthBandwidth = 0.0 # instantiate crossmul object based on user input if 'cuda' not in dir(isce3) and opts.gpu: warnings.warn('CUDA crossmul not available. Switching to CPU crossmul') opts.gpu = False if opts.gpu: crossmul = isce3.cuda.signal.crossmul() else: crossmul = isce3.signal.crossmul() crossmul.crossmul(referenceSlcRaster, secondarySlcRaster, igramRaster, cohRaster, rngOffset=rgOffRaster, refDoppler=dopReference, secDoppler=dopSecondary, rangeLooks=opts.rlks, azimuthLooks=opts.alks, prf=prf, azimuthBandwidth=azimuthBandwidth)