def setUpClass(cls): from Chain import DummyFiles from Common import FileSystem cls.product_root = os.path.join(cls.root, cls.tile) FileSystem.create_directory(cls.product_root) DummyFiles.L1Generator(cls.product_root, tile=cls.tile, date=cls.start_product, platform="sentinel2").generate() DummyFiles.L1Generator(cls.product_root, tile=cls.tile, date=cls.end_product, platform="sentinel2").generate() for d in set([DummyFiles.random_date() for _ in range(cls.n_dummies)]): DummyFiles.L1Generator(cls.product_root, tile=cls.tile, date=d, platform="sentinel2").generate() DummyFiles.L2Generator(cls.product_root, tile=cls.tile, date=d, platform="sentinel2").generate() for d in set([DummyFiles.random_date() for _ in range(cls.n_not_used)]): DummyFiles.L1Generator(cls.product_root, date=d, platform="sentinel2").generate() DummyFiles.L2Generator(cls.product_root, date=d, platform="sentinel2").generate() cls.folders_file = os.path.join(cls.root, "test_working_folders_file.txt") modify_folders_file(cls.template_folders_file, new_file=cls.folders_file, exeMaja=os.getcwd(), repWork=os.getcwd(), repGIPP=os.getcwd(), repL1=os.getcwd(), repL2=os.getcwd(), repMNT=os.getcwd()) cls.mnt = DummyFiles.MNTGenerator(root=cls.root, tile=cls.tile, platform="sentinel2") cls.mnt.generate() cls.cams = os.path.join(cls.root, "CAMS") os.makedirs(cls.cams) DummyFiles.CAMSGenerator(cls.cams, cls.start_product).generate() DummyFiles.CAMSGenerator(cls.cams, cls.end_product).generate() for _ in range(cls.n_not_used): DummyFiles.CAMSGenerator(cls.cams).generate() assert os.path.isfile(cls.folders_file)
def setUpClass(cls): """ Sets up a random tree-like structure with a few sub-files and -folders Similar to test_FileSystem. :return: """ os.makedirs(cls.cams_dir) for i in range(cls.n_cams): DummyFiles.CAMSGenerator(cls.cams_dir).generate() for tile in cls.tiles: cls.mnt += [ DummyFiles.MNTGenerator(cls.root, tile=tile).generate() ]
def setUp(self): self.wdir = os.path.join(os.getcwd(), "wp_wdir") self.outdir = os.path.join(os.getcwd(), "wp_outdir") self.l1 = DummyFiles.L1Generator(root=os.getcwd(), tile="T11ABC", platform="sentinel2").generate() self.l1_list = [DummyFiles.L1Generator(root=os.getcwd(), tile="T11ABC", platform="sentinel2").generate() for _ in range(3)] self.other_l1 = [DummyFiles.L1Generator(root=os.getcwd()).generate() for _ in range(3)] self.l2 = DummyFiles.L2Generator(root=self.outdir, tile="T11ABC", platform="sentinel2").generate() self.other_l2 = [DummyFiles.L2Generator(root=self.outdir).generate() for _ in range(3)] self.gipp_dir = os.path.join(os.getcwd(), "gipp_dir") FileSystem.create_directory(self.gipp_dir) self.gipp = DummyFiles.GippGenerator(root=self.gipp_dir, platform="sentinel2").generate() self.cams = DummyFiles.CAMSGenerator(root=os.getcwd(), date=self.l1.date, platform="sentinel2").generate() FileSystem.create_directory(self.wdir) FileSystem.create_directory(self.outdir)