Skip to content

Commit

Permalink
nan min/max to handle possible nan ghosts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasaunai committed Nov 11, 2024
1 parent e61b34c commit de920ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pyphare/pyphare/pharesee/hierarchy/hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,11 @@ def global_min(self, qty, **kwargs):
for patch in lvl.patches:
pd = patch.patch_datas[qty]
if first:
m = pd.dataset[:].min()
m = np.nanmin(pd.dataset[:])
first = False
else:
m = min(m, pd.dataset[:].min())
data_and_min = np.concatenate(([m], pd.dataset[:]))
m = np.nanmin(data_and_min)

return m

Expand All @@ -289,10 +290,11 @@ def global_max(self, qty, **kwargs):
for patch in lvl.patches:
pd = patch.patch_datas[qty]
if first:
m = pd.dataset[:].max()
m = np.nanmax(pd.dataset[:])
first = False
else:
m = max(m, pd.dataset[:].max())
data_and_max = np.concatenate(([m], pd.dataset[:]))
m = np.nanmax(data_and_max)

return m

Expand Down

0 comments on commit de920ac

Please sign in to comment.