%matplotlib inline
import matplotlib.pyplot as plt
import netCDF4 as nc
import numpy as np
from salishsea_tools import bathy_tools
bathy_orig = nc.Dataset('../../original_bathy.nc', 'r')
print bathy_orig.file_format
NETCDF3_CLASSIC
lats = bathy_orig.variables['nav_lat']
lons = bathy_orig.variables['nav_lon']
depths_orig = bathy_orig.variables['Bathymetry']
fig = bathy_tools.plot_colourmesh(
bathy_orig, 'Original Salish Sea Bathymetry',
axis_limits=(-126.3, -122.15, 47.05, 51))
Jervis
fig = bathy_tools.plot_colourmesh_zoom(
bathy_orig, (320,650), half_width=10, bins=25)
def clean_jervis(depths):
depths[650:651+1,310:320] = 0.
depths[647:649+1,312:320] = 0.
return depths
depths_nojervis = np.copy(depths_orig[:])
depths_nojervis = clean_jervis(depths_nojervis)
plt.pcolormesh(depths_nojervis[640:660,310:330])
plt.colorbar()
<matplotlib.colorbar.Colorbar instance at 0x105c38ea8>
fig = bathy_tools.plot_colourmesh_zoom(
bathy_orig, (245,788), half_width=70, bins=25)
plt.pcolormesh(depths_orig[771:788,186:250])
plt.colorbar()
#print depths[770,189]
<matplotlib.colorbar.Colorbar instance at 0x1062e1fc8>
def clean_tobaplus(depths):
depths[746,243:] = 0.
depths[747:756+1,240:] = 0.
depths[757:763+1,235:] = 0.
depths[763:766+1,220:] = 0.
depths[766:771,213:] = 0.
depths[771,189:] = 0.
depths[772,188:] = 0.
depths[773:774+1,189:] = 0.
depths[775:784+1,190:] = 0.
depths[785:788+1,198:] = 0.
depths[789:791+1,199:] = 0.
return depths
depths_notoba = np.copy(depths_nojervis[:])
depths_notoba = clean_tobaplus(depths_notoba)
difference = depths_notoba-depths_orig
mdiff = difference == 0
diff_masked = np.ma.array(difference,mask=mdiff)
plt.figure(figsize=(4,8))
plt.pcolormesh(diff_masked)
plt.colorbar()
<matplotlib.colorbar.Colorbar instance at 0x10730d830>