Exemplo n.º 1
0
def slice(lon, lat, lonlim, latlim):
	"""
	Slices some 3D field within some lon, lat limits
	"""
	aux  = lon[0,:] 
	i1   = np.array( near( aux, lonlim[0] ) ).min() 
	i2   = np.array( near( aux, lonlim[1] ) ).min()
	aux  = lat[:,0] 
	j1   = np.array( near( aux, latlim[0] ) ).min()
	j2   = np.array( near( aux, latlim[1] ) ).min()

	return i1, i2, j1, j2
Exemplo n.º 2
0
def slice(lon, lat, lonlim, latlim):
	"""
	Slices some 3D field within some lon, lat limits
	"""
	aux  = lon[0,:] 
	i1   = int( near( aux, lonlim[0] )[0] ) 
	i2   = int( near( aux, lonlim[1] )[0] )
	aux  = lat[:,0] 
	j1   = int( near( aux, latlim[0] )[0] )
	j2   = int( near( aux, latlim[1] )[0] )

	return i1, i2, j1, j2
Exemplo n.º 3
0
def slice(lon, lat, lonlim, latlim):
    """
	Slices some 3D field within some lon, lat limits
	"""
    aux = lon[0, :]
    i1 = np.array(near(aux, lonlim[0])).min()
    i2 = np.array(near(aux, lonlim[1])).min()
    aux = lat[:, 0]
    j1 = np.array(near(aux, latlim[0])).min()
    j2 = np.array(near(aux, latlim[1])).min()

    return i1, i2, j1, j2
Exemplo n.º 4
0
def slice(lon, lat, lonlim, latlim):
    """
	Slices some 3D field within some lon, lat limits
	"""
    aux = lon[0, :]
    i1 = int(near(aux, lonlim[0])[0])
    i2 = int(near(aux, lonlim[1])[0])
    aux = lat[:, 0]
    j1 = int(near(aux, latlim[0])[0])
    j2 = int(near(aux, latlim[1])[0])

    return i1, i2, j1, j2
Exemplo n.º 5
0
              + str(l+1) +".png')"

        exec(string)
    else:
        plt.show()

else:

    zi = dz * np.ceil(zt.min() / dz)
    zi = np.arange(zi, 0 + dz, dz)

    print ' \n' + '==> ' + '  INTERPOLATING FROM S --> Z ...\n' + ' '

    if PLOT == 2:
        xsec = latv[:, 0]
        fsec = near(xsec, ni)
        xsec = lonv[0, :]
        z = np.squeeze(zv[:, fsec, :])
        prop = np.squeeze(V[:, fsec, :])

    elif PLOT == 3:
        xsec = lonu[0, :]
        fsec = near(xsec, nj)
        xsec = latu[:, 0]
        z = np.squeeze(zu[:, :, fsec])
        prop = np.squeeze(U[:, :, fsec])

    elif PLOT == 5:
        xsec = latv[:, 0]
        fsec = near(xsec, ni)
        xsec = lonv[0, :]
Exemplo n.º 6
0
print ' \n' + '==> ' + '  READING CHOSEN ROMS OUTPUT NETCDF FILE ...\n' + ' '
outfile  = netCDF4.Dataset(roms.rundir + roms.run_name + '_' + filetype + '.nc')

TSbc = []; TSnbuc = []; TN = []; TE = [];

for l in days:
    U    = outfile.variables['u'][l,...]
    V    = outfile.variables['v'][l,...]
    print " DAY = " + str(l+1)
    #km, im, jm = T.shape
    zu   = get_depths(outfile,grdfile,l,'u')
    zv   = get_depths(outfile,grdfile,l,'v')

    f    = latv[:,0]    
    fsec = near(f,niN)
    xN   = lonv[0,:]
    zN   = np.squeeze( zv[:, fsec, :] )
    vN   = np.squeeze( V[: ,fsec , :] ) 
    
    fsec = near(f,niS)
    xS   = lonv[0,:]
    zS   = np.squeeze( zv[:, fsec, :] )
    vS   = np.squeeze( V[: ,fsec , :] ) 
 
    f = lonu[0, :]
    fsec = near(f,njE)
    yE   = latu[:, 0]
    zE   = np.squeeze( zu[:, :, fsec] )
    uE   = np.squeeze( U[: ,: , fsec] ) 
Exemplo n.º 7
0
		exec(string)
	else:
		plt.show()

else: 

	zi = dz * np.ceil( zt.min() / dz )
	zi = np.arange(zi, 0+dz, dz)

	print ' \n' + '==> ' + '  INTERPOLATING FROM S --> Z ...\n' + ' '


	if PLOT == 2:
		xsec = latv[:,0]
		fsec = near(xsec,ni)
	   	xsec = lonv[0,:]
	   	z    = np.squeeze( zv[:, fsec, :] )
	   	prop = np.squeeze( V[: ,fsec , :] ) 
  		
	elif PLOT == 3:  
		xsec = lonu[0, :]
		fsec = near(xsec,nj)
	   	xsec = latu[:, 0]
	   	z    = np.squeeze( zu[:, :, fsec] )
	   	prop = np.squeeze( U[: ,: , fsec] ) 

        elif PLOT == 5:
		xsec = latv[:,0]
		fsec = near(xsec,ni)
	   	xsec = lonv[0,:]
Exemplo n.º 8
0
tx, ty = m(lonplot[0] + 0.5, latplot[1] - 1)
text = 'Day: ' + str(days[0]) + ' - ' + str(days[-1])
plt.text(tx, ty, text, color='k', fontsize=10, fontweight='bold')
tx, ty = m(lonplot[0] + 0.5, latplot[1] - 2)
text = 'Z: ' + str(nk) + ' m'
plt.text(tx, ty, text, color='k', fontsize=10, fontweight='bold')
plt.title('$log(EKe)$ [$cm^2 s^{-2}$]')

