def test_run(overwrite_desired_data=False): lpy_filename = os.path.join(lgrass.__path__[0], "lgrass.lpy") lsys = Lsystem(lpy_filename) axiom = lsys.axiom lsys.meteo_path = os.path.join(INPUTS_DIRPATH, 'meteo_file.csv') lsys.INPUTS_DIRPATH = INPUTS_DIRPATH lsys.OUTPUTS_DIRPATH = OUTPUTS_DIRPATH lsys.GRAPHS_DIRPATH = GRAPHS_DIRPATH lsys.derivationLength = NSTEP lsys.DureeExp = NSTEP lsys.option_tallage = True lsys.option_senescence = True lsys.option_floraison = True lsys.option_caribu = 'Off' lsys.option_tiller_regression = False lsys.option_mophogenetic_regulation_by_carbone = False lsys.derive(axiom, NSTEP) # convert the outputs to Pandas dataframe surface_biomass = pd.read_csv(lsys.chemin_fichier1.name) evol = pd.read_csv(lsys.chemin_fichier2.name) output_induction_file_path = os.path.join(OUTPUTS_DIRPATH, 'output_induction.csv') output_induction = pd.read_csv(output_induction_file_path) output_organ_lengths_file_path = os.path.join(OUTPUTS_DIRPATH, 'output_organ_lengths.csv') output_organ_lengths = pd.read_csv(output_organ_lengths_file_path) # # compare outputs compare_actual_to_desired(OUTPUTS_DIRPATH, surface_biomass, DESIRED_SORTIE_SURFACE_BIOMASS_FILENAME, lsys.chemin_fichier1.name, overwrite_desired_data) compare_actual_to_desired(OUTPUTS_DIRPATH, evol, DESIRED_SERIE_FOLIAIRE_FILENAME, lsys.chemin_fichier2.name, overwrite_desired_data) compare_actual_to_desired(OUTPUTS_DIRPATH, output_induction, DESIRED_OUTPUT_INDUCTION_FILENAME, output_induction_file_path, overwrite_desired_data) compare_actual_to_desired(OUTPUTS_DIRPATH, output_organ_lengths, DESIRED_OUTPUT_ORGAN_LENGTHS_FILENAME, output_organ_lengths_file_path, overwrite_desired_data) if overwrite_desired_data: print("New desired files written") else: print("Test passed successfully")