@@ -73,7 +73,7 @@ def save(self, *args, **kwargs):
7373# %%
7474# Movie properties
7575kwargs = 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 )
7777frame_t = kw_p ["nb_step" ] * kw_p ["time_step" ] / 86400.0
7878
7979
@@ -102,21 +102,21 @@ def update(i_frame, t_step):
102102# ^^^^^^^^^^^^^^^^
103103# Draw 3 last position in one path for each particles.,
104104# 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 )
106106fig , txt , l , t = anim_ax (lw = 0.5 )
107107_ = VideoAnimation (fig , update , ** kwargs , fargs = (frame_t ,))
108108
109109# %%
110110# Particle forward
111111# ^^^^^^^^^^^^^^^^^
112112# Forward advection of particles
113- p = g .advect (x , y , "u" , "v" , ** kw_p )
113+ p = g .advect (x , y , ** kw_p )
114114fig , txt , l , t = anim_ax (ls = "" , marker = "." , markersize = 1 )
115115_ = VideoAnimation (fig , update , ** kwargs , fargs = (frame_t ,))
116116
117117# %%
118118# 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 )
120120fig , txt , l , _ = anim_ax (ls = "" , marker = "." , markersize = 1 )
121121_ = VideoAnimation (fig , update , ** kwargs , fargs = (- frame_t ,))
122122
@@ -139,9 +139,9 @@ def update(i_frame, t_step):
139139)
140140for time_step in (10800 , 21600 , 43200 , 86400 ):
141141 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__ ()
145145 d = ((x - x0 ) ** 2 + (y - y0 ) ** 2 ) ** 0.5
146146 ax .hist (d , ** kw , label = f"{ 86400. / time_step :.0f} time step by day" )
147147ax .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):
158158time_step = 10800
159159for duration in (5 , 50 , 100 ):
160160 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__ ()
164164 d = ((x - x0 ) ** 2 + (y - y0 ) ** 2 ) ** 0.5
165165 ax .hist (d , ** kw , label = f"Time duration { duration } days" )
166166ax .set_xlim (0 , 0.25 ), ax .set_ylim (0 , 100 ), ax .legend (loc = "lower right" ), ax .grid ()
0 commit comments