plt.show()
plt.savefig('figures/' + expt + '/eke_day' + str(days[0]) + '-' +
            str(days[-1]) + '_' + str(nk) + 'm.png')

# vertical ==============================================

f = latv[:, 0]
fsec = near(f, niN)
xN = lonv[0, :]
zN = np.squeeze(zv[:, fsec, :])
vN = np.squeeze(V[:, fsec, :])

fsec = near(f, niS)
xS = lonv[0, :]
zS = np.squeeze(zv[:, fsec, :])
vS = np.squeeze(V[:, fsec, :])

fsec = near(f, niC)
xC = lonv[0, :]
zC = np.squeeze(zv[:, fsec, :])
vC = np.squeeze(V[:, fsec, :])

xS.shape = (1, xS.size)
Exemplo n.º 9
0
tx, ty = m( lonplot[0] + 0.5, latplot[1] - 1 )
text = 'Day: ' + str(days[0]) +' - '+ str(days[-1])
plt.text(tx,ty,text,color='k',fontsize=10,fontweight='bold')
tx, ty = m( lonplot[0] + 0.5, latplot[1] - 2 )
text = 'Z: '+ str(nk) +' m' 
plt.text(tx,ty,text,color='k',fontsize=10,fontweight='bold')
plt.title('$log(EKe)$ [$cm^2 s^{-2}$]')

plt.show()
plt.savefig('figures/'+ expt +'/eke_day'+ 
   str(days[0]) +'-'+ str(days[-1]) +'_'+ str(nk) +'m.png')

# vertical ==============================================

f    = latv[:,0]    
fsec = near(f,niN)
xN   = lonv[0,:]
zN   = np.squeeze( zv[:, fsec, :] )
vN   = np.squeeze( V[: ,fsec , :] ) 

fsec = near(f,niS)
xS   = lonv[0,:]
zS   = np.squeeze( zv[:, fsec, :] )
vS   = np.squeeze( V[: ,fsec , :] ) 

fsec = near(f,niC)
xC   = lonv[0,:]
zC   = np.squeeze( zv[:, fsec, :] )
vC   = np.squeeze( V[: ,fsec , :] ) 

xS.shape = (1, xS.size)
Exemplo n.º 10
0
TSbc = []
TSnbuc = []
TN = []
TE = []

for l in days:
    U = outfile.variables['u'][l, ...]
    V = outfile.variables['v'][l, ...]
    print " DAY = " + str(l + 1)
    #km, im, jm = T.shape
    zu = get_depths(outfile, grdfile, l, 'u')
    zv = get_depths(outfile, grdfile, l, 'v')

    f = latv[:, 0]
    fsec = near(f, niN)
    xN = lonv[0, :]
    zN = np.squeeze(zv[:, fsec, :])
    vN = np.squeeze(V[:, fsec, :])

    fsec = near(f, niS)
    xS = lonv[0, :]
    zS = np.squeeze(zv[:, fsec, :])
    vS = np.squeeze(V[:, fsec, :])

    f = lonu[0, :]
    fsec = near(f, njE)
    yE = latu[:, 0]
    zE = np.squeeze(zu[:, :, fsec])
    uE = np.squeeze(U[:, :, fsec])
Exemplo n.º 11
0
T = T / len(days); S = S / len(days); 
U = U / len(days); V = V / len(days); 

km, im, jm = T.shape

print ' \n' + '==> ' + '  GETTING DEPTHS OF S-LEVELS ...\n' + ' '
zt   = get_depths(outfile,grdfile,days[0],'temp')
zu   = get_depths(outfile,grdfile,days[0],'u')
zv   = get_depths(outfile,grdfile,days[0],'v')


# vertical ==============================================

f    = latv[:,0]    
fsec = near(f,niN)
xN   = lonv[0,:]
zN   = np.squeeze( zv[:, fsec, :] )
vN   = np.squeeze( V[: ,fsec , :] ) 
tN   = np.squeeze( T[: ,fsec , :] )
sN   = np.squeeze( S[: ,fsec , :] )
ztN  = np.squeeze( zt[: ,fsec , :] )

fsec = near(f,niS)
xS   = lonv[0,:]
zS   = np.squeeze( zv[:, fsec, :] )
vS   = np.squeeze( V[: ,fsec , :] ) 
tS   = np.squeeze( T[: ,fsec , :] )
sS   = np.squeeze( S[: ,fsec , :] )
ztS  = np.squeeze( zt[: ,fsec , :] )
Exemplo n.º 12
0
d1 = 42
z1 = z[z0max:]
u01 = (u0max - u0surf) * np.exp(
    (-1) * (z1 - (z0max))**2 / (2 * d1**2)) + u0surf
u0[z0max:] = -u01

d2 = 225
z2 = z[:z0max]
u02 = (u0max - u0bot) * np.exp((-1) * (z2 - (z0max))**2 / (2 * d2**2)) + u0bot
u0[:z0max] = -u02

# depth-dependent position of the jet axis: y0 = y0(z)
y0 = np.zeros(np.size(z))

# SEC axis position remais the same from surface to core-depth
f2 = np.array(near(lat, -14.5)).min()
y0[z0max:] = y[f2]

# SEC axis position migrates gently to the south, from 14.5 S to 16 S
y2 = y0[:z0max]
f1 = np.array(near(lat, -16)).min()
f2 = np.array(near(lat, -14.5)).min()
y2 = np.linspace(y[f1], y[f2], np.size(y2))  # linear decay with depth
y0[:z0max] = y2

# jet width: let's try constant
d = 170

# CREATING THE JET

u = np.zeros([np.size(z), np.size(y)])