@@ -82,34 +82,6 @@ def time_interval(self):
8282 return None
8383 return functools .reduce (lambda x , y : x .intersection (y ), time_intervals )
8484
85- def dimrange (self , dim ):
86- """Returns maximum value of a dimension (lon, lat, depth or time)
87- on 'left' side and minimum value on 'right' side for all grids
88- in a gridset. Useful for finding e.g. longitude range that
89- overlaps on all grids in a gridset.
90- """
91- maxleft , minright = (- np .inf , np .inf )
92- dim2ds = {
93- "depth" : ["nz1" , "nz" ],
94- "lat" : ["node_lat" , "face_lat" , "edge_lat" ],
95- "lon" : ["node_lon" , "face_lon" , "edge_lon" ],
96- "time" : ["time" ],
97- }
98- for ds in self .datasets :
99- for field in ds .data_vars :
100- for d in dim2ds [dim ]: # check all possible dimensions
101- if d in ds [field ].dims :
102- if dim == "depth" :
103- maxleft = max (maxleft , ds [field ][d ].min ().data )
104- minright = min (minright , ds [field ][d ].max ().data )
105- else :
106- maxleft = max (maxleft , ds [field ][d ].data [0 ])
107- minright = min (minright , ds [field ][d ].data [- 1 ])
108- maxleft = 0 if maxleft == - np .inf else maxleft # if all len(dim) == 1
109- minright = 0 if minright == np .inf else minright # if all len(dim) == 1
110-
111- return maxleft , minright
112-
11385 def add_field (self , field : Field , name : str | None = None ):
11486 """Add a :class:`parcels.field.Field` object to the FieldSet.
11587
0 commit comments