Skip to content

Commit 2e50c5d

Browse files
authored
Merge pull request #1739 from knutfrode/dev
Dev
2 parents 72ef044 + 6ae5dbc commit 2e50c5d

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

opendrift/models/basemodel/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,7 +2420,7 @@ def index_of_first_and_last(self):
24202420

24212421
def set_up_map(self,
24222422
corners=None,
2423-
buffer=.1,
2423+
buffer='auto',
24242424
delta_lat=None,
24252425
lscale=None,
24262426
fast=False,
@@ -2461,6 +2461,9 @@ def set_up_map(self,
24612461
lonmax = np.nanmax(lons)
24622462
latmin = np.nanmin(lats)
24632463
latmax = np.nanmax(lats)
2464+
if buffer == 'auto':
2465+
buffer_fraction = 0.3 # 30% whitespace, to be updated
2466+
buffer = np.maximum((lonmax-lonmin)/2, latmax-latmin)*buffer_fraction
24642467
lonmin = lonmin - buffer * 2
24652468
lonmax = lonmax + buffer * 2
24662469
latmin = latmin - buffer
@@ -2617,7 +2620,7 @@ def set_up_map(self,
26172620

26182621

26192622
def animation(self,
2620-
buffer=.2,
2623+
buffer='auto',
26212624
corners=None,
26222625
filename=None,
26232626
compare=None,
@@ -3347,7 +3350,7 @@ def _get_comparison_xy_for_plots(self, compare):
33473350

33483351
def plot(self,
33493352
background=None,
3350-
buffer=.2,
3353+
buffer='auto',
33513354
corners=None,
33523355
linecolor=None,
33533356
filename=None,

tests/plotting/test_norkyst.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_fast_norkyst():
2020
time=rn.start_time)
2121
o.run(steps=2)
2222

23-
return o.plot(fast=True)[1]
23+
return o.plot(fast=True, buffer=.2)[1]
2424

2525

2626
@pytest.mark.slow
@@ -38,4 +38,4 @@ def test_norkyst():
3838
time=rn.start_time)
3939
o.run(steps=2)
4040

41-
return o.plot(fast=False)[1]
41+
return o.plot(fast=False, buffer=.2)[1]

0 commit comments

Comments
 (0)