from salishsea_tools import (bathy_tools, nc_tools,viz_tools,tidetools)
from numpy import loadtxt
from __future__ import division, print_function
from salishsea_tools.nowcast import figures
import scipy.io as sio
import matplotlib.pyplot as plt
import netCDF4 as nc
import numpy as np
%matplotlib inline
!cp /ocean/jieliu/research/meopar/river-treatment/bathy_meter_SalishSea6.nc \
bathy_meter_SalishSea13.nc
bathy = nc.Dataset('/ocean/jieliu/research/meopar/river-treatment/bathy_meter_SalishSea6.nc', 'r')
bathyy = bathy.variables['Bathymetry'][:]
bathy_9 = nc.Dataset('bathy_meter_SalishSea9.nc','r+' )
bathyy_9 = bathy_9.variables['Bathymetry']
lon_9 = bathy_9.variables['nav_lon']
lat_9 = bathy_9.variables['nav_lat']
fig = bathy_tools.plot_colourmesh(
bathy, 'NEMO - Salish Sea Bathymetry',
axis_limits=(-123.4, -122.7, 49., 49.7), colour_map='spectral', bins=30)
/home/jieliu/anaconda3/lib/python3.4/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'):
bath, X, Y = tidetools.get_bathy_data(bathy)
fig, ax = plt.subplots(1, 1, figsize=(10, 8))
viz_tools.set_aspect(ax)
cmap = plt.get_cmap('winter_r')
cmap.set_bad('burlywood')
mesh = ax.pcolormesh(bath, cmap=cmap)
fig.colorbar(mesh)
plt.axis((280, 340, 370, 460))
(280, 340, 370, 460)
/home/jieliu/anaconda3/lib/python3.4/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'):
## to put the range of lat, lon indices and bathymetry into list
lat_ind = []
lon_ind = []
remain_edit_bathy = []
for j in np.arange(370, 460):
for i in np.arange(280, 340):
if (bathyy[j,i] <=4):
#lat_ind.append(j)
#lon_ind.append(i)
#remain_edit_bathy.append(bathyy_9[j,i])
bathyy_9[j,i] = np.ma.masked_values(bathyy_9[j,i], 4)
#print (j,i)
bathy_9.close()
a= nc.Dataset('bathy_meter_SalishSea9.nc')
b= a.variables['Bathymetry']
b[427,288]
100.0
!cp /ocean/jieliu/research/meopar/nemo-forcing/grid/bathy_meter_SalishSea2.nc \
bathy_meter_SalishSea3.nc
bathy = nc.Dataset('/ocean/jieliu/research/meopar/nemo-forcing/grid/bathy_meter_SalishSea2.nc', 'r')
bathyy = bathy.variables['Bathymetry'][:]
bathy_3 = nc.Dataset('bathy_meter_SalishSea3.nc','r+' )
bathyy_3 = bathy_3.variables['Bathymetry']
lon_3 = bathy_3.variables['nav_lon']
lat_3 = bathy_3.variables['nav_lat']
bath, X, Y = tidetools.get_bathy_data(bathy)
fig, ax = plt.subplots(1, 1, figsize=(10, 8))
viz_tools.set_aspect(ax)
cmap = plt.get_cmap('winter_r')
cmap.set_bad('burlywood')
mesh = ax.pcolormesh(bath, cmap=cmap)
fig.colorbar(mesh)
plt.axis((280, 310, 350, 480))
(280, 310, 350, 480)
/home/jieliu/anaconda3/lib/python3.4/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'):
## to put the range of lat, lon indices and bathymetry into list
lat_ind = []
lon_ind = []
remain_edit_bathy = []
for j in np.arange(350, 480):
for i in np.arange(280, 310):
if (bathyy_3[j,i] <=4):
#lat_ind.append(j)
#lon_ind.append(i)
#remain_edit_bathy.append(bathyy_3[j,i])
bathyy_3[j,i] = np.ma.masked_values(bathyy_3[j,i], 4)
#print (j,i)
fig = bathy_tools.plot_colourmesh(
bathy_3, 'NEMO - Salish Sea Bathymetry',
axis_limits=(-123.4, -122.7, 49., 49.7), colour_map='spectral', bins=30)
/home/jieliu/anaconda3/lib/python3.4/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'):
## Long river channel without banks
bathy_9 = nc.Dataset('bathy_meter_SalishSea9.nc' )
fig = bathy_tools.plot_colourmesh(
bathy_9, 'NEMO - Salish Sea Bathymetry',
axis_limits=(-123.4, -122.7, 49., 49.7), colour_map='spectral', bins=30)
/home/jieliu/anaconda3/lib/python3.4/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'):
bathy_3.close()