import numpy as np import matplotlib.pyplot as plt import scipy.io as sio %matplotlib inline sio.whosmat('PNW.mat') pnw = sio.loadmat('PNW.mat') pnw lats = pnw['ncst'][:, 1] lons = pnw['ncst'][:, 0] plt.plot(lons, lats) plt.show() fig, ax = plt.subplots(1, 1, figsize=(10, 10)) ax.plot(lons, lats, color='black', rasterized=True) ax.set_axis_bgcolor('lightgrey') ax.set_xlim([-126.4, -121.3]) ax.set_ylim([46.8, 51.1]) ax.set_xlabel('Longitude [degrees east]') ax.set_ylabel('Latitude [degrees north]') ax.set_title('Salish Sea Coastline', fontsize=18) plt.show() fig, ax = plt.subplots(1, 1, figsize=(10, 10)) ax.plot(lons, lats, color='black', rasterized=True) ax.set_axis_bgcolor('lightgrey') ax.set_xlim([-126.4, -121.3]) ax.set_ylim([46.8, 51.1]) ax.set_xlabel('Longitude [degrees east]') ax.set_ylabel('Latitude [degrees north]') ax.set_title('Salish Sea Coastline', fontsize=18) # Annotate geography ax.text(-126, 48,'Pacific Ocean', fontsize=16) ax.text(-124.1, 47.6,'Washington\nState', fontsize=16) ax.text(-122.3, 47.6,'Puget Sound', fontsize=12) ax.text(-125.6, 49.3,'Vancouver\nIsland', fontsize=14) ax.text(-123, 50,'British Columbia', fontsize=16) ax.text(-124.6, 48.4,'Strait of Juan de Fuca', fontsize=11, rotation=-13) ax.text(-123.9, 49.2,'Strait of\n Georgia', fontsize=11, rotation=-2) plt.show() fig, ax = plt.subplots(1, 1, figsize=(10, 10)) ax.plot(lons, lats, color='black', rasterized=True) ax.set_axis_bgcolor('lightgrey') ax.set_xlim([-126.4, -121.3]) ax.set_ylim([46.8, 51.1]) ax.set_xlabel('Longitude [degrees east]') ax.set_ylabel('Latitude [degrees north]') ax.set_title('Salish Sea Coastline', fontsize=18) # Annotate geography ax.text(-126, 48,'Pacific Ocean', fontsize=16) ax.text(-124.1, 47.6,'Washington\nState', fontsize=16) ax.text(-122.3, 47.6,'Puget Sound', fontsize=12) ax.text(-125.6, 49.3,'Vancouver\nIsland', fontsize=14) ax.text(-123, 50,'British Columbia', fontsize=16) ax.text(-124.6, 48.4,'Strait of Juan de Fuca', fontsize=11, rotation=-13) ax.text(-123.9, 49.2,'Strait of\n Georgia', fontsize=11, rotation=-2) # Mark cities cities = ( ('Victoria', -123.3657, 48.4222, -80, 20), ('Vancouver', -123.1, 49.25, 60, -20), ('Campbell River', -125.2475, 50.0244, -70, -30), ) arrow_properties = { 'arrowstyle': '->', 'connectionstyle': 'arc3, rad=0', } for name, lon, lat, textx, texty in cities: ax.plot(lon, lat, marker='*', color='red', markersize=15) ax.annotate( name, xy=(lon, lat), xytext=(textx, texty), textcoords='offset points', fontsize=11, arrowprops=arrow_properties, ) plt.show() fig.savefig('SalishSeaGeography.png') sio.whosmat('SouthVIgrid.mat') svi = sio.loadmat('SouthVIgrid.mat') topo_struct = svi['SouthVIgrid'] topo = topo_struct[0,0] xmask = np.where( np.logical_and( np.squeeze(topo['lon'] > -126.7), np.squeeze(topo['lon'] < -122)))[0] ymask = np.where( np.logical_and( np.squeeze(topo['lat'] > 46), np.squeeze(topo['lat'] < 50)))[0] x = np.squeeze(topo['lon'])[xmask] y = np.squeeze(topo['lat'])[ymask] z = topo['depth'][ymask, :][:, xmask]