@@ -73,7 +73,7 @@ def save(self, *args, **kwargs):
73
73
# %%
74
74
# Movie properties
75
75
kwargs = dict (frames = arange (51 ), interval = 100 )
76
- kw_p = dict (nb_step = 2 , time_step = 21600 )
76
+ kw_p = dict (u_name = "u" , v_name = "v" , nb_step = 2 , time_step = 21600 )
77
77
frame_t = kw_p ["nb_step" ] * kw_p ["time_step" ] / 86400.0
78
78
79
79
@@ -102,21 +102,21 @@ def update(i_frame, t_step):
102
102
# ^^^^^^^^^^^^^^^^
103
103
# Draw 3 last position in one path for each particles.,
104
104
# it could be run backward with `backward=True` option in filament method
105
- p = g .filament (x , y , "u" , "v" , ** kw_p , filament_size = 3 )
105
+ p = g .filament (x , y , ** kw_p , filament_size = 3 )
106
106
fig , txt , l , t = anim_ax (lw = 0.5 )
107
107
_ = VideoAnimation (fig , update , ** kwargs , fargs = (frame_t ,))
108
108
109
109
# %%
110
110
# Particle forward
111
111
# ^^^^^^^^^^^^^^^^^
112
112
# Forward advection of particles
113
- p = g .advect (x , y , "u" , "v" , ** kw_p )
113
+ p = g .advect (x , y , ** kw_p )
114
114
fig , txt , l , t = anim_ax (ls = "" , marker = "." , markersize = 1 )
115
115
_ = VideoAnimation (fig , update , ** kwargs , fargs = (frame_t ,))
116
116
117
117
# %%
118
118
# We get last position and run backward until original position
119
- p = g .advect (x , y , "u" , "v" , ** kw_p , backward = True )
119
+ p = g .advect (x , y , ** kw_p , backward = True )
120
120
fig , txt , l , _ = anim_ax (ls = "" , marker = "." , markersize = 1 )
121
121
_ = VideoAnimation (fig , update , ** kwargs , fargs = (- frame_t ,))
122
122
@@ -139,9 +139,9 @@ def update(i_frame, t_step):
139
139
)
140
140
for time_step in (10800 , 21600 , 43200 , 86400 ):
141
141
x , y = x0 .copy (), y0 .copy ()
142
- kw_advect = dict (nb_step = int (50 * 86400 / time_step ), time_step = time_step )
143
- g .advect (x , y , "u" , "v" , ** kw_advect ).__next__ ()
144
- g .advect (x , y , "u" , "v" , ** kw_advect , backward = True ).__next__ ()
142
+ kw_advect = dict (nb_step = int (50 * 86400 / time_step ), time_step = time_step , u_name = "u" , v_name = "v" )
143
+ g .advect (x , y , ** kw_advect ).__next__ ()
144
+ g .advect (x , y , ** kw_advect , backward = True ).__next__ ()
145
145
d = ((x - x0 ) ** 2 + (y - y0 ) ** 2 ) ** 0.5
146
146
ax .hist (d , ** kw , label = f"{ 86400. / time_step :.0f} time step by day" )
147
147
ax .set_xlim (0 , 0.25 ), ax .set_ylim (0 , 100 ), ax .legend (loc = "lower right" ), ax .grid ()
@@ -158,9 +158,9 @@ def update(i_frame, t_step):
158
158
time_step = 10800
159
159
for duration in (5 , 50 , 100 ):
160
160
x , y = x0 .copy (), y0 .copy ()
161
- kw_advect = dict (nb_step = int (duration * 86400 / time_step ), time_step = time_step )
162
- g .advect (x , y , "u" , "v" , ** kw_advect ).__next__ ()
163
- g .advect (x , y , "u" , "v" , ** kw_advect , backward = True ).__next__ ()
161
+ kw_advect = dict (nb_step = int (duration * 86400 / time_step ), time_step = time_step , u_name = "u" , v_name = "v" )
162
+ g .advect (x , y , ** kw_advect ).__next__ ()
163
+ g .advect (x , y , ** kw_advect , backward = True ).__next__ ()
164
164
d = ((x - x0 ) ** 2 + (y - y0 ) ** 2 ) ** 0.5
165
165
ax .hist (d , ** kw , label = f"Time duration { duration } days" )
166
166
ax .set_xlim (0 , 0.25 ), ax .set_ylim (0 , 100 ), ax .legend (loc = "lower right" ), ax .grid ()
0 commit comments