def setUpClass(cls): # create common combined header obj so the headers are only read once # tricker: needs both ifg headers, and DEM one for the extents filenames = ['r20090713_VV.slc.par', 'r20090817_VV.slc.par'] hdr_paths = [join(GAMMA_TEST_DIR, f) for f in filenames] hdrs = [gamma.parse_epoch_header(p) for p in hdr_paths] dem_hdr_path = join(GAMMA_TEST_DIR, 'dem16x20raw.dem.par') cls.DEM_HDR = gamma.parse_dem_header(dem_hdr_path) cls.COMBINED = gamma.combine_headers(*hdrs, dem_hdr=cls.DEM_HDR)
def test_combine_headers(self): filenames = ['r20090713_VV.slc.par', 'r20090817_VV.slc.par'] paths = [join(GAMMA_TEST_DIR, p) for p in filenames] hdr0, hdr1 = [gamma.parse_epoch_header(p) for p in paths] chdr = gamma.combine_headers(hdr0, hdr1, self.dh) exp_timespan = (18 + 17) / ifc.DAYS_PER_YEAR self.assertEqual(chdr[ifc.PYRATE_TIME_SPAN], exp_timespan) exp_date = date(2009, 7, 13) self.assertEqual(chdr[ifc.MASTER_DATE], exp_date) exp_date2 = date(2009, 8, 17) self.assertEqual(chdr[ifc.SLAVE_DATE], exp_date2) exp_wavelen = LIGHTSPEED / 5.3310040e+09 self.assertEqual(chdr[ifc.PYRATE_WAVELENGTH_METRES], exp_wavelen)