예제 #1
0
    def test_readme_cmd(self):
        print("Running ", str(self.id()).split('.')[2])
        parser = make_parser()
        cmdlist = _cmd_list()
        cmdlist.append("--onlyProcessing")
        # only-processing means something else has to make the data!!! (no call to C++)

        args = parser.parse_args(cmdlist)
        env = Cell2FireC(args)  # see main.py
        env.stats()

        # Check if the result generated by the run matches the baseline files
        equal = True
        with open(result_Forest08) as result_file:
            with open(baseline_Forest08) as baseline_file:
                for line1, line2 in zip(result_file, baseline_file):
                    if not line1 == line2:
                        equal = False
                        print(
                            "In File Grids1/ForestGrid08.csv the result is wrong"
                        )

        imgfire1 = Image.open(result_Fire09)
        imgfire2 = Image.open(baseline_Fire09)
        imgprop1 = Image.open(result_Propagation)
        imgprop2 = Image.open(baseline_Propagation)
        diffFire = ImageChops.difference(imgfire1, imgfire2)
        diffProp = ImageChops.difference(imgprop1, imgprop2)
        """
예제 #2
0
    def test_readme_cmd(self):
        print("Running ", str(self.id()).split('.')[2])
        parser = make_parser()
        cmdlist = _readme_list()
        cmdlist.append("--onlyProcessing")
        # only-processing means something else has to make the data!!! (no call to C++)

        args = parser.parse_args(cmdlist)
        env = Cell2FireC(args)  # see main.py
        env.stats()

        # Testing Fraction0.2
        results_path = os.path.abspath(
            os.path.join("..", "results", "Sub40x40", "Heuristic",
                         "Max_Utility_Adj", "Fraction0.2"))
        csv_path = os.path.join(results_path, "Stats", "FinalStats.csv")
        df = pd.read_csv(csv_path)

        # Burned cells
        self.assertAlmostEqual(df['Burned'][0], 15), "TEST ERROR"
        self.assertAlmostEqual(df['Burned'][6], 397), "TEST ERROR"
        self.assertAlmostEqual(df['Burned'][9], 64), "TEST ERROR"

        # Harvest cells
        self.assertAlmostEqual(df['Harvested'][1], 288), "TEST ERROR"
        self.assertAlmostEqual(df['Harvested'][5], 288), "TEST ERROR"
        self.assertAlmostEqual(df['Harvested'][8], 288), "TEST ERROR"
예제 #3
0
    def test_readme_cmd(self):
        baselist = ["--input-instance-folder", "../data/Sub40x40/",
            "--output-folder", "../results/Sub40x40",
            "--ignitions",
            "--sim-years", "1",
            "--nsims",  "5",
            "--finalGrid",
            "--weather", "rows",
            "--nweathers", "1",
            "--Fire-Period-Length", "1.0",
            "--output-messages",
            "--ROS-CV", "0.0",
            "--seed", "123",
            "--stats",
            "--allPlots",
            "--IgnitionRad", "5",
            "--grids",
            "--combine"]
        parser = make_parser()
        args = parser.parse_args(baselist)
        env = Cell2FireC(args)
        env.stats()
        # Postprocessing: Plots Stats
        if args.stats:
            print("------ Generating Statistics --------")
            env.stats()

        DataGenerator.GenDataFile(env.args.InFolder)
예제 #4
0
    def test_readme_cmd(self):
        print("Running ", str(self.id()).split('.')[2])
        parser = make_parser()
        cmdlist = _readme_list()
        cmdlist.append("--onlyProcessing")
        # only-processing means something else has to make the data!!! (no call to C++)

        args = parser.parse_args(cmdlist)
        env = Cell2FireC(args)  # see main.py
        env.stats()
예제 #5
0
    def test_readme_cmd(self):
        print("Running ", str(self.id()).split('.')[2])
        parser = make_parser()
        cmdlist = _readme_list()
        cmdlist.append("--onlyProcessing")
        # only-processing means something else has to make the data!!! (no call to C++)

        args = parser.parse_args(cmdlist)
        env = Cell2FireC(args)  # see main.py
        env.stats()

        csv_path = os.path.join(data_path, "..", "results", "dogrib_n100cv05",
                                "Stats", "HourlySummaryAVG.csv")
        df = pd.read_csv(csv_path)
        self.assertAlmostEqual(df['AVGNonBurned'][6], 78091.0), "TEST ERROR"
        self.assertAlmostEqual(df['AVGNonBurned'][7], 77533.333), "TEST ERROR"
예제 #6
0
    def test_readme_cmd(self):
        print("Running ", str(self.id()).split('.')[2])
        parser = make_parser()
        cmdlist = _readme_list()
        cmdlist.append("--onlyProcessing")
        # only-processing means something else has to make the data!!! (no call to C++)

        args = parser.parse_args(cmdlist)
        env = Cell2FireC(args)  # see main.py
        env.stats()

        csv_path = os.path.join(data_path, "..", "results", "Sub40x40",
                                "Messages", "MessagesFile01.csv")
        df = pd.read_csv(csv_path, names=["node1", "node2", "time", "ros"])
        self.assertAlmostEqual(df['node1'][10], 935, 0), "TEST ERROR"
        self.assertAlmostEqual(df['node2'][10], 896, 0), "TEST ERROR"
        self.assertAlmostEqual(df['time'][10], 139, 0), "TEST ERROR"
        self.assertAlmostEqual(df['node2'][10], 14.1367, 2), "TEST ERROR"
예제 #7
0
    def test_readme_cmd(self):
        print("Running ", str(self.id()).split('.')[2])
        parser = make_parser()
        cmdlist = _cmd_list()
        cmdlist.append("--onlyProcessing")
        # only-processing means something else has to make the data!!! (no call to C++)

        args = parser.parse_args(cmdlist)
        env = Cell2FireC(args)  # see main.py
        env.stats()

        # Check if the result generated by the run matches the baseline files
        equal = True
        with open(result_path) as result_file:
            with open(baseline_path) as baseline_file:
                for line1, line2 in zip(result_file, baseline_file):
                    if not line1 == line2:
                        equal = False
                        print(
                            "In File Grids1/ForestGrid08.csv the result is wrong"
                        )

        self.assertTrue(equal)