def setUp(self): """Set up the tests.""" # ipr is not present in the xml format ? self.scan_lines = 1080 self.earth_views = 2048 sections = self._create_structure() sections[('mphr', 0)]['TOTAL_MDR'] = ( b'TOTAL_MDR = ' + bytes(str(self.scan_lines), encoding='ascii') + b'\n') sections[( 'mphr', 0)]['SPACECRAFT_ID'] = b'SPACECRAFT_ID = M03\n' sections[( 'mphr', 0)]['INSTRUMENT_ID'] = b'INSTRUMENT_ID = AVHR\n' sections[('sphr', 0)]['EARTH_VIEWS_PER_SCANLINE'] = ( b'EARTH_VIEWS_PER_SCANLINE = ' + bytes(str(self.earth_views), encoding='ascii') + b'\n') sections[( 'sphr', 0)]['NAV_SAMPLE_RATE'] = b'NAV_SAMPLE_RATE = 20\n' _fd, fname = mkstemp() fd = open(_fd) self.filename = fname for _, arr in sections.items(): arr.tofile(fd) fd.close() self.fh = eps.EPSAVHRRFile(self.filename, { 'start_time': 'now', 'end_time': 'later' }, {})
def setUp(self): """Set up the tests.""" # ipr is not present in the xml format ? structure = [(1, ('mphr', 0)), (1, ('sphr', 0)), (11, ('ipr', 0)), (1, ('geadr', 1)), (1, ('geadr', 2)), (1, ('geadr', 3)), (1, ('geadr', 4)), (1, ('geadr', 5)), (1, ('geadr', 6)), (1, ('geadr', 7)), (1, ('giadr', 1)), (1, ('giadr', 2)), (1, ('veadr', 1)), (1080, ('mdr', 2))] sections = create_sections(structure) sections[( 'mphr', 0)]['TOTAL_MDR'] = b'TOTAL_MDR = 1080\n' sections[( 'mphr', 0)]['SPACECRAFT_ID'] = b'SPACECRAFT_ID = M03\n' sections[( 'mphr', 0)]['INSTRUMENT_ID'] = b'INSTRUMENT_ID = AVHR\n' sections[( 'sphr', 0 )]['EARTH_VIEWS_PER_SCANLINE'] = b'EARTH_VIEWS_PER_SCANLINE = 2048\n' _fd, fname = mkstemp() fd = open(_fd) self.filename = fname for _, arr in sections.items(): arr.tofile(fd) fd.close() self.fh = eps.EPSAVHRRFile(self.filename, { 'start_time': 'now', 'end_time': 'later' }, {})