def make_plots(f0,f1,f2,f3, x1lim, y1lim, y2lim, y3lim):
#print sum of beaching hours
print('total beaching hours for f0 = ' + str(f0['Beaching_Time'][:,:].sum()))
print('total beaching hours for f1 = ' + str(f1['Beaching_Time'][:,:].sum()))
print('total beaching hours for f2 = ' + str(f2['Beaching_Time'][:,:].sum()))
print('total beaching hours for f3 = ' + str(f3['Beaching_Time'][:,:].sum()))
fig, ax = plt.subplots(2,2, figsize = (25,25))
for a in ax.flatten():
a.pcolormesh(bathy.mask[1:-1, 1:-1], cmap = cmap2)
ax[0,0].set_title("2015")
ax[0,1].set_title("2016")
ax[1,0].set_title("2017")
ax[1,1].set_title("2018")
ax[0,0].pcolormesh(np.ma.masked_equal(f0['Beaching_Time'][:,:], 0), vmin = 0, vmax = 168)
ax[0,1].pcolormesh(np.ma.masked_equal(f1['Beaching_Time'][:,:], 0), vmin = 0, vmax = 168)
ax[1,0].pcolormesh(np.ma.masked_equal(f2['Beaching_Time'][:,:], 0), vmin = 0, vmax = 168)
mesh = ax[1,1].pcolormesh(np.ma.masked_equal(f3['Beaching_Time'][:,:], 0), vmin = 0, vmax = 168)
fig.colorbar(mesh, ax=ax[1,1])
for a in ax.flatten():
viz_tools.set_aspect(a)
a.set_xlim(x1lim)
a.set_ylim(y1lim)
#make probability arrays
f0lessthanone = f0['Beaching_Time'][:,:]
f0lessthanone[(f0lessthanone <= 24) & (f0lessthanone > 0)] = 1
f0lessthanone[(f0lessthanone > 24) | (f0lessthanone == 0)] = 0
f1lessthanone = f1['Beaching_Time'][:,:]
f1lessthanone[(f1lessthanone <= 24) & (f1lessthanone > 0)] = 1
f1lessthanone[(f1lessthanone > 24) | (f1lessthanone == 0)] = 0
f2lessthanone = f2['Beaching_Time'][:,:]
f2lessthanone[(f2lessthanone <= 24) & (f2lessthanone > 0)] = 1
f2lessthanone[(f2lessthanone > 24) | (f2lessthanone == 0)] = 0
f3lessthanone = f3['Beaching_Time'][:,:]
f3lessthanone[(f3lessthanone <= 24) & (f3lessthanone > 0)] = 1
f3lessthanone[(f3lessthanone > 24) | (f3lessthanone == 0)] = 0
problessthanone = (f0lessthanone+f1lessthanone+f2lessthanone+f3lessthanone)/4
f0lessthanthree = f0['Beaching_Time'][:,:]
f0lessthanthree[(f0lessthanthree <= 72) & (f0lessthanthree > 0)] = 1
f0lessthanthree[(f0lessthanthree > 72) | (f0lessthanthree == 0)] = 0
f1lessthanthree = f1['Beaching_Time'][:,:]
f1lessthanthree[(f1lessthanthree <= 72) & (f1lessthanthree > 0)] = 1
f1lessthanthree[(f1lessthanthree > 72) | (f1lessthanthree == 0)] = 0
f2lessthanthree = f2['Beaching_Time'][:,:]
f2lessthanthree[(f2lessthanthree <= 72) & (f2lessthanthree > 0)] = 1
f2lessthanthree[(f2lessthanthree > 72) | (f2lessthanthree == 0)] = 0
f3lessthanthree = f3['Beaching_Time'][:,:]
f3lessthanthree[(f3lessthanthree <= 72) & (f3lessthanthree > 0)] = 1
f3lessthanthree[(f3lessthanthree > 72) | (f3lessthanthree == 0)] = 0
problessthanthree = (f0lessthanthree+f1lessthanthree+f2lessthanthree+f3lessthanthree)/4
f0lessthanseven = f0['Beaching_Time'][:,:]
f0lessthanseven[(f0lessthanseven <= 168) & (f0lessthanseven > 0)] = 1
f0lessthanseven[(f0lessthanseven > 168) | (f0lessthanseven == 0)] = 0
f1lessthanseven = f1['Beaching_Time'][:,:]
f1lessthanseven[(f1lessthanseven <= 168) & (f1lessthanseven > 0)] = 1
f1lessthanseven[(f1lessthanseven > 168) | (f1lessthanseven == 0)] = 0
f2lessthanseven = f2['Beaching_Time'][:,:]
f2lessthanseven[(f2lessthanseven <= 168) & (f2lessthanseven > 0)] = 1
f2lessthanseven[(f2lessthanseven > 168) | (f2lessthanseven == 0)] = 0
f3lessthanseven = f3['Beaching_Time'][:,:]
f3lessthanseven[(f3lessthanseven <= 168) & (f3lessthanseven > 0)] = 1
f3lessthanseven[(f3lessthanseven > 168) | (f3lessthanseven == 0)] = 0
problessthanseven = (f0lessthanseven+f1lessthanseven+f2lessthanseven+f3lessthanseven)/4
fig, ax = plt.subplots(1,3, figsize = (20,20))
for a in ax:
a.pcolormesh(bathy.mask[1:-1, 1:-1], cmap = cmap2)
ax[0].pcolormesh(np.ma.masked_equal(problessthanone,0), vmin = 0, vmax = 1, cmap = cmap)
ax[1].pcolormesh(np.ma.masked_equal(problessthanthree,0), vmin = 0, vmax = 1, cmap = cmap)
ax[2].pcolormesh(np.ma.masked_equal(problessthanseven,0), vmin = 0, vmax = 1, cmap = cmap)
ax[0].set_title('< 1 day')
ax[1].set_title('< 3 day')
ax[2].set_title('< 7 day')
plt.legend(handles=[green_patch, red_patch, yellow_patch, blue_patch],
bbox_to_anchor=(1.05, 1), loc='upper left')
for a in ax:
viz_tools.set_aspect(a)
a.set_ylim(y1lim);
a.set_xlim(x1lim);
bins = np.arange(0,8)
fig, ax = plt.subplots(2,2, figsize = (15,10))
ax[0,0].set_title("2015")
ax[0,1].set_title("2016")
ax[1,0].set_title("2017")
ax[1,1].set_title("2018")
ax[0,0].hist(f0['Beaching_Time'][:,:].flatten()[f0['Beaching_Time'][:,:].flatten() !=0]/24, bins=bins)
ax[0,1].hist(f1['Beaching_Time'][:,:].flatten()[f1['Beaching_Time'][:,:].flatten() !=0]/24, bins=bins)
ax[1,0].hist(f2['Beaching_Time'][:,:].flatten()[f2['Beaching_Time'][:,:].flatten() !=0]/24, bins=bins)
ax[1,1].hist(f3['Beaching_Time'][:,:].flatten()[f3['Beaching_Time'][:,:].flatten() !=0]/24,
bins=bins)
for a in ax.flatten():
a.set_ylim(0,y2lim)
a.set_xlabel('days')
fig, ax = plt.subplots(2,2, figsize = (15,10))
ax[0,0].set_title("2015")
ax[0,1].set_title("2016")
ax[1,0].set_title("2017")
ax[1,1].set_title("2018")
ax[0,0].hist(f0['Beaching_Time'][:,:].flatten()[f0['Beaching_Time'][:,:].flatten() !=0]/24,
bins=bins, cumulative = True)
ax[0,1].hist(f1['Beaching_Time'][:,:].flatten()[f1['Beaching_Time'][:,:].flatten() !=0]/24,
bins=bins, cumulative = True)
ax[1,0].hist(f2['Beaching_Time'][:,:].flatten()[f2['Beaching_Time'][:,:].flatten() !=0]/24,
bins=bins, cumulative = True)
ax[1,1].hist(f3['Beaching_Time'][:,:].flatten()[f3['Beaching_Time'][:,:].flatten() !=0]/24,
bins=bins, cumulative = True)
for a in ax.flatten():
a.set_ylim(0,y3lim)
a.set_xlabel('days');