Skip to content

Commit

Permalink
exploit np.all in eta mod
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored and mlee03 committed Jan 26, 2024
1 parent 42fda95 commit c2f2acf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions util/pace/util/grid/eta.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ def set_hybrid_pressure_coefficients(
# check that the eta values computed from ak and bk are monotonically increasing
eta, etav = check_eta(ak, bk)

(eta_sorted, etav_sorted) = (np.sort(eta), np.sort(etav))
for i in range(eta.size):
if eta_sorted[i] != eta[i]:
raise ValueError("ETA values are not monotonically increasing")
if etav_sorted[i] != etav[i]:
raise ValueError("ETAV values are not monotonically increasing")
if not np.all(eta[:-1] <= eta[1:]):
raise ValueError("ETA values are not monotonically increasing")
if not np.all(etav[:-1] <= etav[1:]):
raise ValueError("ETAV values are not monotonically increasing")

if 0.0 in bk:
ks = 0 if km == 91 else np.where(bk == 0)[0][-1]
Expand Down

0 comments on commit c2f2acf

Please sign in to comment.