@@ -190,12 +190,6 @@ def __init__(
190
190
time_origin = TimeConverter (0 )
191
191
self .grid = Grid .create_grid (lon , lat , depth , time , time_origin = time_origin , mesh = mesh )
192
192
self .igrid = - 1
193
- # self.lon, self.lat, self.depth and self.time are not used any more in parcels.
194
- # self.grid should be used instead.
195
- # Those variables are still defined for backwards compatibility with users codes.
196
- self .lon = self .grid .lon
197
- self .lat = self .grid .lat
198
- self .depth = self .grid .depth
199
193
self .fieldtype = self .name if fieldtype is None else fieldtype
200
194
self .to_write = to_write
201
195
if self .grid .mesh == "flat" or (self .fieldtype not in unitconverters_map .keys ()):
@@ -307,6 +301,21 @@ def __init__(
307
301
if len (kwargs ) > 0 :
308
302
raise SyntaxError (f'Field received an unexpected keyword argument "{ list (kwargs .keys ())[0 ]} "' )
309
303
304
+ @property
305
+ def lon (self ):
306
+ """Lon defined on the Grid object"""
307
+ return self .grid .lon
308
+
309
+ @property
310
+ def lat (self ):
311
+ """Lat defined on the Grid object"""
312
+ return self .grid .lat
313
+
314
+ @property
315
+ def depth (self ):
316
+ """Depth defined on the Grid object"""
317
+ return self .grid .depth
318
+
310
319
@classmethod
311
320
def get_dim_filenames (cls , filenames , dim ):
312
321
if isinstance (filenames , str ) or not isinstance (filenames , collections .abc .Iterable ):
@@ -1542,8 +1551,6 @@ def add_periodic_halo(self, zonal, meridional, halosize=5, data=None):
1542
1551
(data [:, :, :, - halosize :], data , data [:, :, :, 0 :halosize ]), axis = len (data .shape ) - 1
1543
1552
)
1544
1553
assert data .shape [3 ] == self .grid .xdim , "Fourth dim must be x."
1545
- self .lon = self .grid .lon
1546
- self .lat = self .grid .lat
1547
1554
if meridional :
1548
1555
if len (data .shape ) == 3 :
1549
1556
data = lib .concatenate ((data [:, - halosize :, :], data , data [:, 0 :halosize , :]), axis = len (data .shape ) - 2 )
@@ -1553,7 +1560,6 @@ def add_periodic_halo(self, zonal, meridional, halosize=5, data=None):
1553
1560
(data [:, :, - halosize :, :], data , data [:, :, 0 :halosize , :]), axis = len (data .shape ) - 2
1554
1561
)
1555
1562
assert data .shape [2 ] == self .grid .ydim , "Third dim must be y."
1556
- self .lat = self .grid .lat
1557
1563
if dataNone :
1558
1564
self .data = data
1559
1565
else :
0 commit comments