polca / premise

Coupling Integrated Assessment Models output with Life Cycle Assessment.
BSD 3-Clause "New" or "Revised" License
100 stars 45 forks source link

Suggestion: append scenario diff files name with date of creation #160

Closed mkvdhulst closed 2 months ago

mkvdhulst commented 3 months ago

At present, change reports, datapackages, and scenario_reports in the export folder of premise are all appended with a date, while the scenario diff file is not. Thus, when I want the re-run premise, I first have to manually back-up the scenario diff file present in the export folder, otherwise it gets overwritten. It would be helpful if the scenario diff file were also appended with the date of creation.

To make the process even more resilient, it might be valuable to also append all these files with the time of creation. That way, you can use premise in one environment multiple times a day to create databases for various projects, without the risk of any output files being overwritten because a file with the same name already exists.

romainsacchi commented 2 months ago

Hi @mkvdhulst, with the latest commit, scenario difference files are by default saved with today's date and hour of the day in the name. Note that you can also decide of the name of the file by using the argument name such as:

def write_superstructure_db_to_brightway(
        self,
        name: str = f"super_db_{date.today().strftime('%d-%m-%Y %H_%M')}",
        filepath: str = None,
        file_format: str = "excel",
    )

I will release that as 2.1.0.dev1.