Beispiel #1
0
pn = np.flipud(np.transpose(file['pn'][:]))

dndx = np.flipud(np.transpose(file['dndx'][:]))

dmde = np.flipud(np.transpose(file['dmde'][:]))

mask_rho = np.flipud(np.transpose(file['mask_rho'][:]))

xl = file['xl'][:]

el = file['el'][:]

Lonu, Lonv, Lonp = rho2uvp(lon_rho)
Latu, Latv, Latp = rho2uvp(lat_rho)
[masku, maskv, maskp] = uvp_mask(mask_rho)

angle = get_angle(Latu, Lonu)
#pm, pn, dndx, dmde = get_metrics(Latu, Lonu, Latv, Lonv)

#f0 = 4 * np.pi * np.sin( np.pi * lat_rho/180. ) / ( 24.*3600. )

#p_file=netCDF4.Dataset('azul_grd2.nc')
#h_parent=p_file['h'][:]
#lon_parent=p_file['lon_rho'][:]
#lat_parent=p_file['lat_rho'][:]
#h=griddata((lon_parent.ravel(),lat_parent.ravel()),h_parent.ravel(),(lon_rho.ravel(),lat_rho.ravel())).reshape(lon_rho.shape)
#nans=np.isnan(h)
#h[nans]=griddata((lon_rho[~nans],lat_rho[~nans]),h[~nans],(lon_rho[nans],lat_rho[nans]), 'nearest')

ETOPO1 = True
Beispiel #2
0
plt.show()
plt.plot(-g[0, :])
plt.show()
plt.plot(-gg[0, ])
plt.show()

#
#######################################

h[np.where(h == 0)] = 0.1  #get rid of 0 depth

maskr = h * 0
maskr = np.abs(maskr)
maskr[np.where(h > 20.1)] = 1
maskr = process_mask(maskr)
[masku, maskv, maskp] = uvp_mask(maskr)

#for i in range(masku.shape[0]):
#   masku[i,np.where(Lonu[0,:]>-39)] = 1    #excluir a mascara das ilhas
#for i in range(maskv.shape[0]):
#  maskv[i,np.where(Lonv[0,:]>-39)] = 1    #excluir a mascara das ilhas
#for i in range(maskp.shape[0]):
#  maskp[i,np.where(Lonp[0,:]>-39)] = 1    #excluir a mascara das ilhas

#cs=plt.contourf(lonr, latr, h, levels=[0,100], colors='red')
#proxy = [plt.Rectangle((0,0),1,1,fc = pc.get_facecolor()[0])
#    for pc in cs.collections]

plt.pcolor(Lonr, Latr, maskp)
plt.show()
Beispiel #3
0
f0 = 4 * np.pi * np.sin( np.pi * Latr/180 ) / ( 24*3600 )


print ' \n' + '==> ' + '  ADDING TOPOGRAPHY ...\n' + ' '

h = add_topo(Lonr, Latr, pm, pn, run.topo_filename)
hraw = h.copy()
h[ np.where(h > run.hmax) ] = run.hmax

print ' \n' + '==> ' + '  COMPUTING THE MASK ...\n' + ' '

maskr = h*0
maskr[ np.where(h > 0) ] = 1 
maskr = process_mask(maskr)
[masku, maskv, maskp] = uvp_mask(maskr) 

print ' \n' + '==> ' + '  FILTERING THE TOPOGRAPHY ...\n' + ' '

h = smoothgrid(h, maskr, run.hmin, run.hmaxc,
             run.slope, run.npass, run.nfinal)


####################################################################
####################################################################

print ' \n' + '==> ' + '  WRITING NETCDF GRID FILE ...\n' + ' '

now = dt.datetime.now()
Lp = L + 1
Mp = M + 1