@@ -1084,7 +1084,12 @@ def seed_elements(self,
10841084 az = np .random .rand (np .sum (number )) * 360
10851085 dist = np .sqrt (np .random .uniform (0 , 1 ,
10861086 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 )
10881093
10891094 # If z is 'seafloor'
10901095 if not 'z' in kwargs or kwargs ['z' ] is None :
@@ -1917,7 +1922,7 @@ def run(self,
19171922 np .radians (np .mean (self .elements_scheduled .lat )))
19181923 # TODO: extent should ideally be a general polygon, not only lon/lat-min/max
19191924 # TODO: Should also take into account eventual lifetime of elements
1920- simulation_extent = [
1925+ simulation_extent = np . array ( [
19211926 np .maximum (- 360 ,
19221927 self .elements_scheduled .lon .min () - deltalon ),
19231928 np .maximum (- 89 ,
@@ -1926,7 +1931,7 @@ def run(self,
19261931 self .elements_scheduled .lon .max () + deltalon ),
19271932 np .minimum (89 ,
19281933 self .elements_scheduled .lat .max () + deltalat )
1929- ]
1934+ ])
19301935 if simulation_extent [2 ] == 360 and simulation_extent [0 ] < 0 :
19311936 simulation_extent [0 ] = 0
19321937
@@ -4473,9 +4478,16 @@ def update_positions(self, x_vel, y_vel):
44734478 velocity = velocity * self .elements .moving # Do not move frosen elements
44744479
44754480 # 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 )
44794491
44804492 # Check that new positions are valid
44814493 if (self .elements .lon .min ()
0 commit comments