def main(): # create FormSLC object and initilaize it using FormSLC930110.xml. it actually contains all the parameters already except the raw and slc images. # one could use the Platform and Radar objects to change some of the parameters. obj = FormSLC() initfileForm = 'FormSCL930110.xml' #instantiate a InitFromXmlFile object passinf the file name in the contructor fileInit = InitFromXmlFile(initfileForm) # init FormSLC by passing the init object obj.initComponent(fileInit) initfilePl = 'Platform930110.xml' fileInit = InitFromXmlFile(initfilePl) objPl = Platform() objPl.initComponent(fileInit) #instantiate a InitFromObject object passing the object from which to initialize in the contructor objInit = InitFromObject(objPl) obj.initComponent(objInit) initfileRadar = 'Radar930110.xml' fileInit = InitFromXmlFile(initfileRadar) objRadar = Radar() objRadar.initComponent(fileInit) objInit = InitFromObject(objRadar) obj.initComponent(objInit) obj.printComponent() filename = "930110.raw" accessmode = 'read' endian = 'l' width = 11812 objRaw = RawImage() # only sets the parameter objRaw.initImage(filename, accessmode, endian, width) # it actually creates the C++ object objRaw.createImage() filenameSLC = "930110.slc" accessmode = 'write' endian = 'l' width = 5700 dict = { 'FILE_NAME': filenameSLC, 'ACCESS_MODE': accessmode, 'BYTE_ORDER': endian, 'WIDTH': width } dictInit = InitFromDictionary(dict) objSlc = SlcImage() objSlc.initComponent(dictInit) objSlc.createImage() obj.formSLCImage(objRaw, objSlc) #call this to do some cleaning. always call it if initImage (or the initComponent) was called objSlc.finalizeImage() objRaw.finalizeImage()
def main(): obj = Cpxlooks() infile = "/Users/giangi/TEST_DIR/int_930110_950523/flat_PRC_930110-950523.int" outfile = 'testCpx' rlook = 4 alook = 4 width = 5700 phRange = 0.0001 phAzimuth = 0.0002 enIn = 'l' enOut = 'l' length = 2593 #with all arguments #dict = {'PHASE_RANGE':phRange,'INPUT_ENDIANNESS':enIn,'OUTPUT_ENDIANNESS':enOut,'LENGTH':length,'PHASE_AZIMUTH':phAzimuth,'WIDTH':width,'INPUT_IMAGE':infile,'OUTPUT_IMAGE':outfile,'RANGE_LOOK':rlook,'AZIMUTH_LOOK':alook} #with only mandatory arguments dict = { 'WIDTH': width, 'INPUT_IMAGE': infile, 'OUTPUT_IMAGE': outfile, 'RANGE_LOOK': rlook, 'AZIMUTH_LOOK': alook } initDict = InitFromDictionary(dict) obj.initComponent(initDict) obj.cpxlooks()
def dopav(self, image1=None, image2=None): if not (image1 == None): trans = { 'SQUINT': 'SQUINT1', 'DOPPLER_CENTROID_COEFFICIENTS': 'DOPPLER_CENTROID_COEFFICIENTS1', 'PRF': 'PRF1' } init = InitFromDictionary(image1, trans) self.initComponent(init) if not (image2 == None): trans = { 'SQUINT': 'SQUINT2', 'DOPPLER_CENTROID_COEFFICIENTS': 'DOPPLER_CENTROID_COEFFICIENTS2', 'PRF': 'PRF2' } init = InitFromDictionary(image2, trans) self.initComponent(init) return self.avgDoppler()
def main(): obj = Powlooks() infile = "/Users/giangi/TEST_DIR/int_930110_950523/flat_PRC_930110-950523.int" outfile = 'testPow' rlook = 4; alook = 4; width = 5700 height = 2593 #with all arguments #dict = {'INPUT_ENDIANNESS':enIn,'OUTPUT_ENDIANNESS':enOut,'LENGTH':length,'WIDTH':width,'INPUT_IMAGE':infile,'OUTPUT_IMAGE':outfile,'RANGE_LOOK':rlook,'AZIMUTH_LOOK':alook} #with only mandatory arguments dict = {'WIDTH':width,'INPUT_IMAGE':infile,'OUTPUT_IMAGE':outfile,'RANGE_LOOK':rlook,'AZIMUTH_LOOK':alook} initDict = InitFromDictionary(dict) obj.initComponent(initDict) obj.powlooks()
def main(): obj = Nbymdem() infile = "/Users/giangi/TEST_DIR/DEM/SoCal.dem" outfile = 'testDem' rlook = 2; alook = 2; width = 1885 enIn = 'l' enOut = 'l' length = 909 flag = -1 #with all arguments #dict = {'UNDEFINED_PIXEL':flag,'INPUT_ENDIANNESS':enIn,'OUTPUT_ENDIANNESS':enOut,'LENGTH':length,'WIDTH':width,'INPUT_IMAGE':infile,'OUTPUT_IMAGE':outfile,'RANGE_LOOK':rlook,'AZIMUTH_LOOK':alook} #with only mandatory arguments dict = {'WIDTH':width,'INPUT_IMAGE':infile,'OUTPUT_IMAGE':outfile,'RANGE_LOOK':rlook,'AZIMUTH_LOOK':alook} initDict = InitFromDictionary(dict) obj.initComponent(initDict) obj.nbymdem()
def main(): filename = sys.argv[1] # rgoffset.out fin = open(filename) allLines = fin.readlines() locationAc = [] locationAcOffset = [] locationDn = [] locationDnOffset = [] snr = [] for line in allLines: lineS = line.split() locationAc.append(float(lineS[0])) locationAcOffset.append(float(lineS[1])) locationDn.append(float(lineS[2])) locationDnOffset.append(float(lineS[3])) snr.append(float(lineS[4])) dict = {} dict['LOCATION_ACROSS1'] = locationAc dict['LOCATION_ACROSS_OFFSET1'] = locationAcOffset dict['LOCATION_DOWN1'] = locationDn dict['LOCATION_DOWN_OFFSET1'] = locationDnOffset dict['SNR1'] = snr initDict = InitFromDictionary(dict) initfileResamp_image = 'Resamp_image.xml' initResamp_image = InitFromXmlFile(initfileResamp_image) initfileRangeIm = 'RangeOffsetImage.xml' initRangeIm = InitFromXmlFile(initfileRangeIm) objRangeIm = MhtImage() # only sets the parameter objRangeIm.initComponent(initRangeIm) # it actually creates the C++ object objRangeIm.createImage() obj = Resamp_image() obj.initComponent(initResamp_image) obj.initComponent(initDict) obj.resamp_image(objRangeIm) objRangeIm.finalizeImage()
def main(): obj = Nbymhgt() infile = "/Users/giangi/TEST_DIR/int_930110_950523/reference.hgt" outfile = 'testHgt' rlook = 2 alook = 2 width = 5700 enIn = 'l' enOut = 'l' length = 2593 #with all arguments #dict = {'INPUT_ENDIANNESS':enIn,'OUTPUT_ENDIANNESS':enOut,'LENGTH':length,'WIDTH':width,'INPUT_IMAGE':infile,'OUTPUT_IMAGE':outfile,'RANGE_LOOK':rlook,'AZIMUTH_LOOK':alook} #with only mandatory arguments dict = { 'WIDTH': width, 'INPUT_IMAGE': infile, 'OUTPUT_IMAGE': outfile, 'RANGE_LOOK': rlook, 'AZIMUTH_LOOK': alook } initDict = InitFromDictionary(dict) obj.initComponent(initDict) obj.nbymhgt()
def main(): filename = sys.argv[1] #rgoffset.out fin = open(filename) allLines = fin.readlines() locationAc = [] locationAcOffset = [] locationDn = [] locationDnOffset = [] snr = [] for line in allLines: lineS = line.split() locationAc.append(float(lineS[0])) locationAcOffset.append(float(lineS[1])) locationDn.append(float(lineS[2])) locationDnOffset.append(float(lineS[3])) snr.append(float(lineS[4])) dict = {} dict['LOCATION_ACROSS1'] = locationAc dict['LOCATION_ACROSS_OFFSET1'] = locationAcOffset dict['LOCATION_DOWN1'] = locationDn dict['LOCATION_DOWN_OFFSET1'] = locationDnOffset dict['SNR1'] = snr initDict = InitFromDictionary(dict) initfileResamp_amps = 'Resamp_amps.xml' initResamp_amps = InitFromXmlFile(initfileResamp_amps) initfileAmpIn = 'AmpImageIn.xml' initAmpIn = InitFromXmlFile(initfileAmpIn) objAmpIn = AmpImage() # only sets the parameter objAmpIn.initComponent(initAmpIn) # it actually creates the C++ object objAmpIn.createImage() initfileAmpOut = 'AmpImageOut.xml' initAmpOut = InitFromXmlFile(initfileAmpOut) objAmpOut = AmpImage() # only sets the parameter objAmpOut.initComponent(initAmpOut) # it actually creates the C++ object objAmpOut.createImage() obj = Resamp_amps() obj.initComponent(initResamp_amps) obj.initComponent(initDict) obj.resamp_amps(objAmpIn, objAmpOut) ulr = obj.getULRangeOffset() ula = obj.getULAzimuthOffset() urr = obj.getURRangeOffset() ura = obj.getURAzimuthOffset() lrr = obj.getLRRangeOffset() lra = obj.getLRAzimuthOffset() llr = obj.getLLRangeOffset() lla = obj.getLLAzimuthOffset() cr = obj.getCenterRangeOffset() ca = obj.getCenterAzimuthOffset() print(ulr, ula, urr, ura, lrr, lra, llr, lla, cr, ca) objAmpIn.finalizeImage() objAmpOut.finalizeImage()