Skip to content

Commit

Permalink
numpy.min -> numpy.nanmin to avoid issues with masked input
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy authored May 14, 2024
1 parent a0c1fb4 commit 4115c76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions regional_mom6/regional_mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ def initial_condition(

## if min(temp) > 100 then assume that units must be degrees K
## (otherwise we can't be on Earth) and convert to degrees C
if np.min(tracers_out["temp"].isel({"zl": 0})) > 100:
if np.nanmin(tracers_out["temp"].isel({"zl": 0})) > 100:
tracers_out["temp"] -= 273.15

## Regrid the fields vertically
Expand Down Expand Up @@ -1910,7 +1910,7 @@ def rectangular_brushcut(self):
del segment_out["lat"]
## Convert temperatures to celsius # use pint
if (
np.min(segment_out[self.tracers["temp"]].isel({self.time: 0, self.z: 0}))
np.nanmin(segment_out[self.tracers["temp"]].isel({self.time: 0, self.z: 0}))
> 100
):
segment_out[self.tracers["temp"]] -= 273.15
Expand Down

0 comments on commit 4115c76

Please sign in to comment.