@@ -1084,7 +1084,12 @@ def seed_elements(self,
1084
1084
az = np .random .rand (np .sum (number )) * 360
1085
1085
dist = np .sqrt (np .random .uniform (0 , 1 ,
1086
1086
np .sum (number ))) * radius
1087
- lon , lat , az = geod .fwd (lon , lat , az , dist , radians = False )
1087
+ if len (lon ) > 1 :
1088
+ lon , lat , az = geod .fwd (lon , lat , az , dist , radians = False )
1089
+ else :
1090
+ lon , lat , az = geod .fwd (lon [0 ], lat [0 ], az [0 ], dist [0 ], radians = False )
1091
+ lon = np .atleast_1d (lon )
1092
+ lat = np .atleast_1d (lat )
1088
1093
1089
1094
# If z is 'seafloor'
1090
1095
if not 'z' in kwargs or kwargs ['z' ] is None :
@@ -1917,7 +1922,7 @@ def run(self,
1917
1922
np .radians (np .mean (self .elements_scheduled .lat )))
1918
1923
# TODO: extent should ideally be a general polygon, not only lon/lat-min/max
1919
1924
# TODO: Should also take into account eventual lifetime of elements
1920
- simulation_extent = [
1925
+ simulation_extent = np . array ( [
1921
1926
np .maximum (- 360 ,
1922
1927
self .elements_scheduled .lon .min () - deltalon ),
1923
1928
np .maximum (- 89 ,
@@ -1926,7 +1931,7 @@ def run(self,
1926
1931
self .elements_scheduled .lon .max () + deltalon ),
1927
1932
np .minimum (89 ,
1928
1933
self .elements_scheduled .lat .max () + deltalat )
1929
- ]
1934
+ ])
1930
1935
if simulation_extent [2 ] == 360 and simulation_extent [0 ] < 0 :
1931
1936
simulation_extent [0 ] = 0
1932
1937
@@ -4473,9 +4478,16 @@ def update_positions(self, x_vel, y_vel):
4473
4478
velocity = velocity * self .elements .moving # Do not move frosen elements
4474
4479
4475
4480
# Calculate new positions
4476
- self .elements .lon , self .elements .lat , back_az = geod .fwd (
4477
- self .elements .lon , self .elements .lat , azimuth ,
4478
- velocity * self .time_step .total_seconds ())
4481
+ if len (self .elements .lon ) > 1 :
4482
+ self .elements .lon , self .elements .lat , back_az = geod .fwd (
4483
+ self .elements .lon , self .elements .lat , azimuth ,
4484
+ velocity * self .time_step .total_seconds ())
4485
+ else : # Avoiding pyproj warning for arrays with length 1
4486
+ self .elements .lon , self .elements .lat , back_az = geod .fwd (
4487
+ self .elements .lon [0 ], self .elements .lat [0 ], azimuth [0 ],
4488
+ velocity [0 ] * self .time_step .total_seconds ())
4489
+ self .elements .lon = np .atleast_1d (self .elements .lon )
4490
+ self .elements .lat = np .atleast_1d (self .elements .lat )
4479
4491
4480
4492
# Check that new positions are valid
4481
4493
if (self .elements .lon .min ()
0 commit comments