44import numpy .typing as npt
55
66from parcels ._typing import Mesh , assert_valid_mesh
7- from parcels .tools .converters import TimeConverter
87
98__all__ = [
109 "CurvilinearSGrid" ,
@@ -31,7 +30,6 @@ def __init__(
3130 lon : npt .NDArray ,
3231 lat : npt .NDArray ,
3332 time : npt .NDArray | None ,
34- time_origin : TimeConverter | None ,
3533 mesh : Mesh ,
3634 ):
3735 lon = np .array (lon )
@@ -52,8 +50,6 @@ def __init__(
5250 self ._lat = lat
5351 self .time = time
5452 self .tdim = time .size
55- self ._time_origin = TimeConverter () if time_origin is None else time_origin
56- assert isinstance (self .time_origin , TimeConverter ), "time_origin needs to be a TimeConverter object"
5753 assert_valid_mesh (mesh )
5854 self ._mesh = mesh
5955 self ._zonal_periodic = False
@@ -63,11 +59,7 @@ def __init__(
6359
6460 def __repr__ (self ):
6561 with np .printoptions (threshold = 5 , suppress = True , linewidth = 120 , formatter = {"float" : "{: 0.2f}" .format }):
66- return (
67- f"{ type (self ).__name__ } ("
68- f"lon={ self .lon !r} , lat={ self .lat !r} , time={ self .time !r} , "
69- f"time_origin={ self .time_origin !r} , mesh={ self .mesh !r} )"
70- )
62+ return f"{ type (self ).__name__ } (lon={ self .lon !r} , lat={ self .lat !r} , time={ self .time !r} , "
7163
7264 @property
7365 def lon (self ):
@@ -89,10 +81,6 @@ def mesh(self):
8981 def lonlat_minmax (self ):
9082 return self ._lonlat_minmax
9183
92- @property
93- def time_origin (self ):
94- return self ._time_origin
95-
9684 @property
9785 def zonal_periodic (self ):
9886 return self ._zonal_periodic
@@ -103,7 +91,6 @@ def create_grid(
10391 lat : npt .ArrayLike ,
10492 depth ,
10593 time ,
106- time_origin ,
10794 mesh : Mesh ,
10895 ):
10996 lon = np .array (lon )
@@ -114,14 +101,14 @@ def create_grid(
114101
115102 if len (lon .shape ) <= 1 :
116103 if depth is None or len (depth .shape ) <= 1 :
117- return RectilinearZGrid (lon , lat , depth , time , time_origin = time_origin , mesh = mesh )
104+ return RectilinearZGrid (lon , lat , depth , time , mesh = mesh )
118105 else :
119- return RectilinearSGrid (lon , lat , depth , time , time_origin = time_origin , mesh = mesh )
106+ return RectilinearSGrid (lon , lat , depth , time , mesh = mesh )
120107 else :
121108 if depth is None or len (depth .shape ) <= 1 :
122- return CurvilinearZGrid (lon , lat , depth , time , time_origin = time_origin , mesh = mesh )
109+ return CurvilinearZGrid (lon , lat , depth , time , mesh = mesh )
123110 else :
124- return CurvilinearSGrid (lon , lat , depth , time , time_origin = time_origin , mesh = mesh )
111+ return CurvilinearSGrid (lon , lat , depth , time , mesh = mesh )
125112
126113 def _check_zonal_periodic (self ):
127114 if self .zonal_periodic or self .mesh == "flat" or self .lon .size == 1 :
@@ -167,14 +154,14 @@ class RectilinearGrid(Grid):
167154
168155 """
169156
170- def __init__ (self , lon , lat , time , time_origin , mesh : Mesh ):
157+ def __init__ (self , lon , lat , time , mesh : Mesh ):
171158 assert isinstance (lon , np .ndarray ) and len (lon .shape ) <= 1 , "lon is not a numpy vector"
172159 assert isinstance (lat , np .ndarray ) and len (lat .shape ) <= 1 , "lat is not a numpy vector"
173160 assert isinstance (time , np .ndarray ) or not time , "time is not a numpy array"
174161 if isinstance (time , np .ndarray ):
175162 assert len (time .shape ) == 1 , "time is not a vector"
176163
177- super ().__init__ (lon , lat , time , time_origin , mesh )
164+ super ().__init__ (lon , lat , time , mesh )
178165
179166 @property
180167 def xdim (self ):
@@ -199,8 +186,6 @@ class RectilinearZGrid(RectilinearGrid):
199186 The depth of the different layers is thus constant.
200187 time :
201188 Vector containing the time coordinates of the grid
202- time_origin : parcels.tools.converters.TimeConverter
203- Time origin of the time axis
204189 mesh : str
205190 String indicating the type of mesh coordinates and
206191 units used during velocity interpolation:
@@ -210,8 +195,8 @@ class RectilinearZGrid(RectilinearGrid):
210195 2. flat: No conversion, lat/lon are assumed to be in m.
211196 """
212197
213- def __init__ (self , lon , lat , depth = None , time = None , time_origin = None , mesh : Mesh = "flat" ):
214- super ().__init__ (lon , lat , time , time_origin , mesh )
198+ def __init__ (self , lon , lat , depth = None , time = None , mesh : Mesh = "flat" ):
199+ super ().__init__ (lon , lat , time , mesh )
215200 if isinstance (depth , np .ndarray ):
216201 assert len (depth .shape ) <= 1 , "depth is not a vector"
217202
@@ -247,8 +232,6 @@ class RectilinearSGrid(RectilinearGrid):
247232 depth array is either a 4D array[xdim][ydim][zdim][tdim] or a 3D array[xdim][ydim[zdim].
248233 time :
249234 Vector containing the time coordinates of the grid
250- time_origin : parcels.tools.converters.TimeConverter
251- Time origin of the time axis
252235 mesh : str
253236 String indicating the type of mesh coordinates and
254237 units used during velocity interpolation:
@@ -264,10 +247,9 @@ def __init__(
264247 lat : npt .NDArray ,
265248 depth : npt .NDArray ,
266249 time : npt .NDArray | None = None ,
267- time_origin : TimeConverter | None = None ,
268250 mesh : Mesh = "flat" ,
269251 ):
270- super ().__init__ (lon , lat , time , time_origin , mesh )
252+ super ().__init__ (lon , lat , time , mesh )
271253 assert isinstance (depth , np .ndarray ) and len (depth .shape ) in [3 , 4 ], "depth is not a 3D or 4D numpy array"
272254
273255 self ._gtype = GridType .RectilinearSGrid
@@ -306,7 +288,6 @@ def __init__(
306288 lon : npt .NDArray ,
307289 lat : npt .NDArray ,
308290 time : npt .NDArray | None = None ,
309- time_origin : TimeConverter | None = None ,
310291 mesh : Mesh = "flat" ,
311292 ):
312293 assert isinstance (lon , np .ndarray ) and len (lon .squeeze ().shape ) == 2 , "lon is not a 2D numpy array"
@@ -317,7 +298,7 @@ def __init__(
317298
318299 lon = lon .squeeze ()
319300 lat = lat .squeeze ()
320- super ().__init__ (lon , lat , time , time_origin , mesh )
301+ super ().__init__ (lon , lat , time , mesh )
321302
322303 @property
323304 def xdim (self ):
@@ -342,8 +323,6 @@ class CurvilinearZGrid(CurvilinearGrid):
342323 The depth of the different layers is thus constant.
343324 time :
344325 Vector containing the time coordinates of the grid
345- time_origin : parcels.tools.converters.TimeConverter
346- Time origin of the time axis
347326 mesh : str
348327 String indicating the type of mesh coordinates and
349328 units used during velocity interpolation:
@@ -359,10 +338,9 @@ def __init__(
359338 lat : npt .NDArray ,
360339 depth : npt .NDArray | None = None ,
361340 time : npt .NDArray | None = None ,
362- time_origin : TimeConverter | None = None ,
363341 mesh : Mesh = "flat" ,
364342 ):
365- super ().__init__ (lon , lat , time , time_origin , mesh )
343+ super ().__init__ (lon , lat , time , mesh )
366344 if isinstance (depth , np .ndarray ):
367345 assert len (depth .shape ) == 1 , "depth is not a vector"
368346
@@ -396,8 +374,6 @@ class CurvilinearSGrid(CurvilinearGrid):
396374 depth array is either a 4D array[xdim][ydim][zdim][tdim] or a 3D array[xdim][ydim[zdim].
397375 time :
398376 Vector containing the time coordinates of the grid
399- time_origin : parcels.tools.converters.TimeConverter
400- Time origin of the time axis
401377 mesh : str
402378 String indicating the type of mesh coordinates and
403379 units used during velocity interpolation:
@@ -413,10 +389,9 @@ def __init__(
413389 lat : npt .NDArray ,
414390 depth : npt .NDArray ,
415391 time : npt .NDArray | None = None ,
416- time_origin : TimeConverter | None = None ,
417392 mesh : Mesh = "flat" ,
418393 ):
419- super ().__init__ (lon , lat , time , time_origin , mesh )
394+ super ().__init__ (lon , lat , time , mesh )
420395 assert isinstance (depth , np .ndarray ) and len (depth .shape ) in [3 , 4 ], "depth is not a 4D numpy array"
421396
422397 self ._gtype = GridType .CurvilinearSGrid
0 commit comments