dymax = np.max(dy / 1000.) dymin = np.min(dy / 1000.) angle = get_angle(Latu, Lonu) f0 = 4 * np.pi * np.sin(np.pi * Latr / 180) / (24 * 3600) print(' \n' + '==> ' + ' ADDING TOPOGRAPHY ...\n' + ' ') #ff=np.isnan(X) ############## ETOPO2 = False if ETOPO2: print('bathymetry from ETOPO2') h = add_topo(Lonr, Latr, pm, pn, 'ETOPO2v2g_f4.nc') #etopo GEBCO = False if GEBCO: print('bathymetry from GEBCO') gebco = netCDF4.Dataset('gebco_222.nc') latgebco = gebco['lat'][:] longebco = gebco['lon'][:] elevation = -gebco['elevation'][:] from scipy.interpolate import interp2d hgeb = interp2d(longebco, latgebco, elevation, kind='cubic') h = hgeb(Lonr[0, :], Latr[:, 0]) ETOPO1 = False if ETOPO1: print('bathymetry from ETOPO1')
dx = 1 / pm dy = 1 / pn dxmax = np.max( dx/1000 ) dxmin = np.min( dx/1000 ) dymax = np.max( dy/1000 ) dymin = np.min( dy/1000 ) angle = get_angle(Latu, Lonu) 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)
yu, yv, yp = rho2uvp(yr) dx = 1 / pm dy = 1 / pn dxmax = np.max(dx / 1000) dxmin = np.min(dx / 1000) dymax = np.max(dy / 1000) dymin = np.min(dy / 1000) angle = get_angle(Latu, Lonu) 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) ####################################################################
& (lonbat < -35)) row = np.unique(row) col = np.unique(col) col, row = np.meshgrid(col, row) latbat = latbat[row, col] lonbat = lonbat[row, col] batgt = batgt[row, col] # plt.pcolor(lonbat,latbat, batgt, cmap=cmocean.cm.cmap_d['deep']);plt.show() h = griddata((lonbat.ravel(), latbat.ravel()), batgt.ravel(), (lon_rho.ravel(), lat_rho.ravel())).reshape(lat_rho.shape) ################# ETOPO2 = False if ETOPO2: print('bathymetry from ETOPO2') h = add_topo(lon_rho, lat_rho, pm, pn, 'ETOPO2v2g_f4.nc') #etopo #plt.pcolor(lon_rho, lat_rho, h);plt.show() dad_interp = True if dad_interp: p_file = netCDF4.Dataset('CF_tmz_g026.nc') h_parent = p_file['h'][:] lon_parent = p_file['lon_rho'][:] lat_parent = p_file['lat_rho'][:] h_parent = griddata( (lon_parent.ravel(), lat_parent.ravel()), h_parent.ravel(), (lon_rho.ravel(), lat_rho.ravel())).reshape(lon_rho.shape) nans = np.isnan(h_parent) h_parent[nans] = griddata((lon_rho[~nans], lat_rho[~nans]),