Skip to content

Commit

Permalink
Make a deep copy of PatchCollections
Browse files Browse the repository at this point in the history
The shallow copy previously used (`copy.copy()`) was allowing
modifications of attributes to persist across different plots,
with unintended consequences.
  • Loading branch information
xylar committed Jan 2, 2025
1 parent e4d53af commit be0e125
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compass/ocean/tests/isomip_plus/viz/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,10 @@ def _plot_horiz_field(self, field, title, outFileName, oceanDomain=True,
return

if oceanDomain:
localPatches = copy.copy(self.oceanPatches)
localPatches = copy.deepcopy(self.oceanPatches)
localPatches.set_array(field[self.oceanMask])
else:
localPatches = copy.copy(self.cavityPatches)
localPatches = copy.deepcopy(self.cavityPatches)
localPatches.set_array(field[self.cavityMask])

if cmap is not None:
Expand Down

0 comments on commit be0e125

Please sign in to comment.