|
5 | 5 | importnumpyasnp
|
6 | 6 | importmatplotlib
|
7 | 7 | importmatplotlib.patchesaspatches
|
8 |
| -importmatplotlib.cbookascbook |
9 | 8 |
|
10 | 9 |
|
11 | 10 | __all__= ['streamplot']
|
@@ -332,9 +331,11 @@ def backward_time(xi, yi):
|
332 | 331 | return-dxi,-dyi
|
333 | 332 |
|
334 | 333 | defintegrate(x0,y0):
|
335 |
| -"""Return x, y coordinates of trajectory based on starting point. |
| 334 | +"""Return x, y grid-coordinates of trajectory based on starting point. |
| 335 | +
|
| 336 | + Integrate both forward and backward in time from starting point in |
| 337 | + grid coordinates. |
336 | 338 |
|
337 |
| - Integrate both forward and backward in time from starting point. |
338 | 339 | Integration is terminated when a trajectory reaches a domain boundary
|
339 | 340 | or when it crosses into an already occupied cell in the StreamMask. The
|
340 | 341 | resulting trajectory is None if it is shorter than `minlength`.
|
@@ -446,10 +447,10 @@ def _integrate_rk12(x0, y0, dmap, f):
|
446 | 447 |
|
447 | 448 | def_euler_step(xf_traj,yf_traj,dmap,f):
|
448 | 449 | """Simple Euler integration step."""
|
449 |
| -nx,ny=dmap.grid.shape |
| 450 | +ny,nx=dmap.grid.shape |
450 | 451 | xi=xf_traj[-1]
|
451 | 452 | yi=yf_traj[-1]
|
452 |
| -cx,cy=f(xi,yi)# ds.cx is in data coordinates, ds in axis coord. |
| 453 | +cx,cy=f(xi,yi) |
453 | 454 | ifcx>0:
|
454 | 455 | dsx= (nx-1-xi)/cx
|
455 | 456 | else:
|
|