for M in range(2, 13, 2): dto = dtm.datetime(year, M, 1) xtlabs.append(dto.strftime('%Y%m%d')) xticks.append((dto - refdate).total_seconds() * tfac) regions = ['gre', 'bar', 'beau', 'lab'] # for legend #labs = ['Over','Under','Bias'] #cols = {'Over':'r','Under':'b','Bias':'g'} ODIR = 'out/' if not os.path.exists(ODIR): os.mkdir(ODIR) for reg in regions: PO = MR.plot_object() figname = ODIR + '/MIZwidth_' + var_name + '_' + reg + '.png' txtname = ODIR + '/MIZwidth_' + var_name + '_' + reg + '.txt' # write header to text file tid = open(txtname, 'w') blk = 3 * ' ' ss = 'Date' + blk + 'Mean_intersecting_width\n' tid.write(ss) Tmin = 1e30 Tmax = -1e30 for year in years: cyear = str(year) mdir2 = mdir + cyear wlist = os.listdir(mdir2)
dto = DT(year,M,1) if dto>=dto_lims[0] and dto<=dto_lims[1]: xtlabs.append(dto.strftime('%Y%m%d')) xticks.append((dto-refdate).total_seconds()*tfac) #now make the plots fignames = [] fignames.append(figdir+'/conc_anomaly_RMSE.png') fignames.append(figdir+'/conc_anomaly_bias.png') fignames.append(figdir+'/Model_Underest.png') fignames.append(figdir+'/Model_Overest.png') fignames.append(figdir+'/Model_Bias.png') for n,figname in enumerate(fignames): pobj = mr.plot_object() if n==0: fld = Cfields[0] tstr = 'time_series/conc_anomaly_' yscaling = 1. ylabel = 'RMSE conc. anomaly' ylim = [.1,.25] elif n==1: fld = Cfields[1] tstr = 'time_series/conc_anomaly_' yscaling = 1. ylabel = 'Bias in conc. anomaly' ylim = [-.1,.1] elif n==2: fld = Bfields[0] tstr = 'time_series/Model_Underest_'
dto = nci.datetimes[idx] cdt1 = dto.strftime('%Y%m%dT%H%M%SZ') cdt2 = dto.strftime('%d %b %Y %H:%M') if 0: mon = dto.strftime('%b') cdt2 = cdt2.replace(mon, mon.upper()) if dtl == 0: fig.text(.5,.77,cdt2,\ horizontalalignment='center',\ fontsize=18,\ color='k') ax1 = fig.add_subplot(gs[0, 0]) po1 = mr.plot_object(fig=fig, ax=ax1) po1,bmap = nci.plot_var('Hs' ,time_index=idx,pobj=po1,\ clabel='Significant wave height, m',\ clim=[0,Hs_max],\ smoothing=0,\ date_label=dtl,date_color='r',\ HYCOMreg=reg,show=False) po1.cbar.set_ticks(np.arange(0, Hs_max + dH, dH)) ax2 = fig.add_subplot(gs[0, 1]) po2 = mr.plot_object(fig=fig, ax=ax2) po2,bmap = nci.plot_var('Dmax',time_index=idx,pobj=po2,\ clabel='Maximum floe size, m',\ clim=[0,Dmax_max],\ smoothing=0,\ date_label=dtl,date_color='b',\