Skip to content

Commit 7c1f7a4

Browse files
koito19960406claude
andcommitted
fix: reset self.df at start of compute_metadata to prevent DuplicateError
compute_metadata mutates self.df by adding timezone and local_datetime columns. Calling it a second time on the same instance caused a DuplicateError in the Polars join (_compute_timezones). Fix: re-read the CSV at the start of each call alongside the existing cache resets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 639e999 commit 7c1f7a4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/zensvi/metadata/mly_metadata.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,9 @@ def compute_metadata(
821821
# Clear per-call caches so repeated compute_metadata calls don't use stale data
822822
self._joined_daynight_cache = None
823823
self._seasons_grouped_cache = None
824+
# Reset self.df from disk so timezone/other columns added in a previous call
825+
# don't cause DuplicateError when compute_metadata is called more than once.
826+
self.df = pl.read_csv(self.path_input)
824827

825828
# check indicator_list and pre-compute metadata, e.g., timezone and local datetime
826829
if (

0 commit comments

Comments
 (0)