import cmocean.cm as cm
import h5py
import matplotlib as mpl
import matplotlib.colorbar as colorbar
import matplotlib.colors as mplcolours
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import xarray as xr
%matplotlib inline
mesh = xr.open_dataset('~/MEOPAR/grid/mesh_mask201702.nc')
oildiesel1000 = pd.read_csv('/data/sallen/results/MIDOSS/ParticleNoTests/SB_1000_diesel/new11/resOilOutput.sro', sep='\s+', skiprows=4)
oildiesel1000 = oildiesel1000.drop([0], axis=0)
length =len(oildiesel1000)
oildiesel1000 = oildiesel1000.drop([length-3, length-2, length-1, length], axis=0)
fig, ax = plt.subplots(1, 1, figsize=(15,5))
oildiesel1000.Area.plot(ax=ax);
plt.grid();
fig, ax = plt.subplots(1, 1, figsize=(15,5))
oildiesel1000.MDissolved.plot();
oildiesel1000.MEvaporated.plot();
oildiesel1000.MassOil.plot();
oildiesel1000.MDispersed.plot();
oildiesel1000.MBio.plot()
massbeached = (oildiesel1000.VolOilBeached*oildiesel1000.Density/(1-oildiesel1000.VWaterContent)
*(1-oildiesel1000.MWaterContent))
massbeached.plot(label="Beached")
plt.plot(oildiesel1000.MDissolved + oildiesel1000.MEvaporated + oildiesel1000.MassOil
+ massbeached + oildiesel1000.MDispersed);
plt.legend();
plt.grid();
(oildiesel1000.Density/(1-oildiesel1000.VWaterContent)
*(1-oildiesel1000.MWaterContent)).plot();
oildiesel1000.MDispersed.plot();
fig, ax = plt.subplots(1, 1, figsize=(15, 3.5))
ax.plot(oildiesel1000.MDissolved + oildiesel1000.MEvaporated + oildiesel1000.MassOil
+ massbeached + oildiesel1000.MDispersed + oildiesel1000.MBio);
ax.grid();
massbeached.plot(label="Beached");
plt.grid()
(oildiesel1000.MDispersed/(oildiesel1000.MDispersed + oildiesel1000.MassOil)).plot()
plt.grid()
oildiesel1000.VolumeOil.plot();
plt.legend();
plt.grid();
oildiesel1000.AnalyteMass1.plot()
oildiesel1000.AnalyteMass2.plot()
oildiesel1000.AnalyteMass3.plot()
oildiesel1000.AnalyteMass4.plot()
oildiesel1000.AnalyteMass5.plot();
oildiesel1000.Thickness.plot();
diesel1000 = xr.open_dataset('/data/sallen/results/MIDOSS/ParticleNoTests/SB_1000_diesel/new11/Lagrangian_SB_1000_diesel_SB_1000_diesel.nc')
diesel1000
array(['2018-01-15T00:30:00.000000000', '2018-01-15T01:30:00.000000000', '2018-01-15T02:30:00.000000000', '2018-01-15T03:30:00.000000000', '2018-01-15T04:30:00.000000000', '2018-01-15T05:30:00.000000000', '2018-01-15T06:30:00.000000000', '2018-01-15T07:30:00.000000000', '2018-01-15T08:30:00.000000000', '2018-01-15T09:30:00.000000000', '2018-01-15T10:30:00.000000000', '2018-01-15T11:30:00.000000000', '2018-01-15T12:30:00.000000000', '2018-01-15T13:30:00.000000000', '2018-01-15T14:30:00.000000000', '2018-01-15T15:30:00.000000000', '2018-01-15T16:30:00.000000000', '2018-01-15T17:30:00.000000000', '2018-01-15T18:30:00.000000000', '2018-01-15T19:30:00.000000000', '2018-01-15T20:30:00.000000000', '2018-01-15T21:30:00.000000000', '2018-01-15T22:30:00.000000000', '2018-01-15T23:30:00.000000000', '2018-01-16T00:30:00.000000000', '2018-01-16T01:30:00.000000000', '2018-01-16T02:30:00.000000000', '2018-01-16T03:30:00.000000000', '2018-01-16T04:30:00.000000000', '2018-01-16T05:30:00.000000000', '2018-01-16T06:30:00.000000000', '2018-01-16T07:30:00.000000000', '2018-01-16T08:30:00.000000000', '2018-01-16T09:30:00.000000000', '2018-01-16T10:30:00.000000000', '2018-01-16T11:30:00.000000000', '2018-01-16T12:30:00.000000000', '2018-01-16T13:30:00.000000000', '2018-01-16T14:30:00.000000000', '2018-01-16T15:30:00.000000000', '2018-01-16T16:30:00.000000000', '2018-01-16T17:30:00.000000000', '2018-01-16T18:30:00.000000000', '2018-01-16T19:30:00.000000000', '2018-01-16T20:30:00.000000000', '2018-01-16T21:30:00.000000000', '2018-01-16T22:30:00.000000000', '2018-01-16T23:30:00.000000000', '2018-01-17T00:30:00.000000000', '2018-01-17T01:30:00.000000000', '2018-01-17T02:30:00.000000000', '2018-01-17T03:30:00.000000000', '2018-01-17T04:30:00.000000000', '2018-01-17T05:30:00.000000000', '2018-01-17T06:30:00.000000000', '2018-01-17T07:30:00.000000000', '2018-01-17T08:30:00.000000000', '2018-01-17T09:30:00.000000000', '2018-01-17T10:30:00.000000000', '2018-01-17T11:30:00.000000000', '2018-01-17T12:30:00.000000000', '2018-01-17T13:30:00.000000000', '2018-01-17T14:30:00.000000000', '2018-01-17T15:30:00.000000000', '2018-01-17T16:30:00.000000000', '2018-01-17T17:30:00.000000000', '2018-01-17T18:30:00.000000000', '2018-01-17T19:30:00.000000000', '2018-01-17T20:30:00.000000000', '2018-01-17T21:30:00.000000000', '2018-01-17T22:30:00.000000000', '2018-01-17T23:30:00.000000000', '2018-01-18T00:30:00.000000000', '2018-01-18T01:30:00.000000000', '2018-01-18T02:30:00.000000000', '2018-01-18T03:30:00.000000000', '2018-01-18T04:30:00.000000000', '2018-01-18T05:30:00.000000000', '2018-01-18T06:30:00.000000000', '2018-01-18T07:30:00.000000000', '2018-01-18T08:30:00.000000000', '2018-01-18T09:30:00.000000000', '2018-01-18T10:30:00.000000000', '2018-01-18T11:30:00.000000000', '2018-01-18T12:30:00.000000000', '2018-01-18T13:30:00.000000000', '2018-01-18T14:30:00.000000000', '2018-01-18T15:30:00.000000000', '2018-01-18T16:30:00.000000000', '2018-01-18T17:30:00.000000000', '2018-01-18T18:30:00.000000000', '2018-01-18T19:30:00.000000000', '2018-01-18T20:30:00.000000000', '2018-01-18T21:30:00.000000000', '2018-01-18T22:30:00.000000000', '2018-01-18T23:30:00.000000000', '2018-01-19T00:30:00.000000000', '2018-01-19T01:30:00.000000000', '2018-01-19T02:30:00.000000000', '2018-01-19T03:30:00.000000000', '2018-01-19T04:30:00.000000000', '2018-01-19T05:30:00.000000000', '2018-01-19T06:30:00.000000000', '2018-01-19T07:30:00.000000000', '2018-01-19T08:30:00.000000000', '2018-01-19T09:30:00.000000000', '2018-01-19T10:30:00.000000000', '2018-01-19T11:30:00.000000000', '2018-01-19T12:30:00.000000000', '2018-01-19T13:30:00.000000000', '2018-01-19T14:30:00.000000000', '2018-01-19T15:30:00.000000000', '2018-01-19T16:30:00.000000000', '2018-01-19T17:30:00.000000000', '2018-01-19T18:30:00.000000000', '2018-01-19T19:30:00.000000000', '2018-01-19T20:30:00.000000000', '2018-01-19T21:30:00.000000000', '2018-01-19T22:30:00.000000000', '2018-01-19T23:30:00.000000000', '2018-01-20T00:30:00.000000000', '2018-01-20T01:30:00.000000000', '2018-01-20T02:30:00.000000000', '2018-01-20T03:30:00.000000000', '2018-01-20T04:30:00.000000000', '2018-01-20T05:30:00.000000000', '2018-01-20T06:30:00.000000000', '2018-01-20T07:30:00.000000000', '2018-01-20T08:30:00.000000000', '2018-01-20T09:30:00.000000000', '2018-01-20T10:30:00.000000000', '2018-01-20T11:30:00.000000000', '2018-01-20T12:30:00.000000000', '2018-01-20T13:30:00.000000000', '2018-01-20T14:30:00.000000000', '2018-01-20T15:30:00.000000000', '2018-01-20T16:30:00.000000000', '2018-01-20T17:30:00.000000000', '2018-01-20T18:30:00.000000000', '2018-01-20T19:30:00.000000000', '2018-01-20T20:30:00.000000000', '2018-01-20T21:30:00.000000000', '2018-01-20T22:30:00.000000000', '2018-01-20T23:30:00.000000000', '2018-01-21T00:30:00.000000000', '2018-01-21T01:30:00.000000000', '2018-01-21T02:30:00.000000000', '2018-01-21T03:30:00.000000000', '2018-01-21T04:30:00.000000000', '2018-01-21T05:30:00.000000000', '2018-01-21T06:30:00.000000000', '2018-01-21T07:30:00.000000000', '2018-01-21T08:30:00.000000000', '2018-01-21T09:30:00.000000000', '2018-01-21T10:30:00.000000000', '2018-01-21T11:30:00.000000000', '2018-01-21T12:30:00.000000000', '2018-01-21T13:30:00.000000000', '2018-01-21T14:30:00.000000000', '2018-01-21T15:30:00.000000000', '2018-01-21T16:30:00.000000000', '2018-01-21T17:30:00.000000000', '2018-01-21T18:30:00.000000000', '2018-01-21T19:30:00.000000000', '2018-01-21T20:30:00.000000000', '2018-01-21T21:30:00.000000000', '2018-01-21T22:30:00.000000000', '2018-01-21T23:30:00.000000000', '2018-01-22T00:30:00.000000000', '2018-01-22T01:30:00.000000000', '2018-01-22T02:30:00.000000000', '2018-01-22T03:30:00.000000000', '2018-01-22T04:30:00.000000000', '2018-01-22T05:30:00.000000000', '2018-01-22T06:30:00.000000000', '2018-01-22T07:30:00.000000000', '2018-01-22T08:30:00.000000000', '2018-01-22T09:30:00.000000000', '2018-01-22T10:30:00.000000000', '2018-01-22T11:30:00.000000000', '2018-01-22T12:30:00.000000000', '2018-01-22T13:30:00.000000000', '2018-01-22T14:30:00.000000000', '2018-01-22T15:30:00.000000000', '2018-01-22T16:30:00.000000000', '2018-01-22T17:30:00.000000000', '2018-01-22T18:30:00.000000000', '2018-01-22T19:30:00.000000000', '2018-01-22T20:30:00.000000000', '2018-01-22T21:30:00.000000000', '2018-01-22T22:30:00.000000000'], dtype='datetime64[ns]')
array([ 0, 1, 2, ..., 893, 894, 895], dtype=int16)
array([ 0, 1, 2, ..., 393, 394, 395], dtype=int16)
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39], dtype=int16)
array([ 0., 1., 2., ..., 894., 895., 896.], dtype=float32)
array([ 0., 1., 2., ..., 394., 395., 396.], dtype=float32)
[67769856 values with dtype=float64]
[67769856 values with dtype=float64]
[2710794240 values with dtype=float64]
[2710794240 values with dtype=float64]
[2710794240 values with dtype=float64]
[356109 values with dtype=float64]
[356109 values with dtype=float64]
[354816 values with dtype=datetime64[ns]]
[354816 values with dtype=float64]
[354816 values with dtype=datetime64[ns]]
imin, imax = 200, 350
jmin, jmax = 150, 280
fig, axs = plt.subplots(1, 2, figsize=(15, 5))
it = 20
field = diesel1000.OilWaterColumnOilVol_3D[it]
(field[:, imin:imax , jmin:jmax].sum(axis=0)).plot(ax=axs[0], cmap='copper')
print (diesel1000.OilWaterColumnOilVol_3D[it, :, imin:imax, jmin:jmax].sum(axis=0).sum(axis=0).sum(axis=0))
axs[1].plot(diesel1000.time[0:72], diesel1000.OilWaterColumnOilVol_3D[0:72].sum(axis=1).sum(axis=1).sum(axis=1)
)
<xarray.DataArray 'OilWaterColumnOilVol_3D' ()> array(1860.458) Coordinates: time datetime64[ns] 2018-01-15T20:30:00
[<matplotlib.lines.Line2D at 0x7faa95dd1950>]
oildiesel1000.VolumeOil.plot()
<matplotlib.axes._subplots.AxesSubplot at 0x7faa91c62850>
tmax = 20
fig, axs = plt.subplots(1, 3, figsize=(15, 5))
diesel1000.OilWaterColumnOilVol_3D[1:tmax+1, 39, 200:300, 200:300].sum(axis=0).plot(ax=axs[0]);
diesel1000.OilWaterColumnOilVol_3D[1:tmax+1, 38, 200:300, 200:300].sum(axis=0).plot(ax=axs[1]);
diesel1000.OilWaterColumnOilVol_3D[1:tmax+1, 0:38, 200:300, 200:300].sum(axis=0).sum(axis=0).plot(ax=axs[2]);
fig, axs = plt.subplots(2, 2, figsize=(15, 15))
imin, imax = 250, 290
jmin, jmax = 230, 270
diesel1000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[0, 0], cmap='gist_ncar');
#ds2000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[0, 1], cmap='gist_ncar');
#ds5000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[1, 0], cmap='gist_ncar');
#ds10000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[1, 1], cmap='gist_ncar');
axs[0, 1].set_title('2000');
fig, axs = plt.subplots(2, 2, figsize=(15, 15))
imin, imax = 220, 350
jmin, jmax = 150, 280
diesel1000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[0, 0], cmap='gist_ncar');
#ds2000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[0, 1], cmap='gist_ncar');
#ds5000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[1, 0], cmap='gist_ncar');
#ds10000.OilWaterColumnOilVol_3D[:, 39, imin:imax, jmin:jmax].sum(axis=0).plot(ax=axs[1, 1], cmap='gist_ncar');
axs[0, 1].set_title('2000');
fig, axs = plt.subplots(2, 2, figsize=(15, 15))
imin, imax = 250, 350
jmin, jmax = 150, 250
diesel1000.Beaching_Volume[imin:imax , jmin:jmax].plot(ax=axs[0,0], cmap='copper')
print (diesel1000.Beaching_Volume.sum(axis=0).sum(axis=0))
#ds2000.Beaching_Volume[imin:imax , jmin:jmax].plot(ax=axs[0,1], cmap='copper')
#print (ds2000.Beaching_Volume.sum(axis=0).sum(axis=0))
#ds5000.Beaching_Volume[imin:imax , jmin:jmax].plot(ax=axs[1,0], cmap='copper')
#print (ds5000.Beaching_Volume.sum(axis=0).sum(axis=0))
#ds10000.Beaching_Volume[imin:imax , jmin:jmax].plot(ax=axs[1,1], cmap='copper')
#print (ds10000.Beaching_Volume.sum(axis=0).sum(axis=0))
<xarray.DataArray 'Beaching_Volume' ()> array(615.75950367)
plt.pcolormesh(mesh.tmask[0, 0, imin:imax, jmin:jmax])
plt.plot(218-jmin, 290-jmax, 'r*')
[<matplotlib.lines.Line2D at 0x7faa912bb250>]
#scale = 86400 * 1e9
#days = np.ma.masked_array((diesel1000.Beaching_Time[imin:imax, jmin:jmax]-diesel1000.Beaching_Time[:].min())/scale,
# diesel1000.Beaching_Time[imin:imax, jmin:jmax] == diesel1000.Beaching_Time[:].min())
#plt.pcolormesh(diesel1000.Beaching_Time[imin:imax, jmin:jmax]);
bt = np.array(diesel1000.Beaching_Time[imin:imax, jmin:jmax] - diesel1000.Beaching_Time[imin:imax, jmin:jmax].min())
plt.plot(bt/1e9/3600, 'ro');
diesel1000.time
array(['2018-01-15T00:30:00.000000000', '2018-01-15T01:30:00.000000000', '2018-01-15T02:30:00.000000000', '2018-01-15T03:30:00.000000000', '2018-01-15T04:30:00.000000000', '2018-01-15T05:30:00.000000000', '2018-01-15T06:30:00.000000000', '2018-01-15T07:30:00.000000000', '2018-01-15T08:30:00.000000000', '2018-01-15T09:30:00.000000000', '2018-01-15T10:30:00.000000000', '2018-01-15T11:30:00.000000000', '2018-01-15T12:30:00.000000000', '2018-01-15T13:30:00.000000000', '2018-01-15T14:30:00.000000000', '2018-01-15T15:30:00.000000000', '2018-01-15T16:30:00.000000000', '2018-01-15T17:30:00.000000000', '2018-01-15T18:30:00.000000000', '2018-01-15T19:30:00.000000000', '2018-01-15T20:30:00.000000000', '2018-01-15T21:30:00.000000000', '2018-01-15T22:30:00.000000000', '2018-01-15T23:30:00.000000000', '2018-01-16T00:30:00.000000000', '2018-01-16T01:30:00.000000000', '2018-01-16T02:30:00.000000000', '2018-01-16T03:30:00.000000000', '2018-01-16T04:30:00.000000000', '2018-01-16T05:30:00.000000000', '2018-01-16T06:30:00.000000000', '2018-01-16T07:30:00.000000000', '2018-01-16T08:30:00.000000000', '2018-01-16T09:30:00.000000000', '2018-01-16T10:30:00.000000000', '2018-01-16T11:30:00.000000000', '2018-01-16T12:30:00.000000000', '2018-01-16T13:30:00.000000000', '2018-01-16T14:30:00.000000000', '2018-01-16T15:30:00.000000000', '2018-01-16T16:30:00.000000000', '2018-01-16T17:30:00.000000000', '2018-01-16T18:30:00.000000000', '2018-01-16T19:30:00.000000000', '2018-01-16T20:30:00.000000000', '2018-01-16T21:30:00.000000000', '2018-01-16T22:30:00.000000000', '2018-01-16T23:30:00.000000000', '2018-01-17T00:30:00.000000000', '2018-01-17T01:30:00.000000000', '2018-01-17T02:30:00.000000000', '2018-01-17T03:30:00.000000000', '2018-01-17T04:30:00.000000000', '2018-01-17T05:30:00.000000000', '2018-01-17T06:30:00.000000000', '2018-01-17T07:30:00.000000000', '2018-01-17T08:30:00.000000000', '2018-01-17T09:30:00.000000000', '2018-01-17T10:30:00.000000000', '2018-01-17T11:30:00.000000000', '2018-01-17T12:30:00.000000000', '2018-01-17T13:30:00.000000000', '2018-01-17T14:30:00.000000000', '2018-01-17T15:30:00.000000000', '2018-01-17T16:30:00.000000000', '2018-01-17T17:30:00.000000000', '2018-01-17T18:30:00.000000000', '2018-01-17T19:30:00.000000000', '2018-01-17T20:30:00.000000000', '2018-01-17T21:30:00.000000000', '2018-01-17T22:30:00.000000000', '2018-01-17T23:30:00.000000000', '2018-01-18T00:30:00.000000000', '2018-01-18T01:30:00.000000000', '2018-01-18T02:30:00.000000000', '2018-01-18T03:30:00.000000000', '2018-01-18T04:30:00.000000000', '2018-01-18T05:30:00.000000000', '2018-01-18T06:30:00.000000000', '2018-01-18T07:30:00.000000000', '2018-01-18T08:30:00.000000000', '2018-01-18T09:30:00.000000000', '2018-01-18T10:30:00.000000000', '2018-01-18T11:30:00.000000000', '2018-01-18T12:30:00.000000000', '2018-01-18T13:30:00.000000000', '2018-01-18T14:30:00.000000000', '2018-01-18T15:30:00.000000000', '2018-01-18T16:30:00.000000000', '2018-01-18T17:30:00.000000000', '2018-01-18T18:30:00.000000000', '2018-01-18T19:30:00.000000000', '2018-01-18T20:30:00.000000000', '2018-01-18T21:30:00.000000000', '2018-01-18T22:30:00.000000000', '2018-01-18T23:30:00.000000000', '2018-01-19T00:30:00.000000000', '2018-01-19T01:30:00.000000000', '2018-01-19T02:30:00.000000000', '2018-01-19T03:30:00.000000000', '2018-01-19T04:30:00.000000000', '2018-01-19T05:30:00.000000000', '2018-01-19T06:30:00.000000000', '2018-01-19T07:30:00.000000000', '2018-01-19T08:30:00.000000000', '2018-01-19T09:30:00.000000000', '2018-01-19T10:30:00.000000000', '2018-01-19T11:30:00.000000000', '2018-01-19T12:30:00.000000000', '2018-01-19T13:30:00.000000000', '2018-01-19T14:30:00.000000000', '2018-01-19T15:30:00.000000000', '2018-01-19T16:30:00.000000000', '2018-01-19T17:30:00.000000000', '2018-01-19T18:30:00.000000000', '2018-01-19T19:30:00.000000000', '2018-01-19T20:30:00.000000000', '2018-01-19T21:30:00.000000000', '2018-01-19T22:30:00.000000000', '2018-01-19T23:30:00.000000000', '2018-01-20T00:30:00.000000000', '2018-01-20T01:30:00.000000000', '2018-01-20T02:30:00.000000000', '2018-01-20T03:30:00.000000000', '2018-01-20T04:30:00.000000000', '2018-01-20T05:30:00.000000000', '2018-01-20T06:30:00.000000000', '2018-01-20T07:30:00.000000000', '2018-01-20T08:30:00.000000000', '2018-01-20T09:30:00.000000000', '2018-01-20T10:30:00.000000000', '2018-01-20T11:30:00.000000000', '2018-01-20T12:30:00.000000000', '2018-01-20T13:30:00.000000000', '2018-01-20T14:30:00.000000000', '2018-01-20T15:30:00.000000000', '2018-01-20T16:30:00.000000000', '2018-01-20T17:30:00.000000000', '2018-01-20T18:30:00.000000000', '2018-01-20T19:30:00.000000000', '2018-01-20T20:30:00.000000000', '2018-01-20T21:30:00.000000000', '2018-01-20T22:30:00.000000000', '2018-01-20T23:30:00.000000000', '2018-01-21T00:30:00.000000000', '2018-01-21T01:30:00.000000000', '2018-01-21T02:30:00.000000000', '2018-01-21T03:30:00.000000000', '2018-01-21T04:30:00.000000000', '2018-01-21T05:30:00.000000000', '2018-01-21T06:30:00.000000000', '2018-01-21T07:30:00.000000000', '2018-01-21T08:30:00.000000000', '2018-01-21T09:30:00.000000000', '2018-01-21T10:30:00.000000000', '2018-01-21T11:30:00.000000000', '2018-01-21T12:30:00.000000000', '2018-01-21T13:30:00.000000000', '2018-01-21T14:30:00.000000000', '2018-01-21T15:30:00.000000000', '2018-01-21T16:30:00.000000000', '2018-01-21T17:30:00.000000000', '2018-01-21T18:30:00.000000000', '2018-01-21T19:30:00.000000000', '2018-01-21T20:30:00.000000000', '2018-01-21T21:30:00.000000000', '2018-01-21T22:30:00.000000000', '2018-01-21T23:30:00.000000000', '2018-01-22T00:30:00.000000000', '2018-01-22T01:30:00.000000000', '2018-01-22T02:30:00.000000000', '2018-01-22T03:30:00.000000000', '2018-01-22T04:30:00.000000000', '2018-01-22T05:30:00.000000000', '2018-01-22T06:30:00.000000000', '2018-01-22T07:30:00.000000000', '2018-01-22T08:30:00.000000000', '2018-01-22T09:30:00.000000000', '2018-01-22T10:30:00.000000000', '2018-01-22T11:30:00.000000000', '2018-01-22T12:30:00.000000000', '2018-01-22T13:30:00.000000000', '2018-01-22T14:30:00.000000000', '2018-01-22T15:30:00.000000000', '2018-01-22T16:30:00.000000000', '2018-01-22T17:30:00.000000000', '2018-01-22T18:30:00.000000000', '2018-01-22T19:30:00.000000000', '2018-01-22T20:30:00.000000000', '2018-01-22T21:30:00.000000000', '2018-01-22T22:30:00.000000000'], dtype='datetime64[ns]')
array(['2018-01-15T00:30:00.000000000', '2018-01-15T01:30:00.000000000', '2018-01-15T02:30:00.000000000', '2018-01-15T03:30:00.000000000', '2018-01-15T04:30:00.000000000', '2018-01-15T05:30:00.000000000', '2018-01-15T06:30:00.000000000', '2018-01-15T07:30:00.000000000', '2018-01-15T08:30:00.000000000', '2018-01-15T09:30:00.000000000', '2018-01-15T10:30:00.000000000', '2018-01-15T11:30:00.000000000', '2018-01-15T12:30:00.000000000', '2018-01-15T13:30:00.000000000', '2018-01-15T14:30:00.000000000', '2018-01-15T15:30:00.000000000', '2018-01-15T16:30:00.000000000', '2018-01-15T17:30:00.000000000', '2018-01-15T18:30:00.000000000', '2018-01-15T19:30:00.000000000', '2018-01-15T20:30:00.000000000', '2018-01-15T21:30:00.000000000', '2018-01-15T22:30:00.000000000', '2018-01-15T23:30:00.000000000', '2018-01-16T00:30:00.000000000', '2018-01-16T01:30:00.000000000', '2018-01-16T02:30:00.000000000', '2018-01-16T03:30:00.000000000', '2018-01-16T04:30:00.000000000', '2018-01-16T05:30:00.000000000', '2018-01-16T06:30:00.000000000', '2018-01-16T07:30:00.000000000', '2018-01-16T08:30:00.000000000', '2018-01-16T09:30:00.000000000', '2018-01-16T10:30:00.000000000', '2018-01-16T11:30:00.000000000', '2018-01-16T12:30:00.000000000', '2018-01-16T13:30:00.000000000', '2018-01-16T14:30:00.000000000', '2018-01-16T15:30:00.000000000', '2018-01-16T16:30:00.000000000', '2018-01-16T17:30:00.000000000', '2018-01-16T18:30:00.000000000', '2018-01-16T19:30:00.000000000', '2018-01-16T20:30:00.000000000', '2018-01-16T21:30:00.000000000', '2018-01-16T22:30:00.000000000', '2018-01-16T23:30:00.000000000', '2018-01-17T00:30:00.000000000', '2018-01-17T01:30:00.000000000', '2018-01-17T02:30:00.000000000', '2018-01-17T03:30:00.000000000', '2018-01-17T04:30:00.000000000', '2018-01-17T05:30:00.000000000', '2018-01-17T06:30:00.000000000', '2018-01-17T07:30:00.000000000', '2018-01-17T08:30:00.000000000', '2018-01-17T09:30:00.000000000', '2018-01-17T10:30:00.000000000', '2018-01-17T11:30:00.000000000', '2018-01-17T12:30:00.000000000', '2018-01-17T13:30:00.000000000', '2018-01-17T14:30:00.000000000', '2018-01-17T15:30:00.000000000', '2018-01-17T16:30:00.000000000', '2018-01-17T17:30:00.000000000', '2018-01-17T18:30:00.000000000', '2018-01-17T19:30:00.000000000', '2018-01-17T20:30:00.000000000', '2018-01-17T21:30:00.000000000', '2018-01-17T22:30:00.000000000', '2018-01-17T23:30:00.000000000', '2018-01-18T00:30:00.000000000', '2018-01-18T01:30:00.000000000', '2018-01-18T02:30:00.000000000', '2018-01-18T03:30:00.000000000', '2018-01-18T04:30:00.000000000', '2018-01-18T05:30:00.000000000', '2018-01-18T06:30:00.000000000', '2018-01-18T07:30:00.000000000', '2018-01-18T08:30:00.000000000', '2018-01-18T09:30:00.000000000', '2018-01-18T10:30:00.000000000', '2018-01-18T11:30:00.000000000', '2018-01-18T12:30:00.000000000', '2018-01-18T13:30:00.000000000', '2018-01-18T14:30:00.000000000', '2018-01-18T15:30:00.000000000', '2018-01-18T16:30:00.000000000', '2018-01-18T17:30:00.000000000', '2018-01-18T18:30:00.000000000', '2018-01-18T19:30:00.000000000', '2018-01-18T20:30:00.000000000', '2018-01-18T21:30:00.000000000', '2018-01-18T22:30:00.000000000', '2018-01-18T23:30:00.000000000', '2018-01-19T00:30:00.000000000', '2018-01-19T01:30:00.000000000', '2018-01-19T02:30:00.000000000', '2018-01-19T03:30:00.000000000', '2018-01-19T04:30:00.000000000', '2018-01-19T05:30:00.000000000', '2018-01-19T06:30:00.000000000', '2018-01-19T07:30:00.000000000', '2018-01-19T08:30:00.000000000', '2018-01-19T09:30:00.000000000', '2018-01-19T10:30:00.000000000', '2018-01-19T11:30:00.000000000', '2018-01-19T12:30:00.000000000', '2018-01-19T13:30:00.000000000', '2018-01-19T14:30:00.000000000', '2018-01-19T15:30:00.000000000', '2018-01-19T16:30:00.000000000', '2018-01-19T17:30:00.000000000', '2018-01-19T18:30:00.000000000', '2018-01-19T19:30:00.000000000', '2018-01-19T20:30:00.000000000', '2018-01-19T21:30:00.000000000', '2018-01-19T22:30:00.000000000', '2018-01-19T23:30:00.000000000', '2018-01-20T00:30:00.000000000', '2018-01-20T01:30:00.000000000', '2018-01-20T02:30:00.000000000', '2018-01-20T03:30:00.000000000', '2018-01-20T04:30:00.000000000', '2018-01-20T05:30:00.000000000', '2018-01-20T06:30:00.000000000', '2018-01-20T07:30:00.000000000', '2018-01-20T08:30:00.000000000', '2018-01-20T09:30:00.000000000', '2018-01-20T10:30:00.000000000', '2018-01-20T11:30:00.000000000', '2018-01-20T12:30:00.000000000', '2018-01-20T13:30:00.000000000', '2018-01-20T14:30:00.000000000', '2018-01-20T15:30:00.000000000', '2018-01-20T16:30:00.000000000', '2018-01-20T17:30:00.000000000', '2018-01-20T18:30:00.000000000', '2018-01-20T19:30:00.000000000', '2018-01-20T20:30:00.000000000', '2018-01-20T21:30:00.000000000', '2018-01-20T22:30:00.000000000', '2018-01-20T23:30:00.000000000', '2018-01-21T00:30:00.000000000', '2018-01-21T01:30:00.000000000', '2018-01-21T02:30:00.000000000', '2018-01-21T03:30:00.000000000', '2018-01-21T04:30:00.000000000', '2018-01-21T05:30:00.000000000', '2018-01-21T06:30:00.000000000', '2018-01-21T07:30:00.000000000', '2018-01-21T08:30:00.000000000', '2018-01-21T09:30:00.000000000', '2018-01-21T10:30:00.000000000', '2018-01-21T11:30:00.000000000', '2018-01-21T12:30:00.000000000', '2018-01-21T13:30:00.000000000', '2018-01-21T14:30:00.000000000', '2018-01-21T15:30:00.000000000', '2018-01-21T16:30:00.000000000', '2018-01-21T17:30:00.000000000', '2018-01-21T18:30:00.000000000', '2018-01-21T19:30:00.000000000', '2018-01-21T20:30:00.000000000', '2018-01-21T21:30:00.000000000', '2018-01-21T22:30:00.000000000', '2018-01-21T23:30:00.000000000', '2018-01-22T00:30:00.000000000', '2018-01-22T01:30:00.000000000', '2018-01-22T02:30:00.000000000', '2018-01-22T03:30:00.000000000', '2018-01-22T04:30:00.000000000', '2018-01-22T05:30:00.000000000', '2018-01-22T06:30:00.000000000', '2018-01-22T07:30:00.000000000', '2018-01-22T08:30:00.000000000', '2018-01-22T09:30:00.000000000', '2018-01-22T10:30:00.000000000', '2018-01-22T11:30:00.000000000', '2018-01-22T12:30:00.000000000', '2018-01-22T13:30:00.000000000', '2018-01-22T14:30:00.000000000', '2018-01-22T15:30:00.000000000', '2018-01-22T16:30:00.000000000', '2018-01-22T17:30:00.000000000', '2018-01-22T18:30:00.000000000', '2018-01-22T19:30:00.000000000', '2018-01-22T20:30:00.000000000', '2018-01-22T21:30:00.000000000', '2018-01-22T22:30:00.000000000'], dtype='datetime64[ns]')
watercolour = 'lightskyblue'
landcolour = 'papayawhip'
waterland_cmap = mplcolours.LinearSegmentedColormap.from_list('mycmap', [(0, watercolour), (0.85, watercolour),
(0.850001, landcolour), (1, landcolour)])
xs = range(jmin, jmax)
ys = range(imin, imax)
xx, yy = np.meshgrid(xs, ys)
mymask = oilLag.Beaching_Time[imin:imax, jmin:jmax] == oilLag.Beaching_Time[imin:imax, jmin:jmax].min()
days = np.ma.array(bt/1e9/86400., mask=mymask)
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-f7aa77bd24c7> in <module> 1 watercolour = 'lightskyblue' 2 landcolour = 'papayawhip' ----> 3 waterland_cmap = mplcolours.LinearSegmentedColormap.from_list('mycmap', [(0, watercolour), (0.85, watercolour), 4 (0.850001, landcolour), (1, landcolour)]) 5 xs = range(jmin, jmax) NameError: name 'mplcolours' is not defined
cnorm = mplcolours.Normalize(vmin=0, vmax=7)
mycmap = mpl.cm.copper
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
ax.set_aspect(500/440.)
ax.tick_params(axis='both', which='both', bottom=False, left=False, labelbottom=False, labelleft=False)
ax.pcolormesh(1-mesh.tmask[0, 0, imin:imax, jmin:jmax], cmap=waterland_cmap)
ax.scatter(xx-jmin, yy-imin, s=10, c=days, cmap='copper', vmin=0, vmax=7);
ax_cbar = fig.add_axes([0.9, 0.12, 0.05, 0.76])
cb = colorbar.ColorbarBase(ax=ax_cbar, cmap=mycmap, norm=cnorm);
cb.set_label('Days to Beaching')
fig.suptitle('10,000,000 $\ell$ Oil Spilled on Jan 15, 2018 at Salmon Bank');
fig, axs = plt.subplots(2, 2, figsize=(15, 15))
imin, imax = 250, 350
jmin, jmax = 150, 250
np.log(diesel1000.Beaching_Volume[imin:imax , jmin:jmax]).plot(ax=axs[0,0], cmap='copper_r',
vmax=3, vmin=-1);
for i in range(imin, imax):
for j in range (jmin, jmax):
if diesel1000.Beaching_Volume[i , j] > 0:
print (i, j, diesel1000.Beaching_Volume[i, j], diesel1000.Beaching_Time[i, j])
222*850