Skip to content

Commit 46724c4

Browse files
authored
Merge pull request #1611 from knutfrode/dev
[run-ex] Suppressing warning when plotting trajectories containing NaN
2 parents 4a7aa83 + 09d8278 commit 46724c4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

examples/example_depth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
#%%
3535
# Plot results with lines and particles colored by depth
3636
print(o)
37-
o.plot(linecolor='z', buffer=.1, show_elements=False, contourlines=True)
38-
o.animation(color='z', buffer=.1, contourlines=True)
37+
o.plot(linecolor='z', buffer=.1, show_elements=False)
38+
o.animation(color='z', buffer=.1)
3939

4040
#%%
4141
# .. image:: /gallery/animations/example_depth_0.gif

opendrift/models/basemodel/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,12 +3500,13 @@ def plot(self,
35003500
linewidth=linewidth,
35013501
transform=self.crs_lonlat)
35023502
else:
3503-
ax.plot(x,
3504-
y,
3505-
color=linecolor,
3506-
alpha=alpha,
3507-
linewidth=linewidth,
3508-
transform=self.crs_lonlat)
3503+
with np.errstate(invalid="ignore"):
3504+
ax.plot(x,
3505+
y,
3506+
color=linecolor,
3507+
alpha=alpha,
3508+
linewidth=linewidth,
3509+
transform=self.crs_lonlat)
35093510
else:
35103511
#colorbar = True
35113512
# Color lines according to given parameter

0 commit comments

Comments
 (0)