def make_data_from_ts(t, s, product_n = 3, dt = 0.2):
	_,title_name,_=subroutine.product_n_to_name(product_n)
	xgrid,ygrid,zgrid=subroutine.product_grid_info('t','data',product_n)

	# MOAA_GPVだけ、格納されているのが(ポテンシャル水温でなく)通常の水温なので、まずポテンシャル水温への変換が必要
	if title_name=='MOAA_GPV':
		theta=np.zeros((t.shape[0],t.shape[1],t.shape[2]))
		for m in range(0,zgrid.size):
			theta[:,:,m]=density.poT(t[:,:,m],s[:,:,m],zgrid[m])

		t=theta
		t[np.where(abs(t)== inf)]=nan

	rho=density.rho(t,s,0)
	rho[np.where(abs(rho)== inf)]=nan
	xn=xgrid.size
	yn=ygrid.size
	ILD=np.zeros([yn,xn])
	MLD=np.zeros([yn,xn])
	BLT=np.zeros([yn,xn])
	for i in range(0,xn):
		for j in range(0,yn):
			if np.isnan(t[j,i,0]) == False:
				tpro=t[j,i,:]
				rhopro=rho[j,i,:]
				spro = s[j, i, :]
				ILD[j, i], MLD[j, i], BLT[j, i] = make_data_from_profile(tpro, spro, rhopro, zgrid, dt)
			else:
				ILD[j,i]=nan
				MLD[j,i]=nan
				BLT[j, i] = nan


	return ILD,MLD,BLT
def make_rho_from_ts(t,s, product_n = 3):
	xgrid,ygrid,zgrid=subroutine.product_grid_info('t','data',product_n)
	_, title_name, _ = subroutine.product_n_to_name(product_n)
	# MOAA_GPVだけ、格納されているのが(ポテンシャル水温でなく)通常の水温なので、まずポテンシャル水温への変換が必要
	if title_name=='MOAA_GPV':
		theta=zeros((t.shape[0],t.shape[1],t.shape[2]))
		for m in range(0,zgrid.size):
			theta[:,:,m]=density.poT(t[:,:,m],s[:,:,m],zgrid[m])

		t=theta
		t[where(abs(t)== inf)]=nan

	rho = density.rho(t, s, 0)
	rho[np.where(np.abs(rho) == sp.inf)] = np.nan
	return rho