"tau_y": [-0.05, 0.05], "Hs": [0, 4], "Tp": [10, 20], "mwd": [-180, 180], } if PROG_OPT == 1: # plot each variable, save different fig for each time step for pf in prog_files: if ".a" == pf[-2:]: stepno = pf.strip("wim_prog").strip(".a") # steps.append(stepno) # afile = pdir + "/" + pf print(afile) fields, info = Fdat.fn_read_general_binary(afile) figdir3B = figdir3 + "/" + stepno # field_profiles = {} for key in fields.keys(): F = fields[key][:, 0] field_profiles.update({key: F}) # grid_profiles = {} for key in grid_prams.keys(): try: F = grid_prams[key][:, 0] except: F = grid_prams[key] grid_profiles.update({key: F})
# checks if len(prog_files)>0: # make dir for progress plots if (not os.path.exists(figdir)): os.mkdir(figdir) else: raise ValueError('No progress files to plot') fig = plt.figure() ax = fig.add_subplot(1,1,1) xx = gf['X'][:,0]/1.e3 labs = ['$x$, km','$H_s$, m'] for pf in prog_files: if '.a'==pf[-2:]: print("Reading "+pf+" ...") out_fields,info = Fdat.fn_read_general_binary(pdir+pf) Hs_n = out_fields['Hs'][:,0] loop_c = np.mod(loop_c+1,Nc) if loop_c==0: loop_s = np.mod(loop_s+1,Ns) fig,ax,line = Fplt.plot_1d(xx, Hs_n, labs=labs, pobj=[fig,ax], color=cols[loop_c], linestyle=lstil[loop_s]) # figname = figdir+'/convergence2steady.png' print('saving to '+figname+'...') fig.savefig(figname,bbox_inches='tight',pad_inches=0.05) plt.close(fig)