@@ -1526,66 +1526,25 @@ def eval(self, time, z, y, x, particle=None, applyConversion=True):
15261526 if applyConversion :
15271527 u = self .U .units .to_target (u , z , y , x )
15281528 v = self .V .units .to_target (v , z , y , x )
1529- if "3D" in self .vector_type :
1530- w = self .W .eval (time , z , y , x , particle = particle , applyConversion = False )
1531- if applyConversion :
1532- w = self .W .units .to_target (w , z , y , x )
1533- return (u , v , w )
1534- else :
1535- return (u , v )
15361529 else :
15371530 interp = {
1538- "cgrid_velocity" : {
1539- "2D" : self .spatial_c_grid_interpolation2D ,
1540- "3D" : self .spatial_c_grid_interpolation3D ,
1541- },
1542- "partialslip" : {"2D" : self .spatial_slip_interpolation , "3D" : self .spatial_slip_interpolation },
1543- "freeslip" : {"2D" : self .spatial_slip_interpolation , "3D" : self .spatial_slip_interpolation },
1531+ "cgrid_velocity" : self .spatial_c_grid_interpolation2D ,
1532+ "partialslip" : self .spatial_slip_interpolation ,
1533+ "freeslip" : self .spatial_slip_interpolation ,
15441534 }
1545- grid = self .U .grid
15461535 tau , ti = self .U ._time_index (time )
1547- if ti < grid .tdim - 1 and time > grid .time [ti ]:
1548- t0 = grid .time [ti ]
1549- t1 = grid .time [ti + 1 ]
1550- if "3D" in self .vector_type :
1551- (u0 , v0 , w0 ) = interp [self .U .interp_method ]["3D" ](
1552- ti ,
1553- z ,
1554- y ,
1555- x ,
1556- t0 ,
1557- particle = particle ,
1558- applyConversion = applyConversion , # TODO see if we can directly call time interpolation for W here
1559- )
1560- (u1 , v1 , w1 ) = interp [self .U .interp_method ]["3D" ](
1561- ti + 1 , z , y , x , t1 , particle = particle , applyConversion = applyConversion
1562- )
1563- w = w0 * (1 - tau ) + w1 * tau
1564- else :
1565- (u0 , v0 ) = interp [self .U .interp_method ]["2D" ](
1566- ti , z , y , x , t0 , particle = particle , applyConversion = applyConversion
1567- )
1568- (u1 , v1 ) = interp [self .U .interp_method ]["2D" ](
1569- ti + 1 , z , y , x , t1 , particle = particle , applyConversion = applyConversion
1570- )
1571- u = u0 * (1 - tau ) + u1 * tau
1572- v = v0 * (1 - tau ) + v1 * tau
1573- if "3D" in self .vector_type :
1574- return (u , v , w )
1575- else :
1576- return (u , v )
1577- else :
1578- # Skip temporal interpolation if time is outside
1579- # of the defined time range or if we have hit an
1580- # exact value in the time array.
1581- if "3D" in self .vector_type :
1582- return interp [self .U .interp_method ]["3D" ](
1583- ti , z , y , x , grid .time [ti ], particle = particle , applyConversion = applyConversion
1584- )
1585- else :
1586- return interp [self .U .interp_method ]["2D" ](
1587- ti , z , y , x , grid .time [ti ], particle = particle , applyConversion = applyConversion
1588- )
1536+ (u , v ) = interp [self .U .interp_method ](ti , z , y , x , time , particle = particle , applyConversion = applyConversion )
1537+ if ti < self .U .grid .tdim - 1 and time > self .U .grid .time [ti ]:
1538+ (u1 , v1 ) = interp [self .U .interp_method ](
1539+ ti + 1 , z , y , x , time , particle = particle , applyConversion = applyConversion
1540+ )
1541+ u = u * (1 - tau ) + u1 * tau
1542+ v = v * (1 - tau ) + v1 * tau
1543+ if "3D" in self .vector_type :
1544+ w = self .W .eval (time , z , y , x , particle = particle , applyConversion = applyConversion )
1545+ return (u , v , w )
1546+ else :
1547+ return (u , v )
15891548
15901549 def __getitem__ (self , key ):
15911550 try :
0 commit comments