示例#1
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()
示例#2
0
def specified_LD(year,month,dt,Area_id): # 領域で絞り込んだプロファイルのみ層厚計算
	import subroutine
	import AQC
	import numpy as np
	import LD
	temp,salt,pres,lon,lat=AQC.get_data(year,month)
	N_PROF=lon.size
	n=AQC.specified_NPROF(year,month,Area_id)
	MLD=np.zeros(n.size)
	ILD=np.zeros(n.size)
	BLT=np.zeros(n.size)
	for i in range(0,n.size):
		MLD[i],ILD[i],BLT[i]=LD.easy_cal(pres[n[i],:],temp[n[i],:],salt[n[i],:],dt)
		MLD[i]=LD.to_5m(MLD[i])
		ILD[i]=LD.to_5m(ILD[i])
	return MLD,ILD,BLT
示例#3
0
def specified_NPROF(year,month,Area_id): # プロファイルナンバーを領域で絞り込む
	import subroutine
	import AQC
	import numpy as np
	import Area
	AA = Area.Area[Area_id]
	temp,salt,pres,lon,lat=AQC.get_data(year,month)
	N_PROF=lon.size
	area_name = AA.AreaName
	slat = AA.slat
	nlat = AA.nlat
	wlon = AA.wlon
	elon = AA.elon
	n=np.zeros(N_PROF)
	for i in range(0,N_PROF):
		if lat[i]>=slat and lat[i]<=nlat and lon[i]>=wlon and lon[i]<=elon:
			print 'N_PROF=',i
			n[i]=1

	n=np.where(n!=0)[0]
	return n
def overdraw_argopoint(plt,year,month,var,dt,cb_min,cb_max,my_color,Area_id):
	# MLD:var=0,ILD:var=1,BLT:var=2
	import subroutine
	import numpy as np
	import matplotlib.pyplot as plt
	import AQC
	import Area
	AA = Area.Area[Area_id]
	temp,salt,pres,lon,lat=AQC.get_data(year,month)
	N_PROF=pres.shape[0]
	slat = AA.slat
	nlat = AA.nlat
	wlon = AA.wlon
	elon = AA.elon
	MLD=np.zeros(N_PROF)
	ILD=np.zeros(N_PROF)
	BLT=np.zeros(N_PROF)
	for i in range(0,N_PROF):
		if lat[i]>=slat and lat[i]<=nlat and lon[i]>=wlon and lon[i]<=elon:
			MLD[i],ILD[i],BLT[i]=easy_cal(pres[i,:],temp[i,:],salt[i,:],dt)
			MLD[i]=to_5m(MLD[i])
			ILD[i]=to_5m(ILD[i])
		else:
			MLD[i],ILD[i],BLT[i]=1000.0,1000.0,1000.0

	if var==0:
		theta=MLD
	elif var==1:
		theta=ILD
	elif var==2:
		theta=BLT
	else:
		raise Exception('error! your var is not valid!')

	interval_of_cf=np.arange(cb_min,cb_max+5.0,5.0)
	cmap=subroutine.get_cmap(my_color)
	plt.scatter(lon,lat,c=theta,s=75,vmin=min(interval_of_cf),vmax=max(interval_of_cf),cmap=cmap)
	return plt