Пример #1
0
    return bathySmoothed, lon[res[0]:res[1]], lat[res[2]:res[3]]


""" MAIN """
"""Get the grid file defined in /Users/trondkr/Projects/KINO/map/gridid.txt"""
grd = pyroms.grid.get_ROMS_grid('KINO1600M')
"""Get the Etopo1 raw data"""
print "Extracting Etopo1 data for region"
bathyEtopo1, lonsEtopo1, latsEtopo1 = getEtopo1(grd.hgrid.lon_rho.min(),
                                                grd.hgrid.lon_rho.max(),
                                                grd.hgrid.lat_rho.min(),
                                                grd.hgrid.lat_rho.max())
""" Fix minimum depth in Etopo1 matrix"""
print "Changing the minimum depth in Etopo1 file (remove land values)"
hmin = -10
topo = pyroms_toolbox.change(bathyEtopo1, '>', hmin, hmin)
print "Max and min of topo", np.max(topo), np.min(topo)
"""Ocean values are originally negative in etopo1 file but we switch to positive after having removed the
land values"""
topo = -topo
""" interpolate new bathymetry """
print "Interpolating new bathymetry"

#print topo.shape, len(lonsEtopo1), len(latsEtopo1)
h = mp.interp(topo,
              lonsEtopo1,
              latsEtopo1,
              grd.hgrid.lon_rho,
              grd.hgrid.lat_rho,
              checkbounds=False,
              masked=False,
Пример #2
0
# this topo come with basemap so you should have it on your laptop.
# just update datadir with the appropriate path
# you can get this data from matplolib svn with
# svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/htdocs/screenshots/data/"

datadir = 'data/'
topo = np.loadtxt(os.path.join(datadir, 'etopo20data.gz'))
lons = np.loadtxt(os.path.join(datadir, 'etopo20lons.gz'))
lats = np.loadtxt(os.path.join(datadir, 'etopo20lats.gz'))

# depth positive
topo = -topo

# fix minimum depth
hmin = 5
topo = pyroms_toolbox.change(topo, '<', hmin, hmin)

# interpolate new bathymetry
lon, lat = np.meshgrid(lons, lats)
h = griddata(lon.flat, lat.flat, topo.flat, hgrd.lon_rho, hgrd.lat_rho)

# insure that depth is always deeper than hmin
h = pyroms_toolbox.change(h, '<', hmin, hmin)

# set depth to hmin where masked
idx = np.where(hgrd.mask_rho == 0)
h[idx] = hmin

# save raw bathymetry
hraw = h.copy()
Lp = 50  #closeness to BCZ
Mp = 40

rr = netCDF4.Dataset('GEBCO_2014_2D_-15.0_40.0_10.0_60.0_BATHYMETRY_FILE.nc',
                     'r',
                     format='NETCDF4')
lats = rr.variables['lat'][1080:1560]
lons = rr.variables['lon'][1500:2500]
topo = rr.variables['elevation'][1080:1560, 1500:2500]

topo = -topo

print 'fix minimum depth'
hmin = 2
topo = pyroms_toolbox.change(topo, '<', hmin, hmin)

lon0 = 6.7
lat0 = 50.3
lon1 = 5.0
lat1 = 52.3
lon2 = 0
lat2 = 52.3
lon4 = 0
lat4 = 49.7
lon5 = 1.8
lat5 = 50.3
lon6 = 2.61
lat6 = 51.04
lon7 = 3.40
lat7 = 51.32
Пример #4
0
lats = np.loadtxt(os.path.join(datadir, 'etopo20lats.gz'))

# shift data so lons go from -180 to 180 instead of 20 to 380.
topo,lons = shiftgrid(180.,topo,lons,start=False)

# keep only the US
topo = topo[270:525, 30:400]
lons = lons[30:400]
lats = lats[270:525]

# depth positive
topo = -topo

# fix minimum depth
hmin = 5
topo = pyroms_toolbox.change(topo, '<', hmin, hmin)

# interpolate new bathymetry
lon, lat = meshgrid(lons, lats)
h = griddata(lon.flat,lat.flat,topo.flat,hgrd.lon_rho,hgrd.lat_rho)

# insure that depth is always deeper than hmin
h = pyroms_toolbox.change(h, '<', hmin, hmin)

# check bathymetry roughness
RoughMat = bathy_tools.RoughnessMatrix(h, hgrd.mask_rho)
print 'Max Roughness value is: ', RoughMat.max()

# smooth the raw bathy using the direct iterative method from Martinho and Batteen (2006)
rx0_max = 0.35
h = bathy_smoothing.smoothing_Positive_rx0(hgrd.mask_rho, h, rx0_max)
Пример #5
0
""" MAIN """

"""Get the grid file defined in /Users/trondkr/Projects/KINO/map/gridid.txt"""
grd = pyroms.grid.get_ROMS_grid('KINO1600M')

"""Get the Etopo1 raw data"""
print "Extracting Etopo1 data for region"
bathyEtopo1, lonsEtopo1, latsEtopo1 = getEtopo1(grd.hgrid.lon_rho.min(),
                                                grd.hgrid.lon_rho.max(),
                                                grd.hgrid.lat_rho.min(),
                                                grd.hgrid.lat_rho.max())

""" Fix minimum depth in Etopo1 matrix"""
print "Changing the minimum depth in Etopo1 file (remove land values)"
hmin = -10
topo = pyroms_toolbox.change(bathyEtopo1, '>', hmin, hmin)
print "Max and min of topo",np.max(topo),np.min(topo)
"""Ocean values are originally negative in etopo1 file but we switch to positive after having removed the
land values"""
topo=-topo


""" interpolate new bathymetry """
print "Interpolating new bathymetry"

#print topo.shape, len(lonsEtopo1), len(latsEtopo1)
h = mp.interp(topo,
            lonsEtopo1,
            latsEtopo1,
            grd.hgrid.lon_rho,
            grd.hgrid.lat_rho,