Skip to content

Commit

Permalink
rename report to finalize to make more clear. Added deprecationwarnin…
Browse files Browse the repository at this point in the history
…g for report
  • Loading branch information
jensdebruijn committed Feb 17, 2025
1 parent 5963ce5 commit 55fc372
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions honeybees/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import zarr
from numcodecs import Blosc
from typing import Union, Any
import warnings

zstd_compressor = Blosc(cname="zstd", clevel=3, shuffle=Blosc.BITSHUFFLE)

Expand Down Expand Up @@ -237,7 +238,6 @@ def report_value(
raise ValueError(
f"Save type for {name} in config file must be 'save', 'save+export' or 'export')."
)
import warnings

warnings.warn(
"The `save` option is deprecated and will be removed in future versions. If you use 'save: export' the option can simply be removed (new default). If you use 'save: save', please replace with 'single_file: true'",
Expand Down Expand Up @@ -429,7 +429,7 @@ def step(self) -> None:
for name, conf in self.model.config["report"].items():
self.extract_agent_data(name, conf)

def report(self) -> dict:
def finalize(self) -> dict:
"""This method can be called to save the data that is currently saved in memory to disk."""
report_dict = {}
for name, values in self.variables.items():
Expand Down Expand Up @@ -459,3 +459,9 @@ def report(self) -> dict:
else:
raise ValueError(f"save_to format {export_format} unknown")
return report_dict

def report(self, *args, **kwargs):
warnings.warn(
"The `report` method is deprecated and will be removed in future versions. Please use the `finalize` method instead."
)
self.finalize()

0 comments on commit 55fc372

Please # to comment.