Skip to content

Commit da07698

Browse files
committed
fix(global average): Analytics explorer global average fix
1 parent 2227cd5 commit da07698

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

src/pan3d/ui/analytics.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,22 +223,20 @@ def apply_spatial_average_full_temporal(self, axis=None):
223223
"""
224224
Calculate spatial average for data for full temporal resoulution
225225
"""
226-
if axis is None:
227-
axis = ["X"]
228-
229226
ds = self.source.input
230227
active_var = self.state.color_by
231-
232228
select = self.get_selection_criteria(full_temporal=True)
233-
average = (
234-
ds.isel(select).spatial.average(active_var, axis)
235-
if axis is not None
236-
else ds.isel(select).spatial.average(active_var)
237-
)
238-
229+
# Apply spatial average
230+
if axis is not None:
231+
average = ds.isel(select).spatial.average(active_var, axis)
232+
else:
233+
average = ds.isel(select).spatial.average(active_var)
234+
# Optionally apply temporal grouping
239235
group_by = self.state.group_by
236+
240237
if group_by == group_options.get(GroupBy.NONE):
241238
return average
239+
242240
return average.temporal.group_average(
243241
active_var, freq=group_by.lower(), weighted=True
244242
)

0 commit comments

Comments
 (0)