def animate(frame): print('*' * 60) print(frame) roms_file = roms_path + 'chaba_his.' + str(start_file + (frame // 5) * 5) + '.nc' print(roms_file) zeta = vt.get_var('zeta', roms_file, itime=frame % 5, ndims=3) map_var = zeta[ymin:ymax, xmin:xmax] quad1.set_array(map_var.ravel()) X = np.c_[px[frame, :] - xmin + npts, py[frame, :] - ymin + npts] #scat.set_offsets(X) scat = plt.scatter(px[frame, :] - xmin, py[frame, :] - ymin, c=pt[frame, :], cmap='jet', zorder=4) ax1.set_title('time ' + str(frame * delta_t / 3600 / 24) + ' (days)') #scat = vt.plot_seeding(px[frame, :]-xmin+npts, py[frame, :]-ymin+npts) vt.plot_traj(px - xmin + npts, py - ymin + npts, tend=frame, ax=ax1) return quad1
end_file = 1040 my_simul = 'polygr_apero' parameters = my_simul + ' [0,10000,0,10000,[1,100,1]] ' + format(start_file) simul = load(simul=parameters, floattype=np.float64) ncfile = '/home/jeremy/Bureau/Data/Pyticles/Visual_2_depths/' \ + 'Case_1_Visual_2_depths_1_1510.nc' roms_file = '/home/jeremy/Bureau/Data/Pyticles/chaba_his.1550.nc' grd_file = '/home/jeremy/Bureau/Data/Pyticles/chaba_grd.nc' ############################################################################## # COMPUTING TEST ZONE ############################################################################## # Case Adv3d # Given a variable at particle location and a 2D var over wall domain zeta = vt.get_var('zeta', roms_file, itime=0, ndims=3) temp = vt.get_var('temp', roms_file, itime=0, ndims=4) salt = vt.get_var('salt', roms_file, itime=0, ndims=4) topo_roms = vt.get_var('h', grd_file) #zeta.mask = mask px = vt.get_var('px', ncfile).data py = vt.get_var('py', ncfile).data pz = vt.get_var('pz', ncfile).data pu = vt.get_var('pu', ncfile).data pw = vt.get_var('pw', ncfile).data pt = vt.get_var('pt', ncfile).data psalt = vt.get_var('ps', ncfile).data pdepth = vt.get_var('pdepth', ncfile).data ntraj = 20 ####################
# + 'Case_1_New_Version_Linear_6_1510.nc' roms_file = '/home/jeremy/Bureau/Data/Pyticles/chaba_his.1550.nc' grd_file = '/home/jeremy/Bureau/Data/Pyticles/chaba_grd.nc' ############################################################################# itime = 3 # new linear ''' px_new = vt.get_var('px', nc_new_linear, itime=itime) py_new = vt.get_var('py', nc_new_linear, itime=itime) pt_new = vt.get_var('pt', nc_new_linear, itime=itime) pdepth_new = vt.get_var('pdepth', nc_new_linear, itime=itime) ''' # old linear and new cubic px_lin = vt.get_var('px', nc_linear) px_cub = vt.get_var('px', nc_cubic) py_lin = vt.get_var('py', nc_linear) py_cub = vt.get_var('py', nc_cubic) pt_lin = vt.get_var('pt', nc_linear) pt_cub = vt.get_var('pt', nc_cubic) ps_lin = vt.get_var('ps', nc_linear) ps_cub = vt.get_var('ps', nc_cubic) pdepth_lin = vt.get_var('pdepth', nc_linear) pdepth_cub = vt.get_var('pdepth', nc_cubic) ocean_time = vt.get_var('ocean_time', nc_cubic) # comparing cubic and old linear np.std(pdepth_lin - pdepth_cub) np.std(pt_lin - pt_cub)
my_simul = 'Case_1' parameters = my_simul + ' [0,10000,0,10000,[1,100,1]] ' + format(start_file) simul = load(simul=parameters, floattype=np.float64) save_fig = True save_dir = '/home/jeremy/Bureau/Data/Pyticles/RESU/Visual_tools/Anim/' gen_name = 'fig_zavdg_bis_' fmt = '.png' ncfile = '/home/jeremy/Bureau/Data/Pyticles/Visual_ZAVG_/' + 'Case_1_Visual_ZAVG__adv200.0m_1_1510.nc' roms_file = '/home/jeremy/Bureau/Data/Pyticles/chaba_his.1550.nc' grd_file = '/home/jeremy/Bureau/Data/Pyticles/chaba_grd.nc' ############################################################################## # COMPUTING TEST ZONE ############################################################################## zeta = vt.get_var('zeta', roms_file, itime=0, ndims=3) temp = vt.get_var('temp', roms_file, itime=0, ndims=4) salt = vt.get_var('salt', roms_file, itime=0, ndims=4) ocean_time = vt.get_var('time', roms_file) delta_t = ocean_time[1] - ocean_time[0] topo_roms = vt.get_var('h', grd_file) #zeta.mask = mask px = vt.get_var('px', ncfile).data py = vt.get_var('py', ncfile).data pu = vt.get_var('pu', ncfile).data pt = vt.get_var('pt', ncfile).data #################### # Function trial map_traj #####################