예제 #1
0
def draw_3data(data1,data2,data3,min,max,my_color=1,label=''):
	import matplotlib.pyplot as plt
	X,Y=np.meshgrid(np.arange(data1.shape[1]),np.arange(data1.shape[0]))
	interval_of_cf=subroutine.cl_res(min,max)
	fig=plt.figure()


	fig=plt.figure(figsize=(8,15))
	plt = Cmap[my_color].Set_Cmap(plt)

	ax1=fig.add_subplot(3,1,1)
	ax1.contourf(X, Y,data1,interval_of_cf, extend = 'both')
	ax2=fig.add_subplot(3,1,2)
	ax2.contourf(X, Y,data2,interval_of_cf, extend = 'both')
	ax3=fig.add_subplot(3,1,3)
	CF=ax3.contourf(X, Y,data3,interval_of_cf, extend = 'both')
	_,_,cb_interval,_=subroutine.color(data3,my_color,interval_of_cf,ax3)


	cax = fig.add_axes([0.95, 0.15, 0.04, 0.7])          #[左端、下端、幅、高さ]
	cb=plt.colorbar(CF,cax,ticks=cb_interval)
	cb.ax.tick_params(labelsize=15)
	cb.set_label(label,fontsize=20)


	return plt
예제 #2
0
def minus_MG_and_argopoint(year,month,var,cb_min,cb_max,area_num,depth):
	# area_num=0でインド洋全域
	import subroutine
	import MOAA_GPV
	import WOA01
	import AQC
	import numpy as np
	import matplotlib.pyplot as plt
	stryear,strmonth=subroutine.strym(year,month)
	strym=stryear+strmonth
	save_dir=subroutine.save_dir()
	my_color=0								 # 青白赤
	dataWOA=WOA01.nc_read(month,var,depth+1) # WOAはz=0があるので、1足してMGと一致
	dataWOA=subroutine.data_trimming_IO(dataWOA,4)
	dataMG=MOAA_GPV.nc_read(year,month,var,depth)
	dataMG=subroutine.data_trimming_IO(dataMG,1)
	data=dataMG-dataWOA
	xgrid,ygrid=subroutine.IO_gridvalue()
	m=subroutine.IO_map(area_num,1,1)
	x, y = np.meshgrid(xgrid, ygrid)
	X, Y = m(x, y)
	title=''
	plt.title(title,fontsize=25)
	temp,salt,pres,lon,lat=AQC.get_data(year,month)
	interval_of_cf=subroutine.cl_res(cb_min,cb_max)
	data,cmap,cb_interval,plt=subroutine.color(data,my_color,interval_of_cf,plt)
	CF=m.contourf(X, Y, data,interval_of_cf, cmap=cmap, latlon=True,extend='both')
	cb=m.colorbar(CF, ticks=cb_interval)
	SC=plt.scatter(lon,lat,s=45,c='maroon')
	fnameF = save_dir+strym+var+'_MG-WOA.jpg'
	plt.savefig(fnameF)
	plt.clf()
예제 #3
0
def ColorContour(plt, X, Y, data, parameter, label_flg = 0):
	cb_min		= parameter[0]
	cb_max		= parameter[1]
	div			= parameter[2]
	clabel		= parameter[3]

	interval_of_cf=subroutine.cl_res(cb_min,cb_max, div = div)
	CF=plt.contourf(X, Y,data,interval_of_cf, extend = 'both')
	if label_flg == 0:
		plt.colorbar(CF, label = clabel)

	return plt, CF
예제 #4
0
# x軸、y軸の値のデータを読み込む
dt=np.dtype([("xgrid","<51f")])
fd=open("/home/yu/Dropbox/workspace/data_assimilation/Optimal_interpolation/xgrid.out","r")
chunk=np.fromfile(fd,dtype=dt,count=1)
xgrid=chunk[0]['xgrid']

dt=np.dtype([("ygrid","<51f")])
fd=open("/home/yu/Dropbox/workspace/data_assimilation/Optimal_interpolation/ygrid.out","r")
chunk=np.fromfile(fd,dtype=dt,count=1)
ygrid=chunk[0]['ygrid']


print xgrid
print ygrid
X,Y=np.meshgrid(xgrid,ygrid)
plt.title('Optinal interpolated SST',fontsize=25)
plt.set_cmap("jet")
cb_min=2
cb_max=14
interval_of_cf=subroutine.cl_res(cb_min,cb_max)
cmap=cm.jet
cf=pl.contourf(X,Y,data,interval_of_cf,cmap=cmap)	# 色塗りコンター
interval=np.arange(0,100,2)
cr=pl.contour(X,Y,data,interval) # 普通のコンター
cr.clabel(fontsize=20,fmt='%d')	# コンターラベルをつける
SC=plt.scatter(xcor,ycor,c=temp,s=75,vmin=min(interval_of_cf),vmax=max(interval_of_cf),cmap=cmap)
cb=pl.colorbar(cf)				# カラーバーをつける(カラーコンター)
cb.set_label('Temperature')		# カラーバーにタイトルを加える
pl.show()