In [1]:
%matplotlib inline
import os
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import flopy
print(sys.version)
print('numpy version: {}'.format(np.__version__))
print('matplotlib version: {}'.format(mpl.__version__))
print('flopy version: {}'.format(flopy.__version__))
In [2]:
workspace = os.path.join('..', 'data', 'mfgrd_test')
In [3]:
fn = os.path.join(workspace, 'nwtp3.dis.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
sr = grd.get_spatialreference()
extents = sr.get_extent()
vertc = grd.get_centroids()
print(vertc[0, :])
In [4]:
print(len(iverts))
print(iverts[0])
print(verts.shape)
print(verts[0:5,:])
print(sr.get_extent())
In [5]:
fn = os.path.join(workspace, 'nwtp3.hds.cmp')
ho = flopy.utils.HeadFile(fn)
times = ho.get_times()
print(times)
h = ho.get_data(totim=times[-1]).reshape(80*80)
print(h.shape)
In [6]:
mm = flopy.plot.ModelMap(sr=sr, layer=0)
ax = plt.gca()
ax.set_xlim(extents[:2])
ax.set_ylim(extents[2:])
mm.plot_cvfd(verts, iverts, a=h)
cs = mm.contour_array_cvfd(vertc, h, colors='white')
plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11);
In [7]:
fn = os.path.join(workspace, 'uzfp3_lakmvr_v2.dis.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
sr = grd.get_spatialreference()
extents = sr.get_extent()
vertc = grd.get_centroids()
In [8]:
fn = os.path.join(workspace, 'uzfp3_lakmvr.hds.cmp')
ho = flopy.utils.HeadFile(fn)
times = ho.get_times()
print(times)
h = ho.get_data(totim=times[-1]).reshape(2*15*10)
print(h.shape)
print(vertc.shape)
In [9]:
mm = flopy.plot.ModelMap(sr=sr, layer=0)
ax = plt.gca()
ax.set_xlim(extents[:2])
ax.set_ylim(extents[2:])
v = mm.plot_cvfd(verts, iverts, a=h, ncpl=150, masked_values=[6999.], cmap='viridis')
cs = mm.contour_array_cvfd(vertc, h, ncpl=150, masked_values=[6999.],
levels=[1024], colors='white')
plt.clabel(cs, fmt='%.0f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[9]:
In [10]:
vertc = grd.get_centroids()
mm = flopy.plot.ModelMap(sr=sr, layer=1)
ax = plt.gca()
ax.set_xlim(extents[:2])
ax.set_ylim(extents[2:])
v = mm.plot_cvfd(verts, iverts, a=h, ncpl=150, masked_values=[6999.], cmap='viridis')
cs = mm.contour_array_cvfd(vertc, h, ncpl=150, masked_values=[6999.],
levels=[1020, 1021, 1022, 1023, 1024, 1025, 1026], colors='white')
plt.clabel(cs, fmt='%.0f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[10]:
In [11]:
fn = os.path.join(workspace, 'flow.disv.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
vertc = grd.get_centroids()
xc = vertc[:, 0]
yc = vertc[:, 1]
sr = flopy.utils.reference.SpatialReferenceUnstructured(xc, yc, verts, iverts, [xc.shape[0]])
In [12]:
fn = os.path.join(workspace, 'flow.hds.cmp')
ho = flopy.utils.HeadFile(fn)
times = ho.get_times()
print(times)
h = ho.get_data(totim=times[-1]).reshape(218)
print(h.shape)
In [13]:
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=h)
cs = mm.contour_array_cvfd(vertc, h, colors='white')
plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[13]:
In [14]:
fn = os.path.join(workspace, 'flowxt3d.disv.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
vertc = grd.get_centroids()
xc = vertc[:, 0]
yc = vertc[:, 1]
sr = flopy.utils.reference.SpatialReferenceUnstructured(xc, yc, verts, iverts, [xc.shape[0]])
In [15]:
fn = os.path.join(workspace, 'flowxt3d.hds.cmp')
ho = flopy.utils.HeadFile(fn, precision='double')
times = ho.get_times()
print(times)
h = ho.get_data(totim=times[-1]).reshape(218)
print(h.shape)
In [16]:
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=h)
cs = mm.contour_array_cvfd(vertc, h, colors='white')
plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[16]:
In [17]:
fn = os.path.join(workspace, 'flowwel.disv.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
vertc = grd.get_centroids()
xc = vertc[:, 0]
yc = vertc[:, 1]
sr = flopy.utils.reference.SpatialReferenceUnstructured(xc, yc, verts, iverts, [xc.shape[0]])
In [18]:
fn = os.path.join(workspace, 'flowwel.hds.cmp')
ho = flopy.utils.HeadFile(fn, precision='double')
times = ho.get_times()
print(times)
h = ho.get_data(totim=times[-1]).reshape(218)
print(h.shape)
In [19]:
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=h)
cs = mm.contour_array_cvfd(vertc, h, colors='white')
plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[19]:
In [20]:
fn = os.path.join(workspace, 'flowwelxt3d.disv.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
vertc = grd.get_centroids()
xc = vertc[:, 0]
yc = vertc[:, 1]
sr = flopy.utils.reference.SpatialReferenceUnstructured(xc, yc, verts, iverts, [xc.shape[0]])
In [21]:
fn = os.path.join(workspace, 'flowwelxt3d.hds.cmp')
ho = flopy.utils.HeadFile(fn, precision='double')
times = ho.get_times()
print(times)
h2 = ho.get_data(totim=times[-1]).reshape(218)
print(h2.shape)
In [22]:
#f = plt.gcf()
#f.set_size_inches(15, 15)
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=h2, cmap='jet_r')
cs = mm.contour_array_cvfd(vertc, h2, colors='white', linewidths=2)
cs = mm.contour_array_cvfd(vertc, h, linestyles='dashed', colors='cyan', linewidths=2)
plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[22]:
In [23]:
d = h - h2
#f = plt.gcf()
#f.set_size_inches(15, 15)
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=d, cmap='jet_r')
#cs = mm.contour_array_cvfd(vertc, d, colors='white')
#plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[23]:
In [24]:
fn = os.path.join(workspace, 'flowquadwel.disv.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
vertc = grd.get_centroids()
xc = vertc[:, 0]
yc = vertc[:, 1]
sr = flopy.utils.reference.SpatialReferenceUnstructured(xc, yc, verts, iverts, [xc.shape[0]])
In [25]:
fn = os.path.join(workspace, 'flowquadwel.hds.cmp')
ho = flopy.utils.HeadFile(fn, precision='double')
times = ho.get_times()
print(times)
h = ho.get_data(totim=times[-1]).flatten()
print(h.shape)
In [26]:
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=h)
cs = mm.contour_array_cvfd(vertc, h, colors='white')
plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[26]:
In [27]:
fn = os.path.join(workspace, 'flowquadwelxt3d.disv.grb')
grd = flopy.utils.MfGrdFile(fn, verbose=True)
iverts, verts = grd.get_verts()
vertc = grd.get_centroids()
xc = vertc[:, 0]
yc = vertc[:, 1]
sr = flopy.utils.reference.SpatialReferenceUnstructured(xc, yc, verts, iverts, [xc.shape[0]])
In [28]:
fn = os.path.join(workspace, 'flowquadwelxt3d.hds.cmp')
ho = flopy.utils.HeadFile(fn, precision='double')
times = ho.get_times()
print(times)
h2 = ho.get_data(totim=times[-1]).flatten()
print(h2.shape)
In [29]:
#f = plt.gcf()
#f.set_size_inches(10,10)
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=h2)
cs = mm.contour_array_cvfd(vertc, h2, colors='white')
plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
cs = mm.contour_array_cvfd(vertc, h, linestyles='dashed', colors='cyan', linewidths=2)
plt.colorbar(v, shrink=0.5)
Out[29]:
In [30]:
d = h - h2
#f = plt.gcf()
#f.set_size_inches(15, 15)
mm = flopy.plot.ModelMap(sr=sr)
ax = plt.gca()
ax.set_xlim(0,700)
ax.set_ylim(0,700)
v = mm.plot_cvfd(verts, iverts, edgecolor='black', a=d, cmap='jet_r')
#cs = mm.contour_array_cvfd(vertc, d, colors='white')
#plt.clabel(cs, fmt='%.1f', colors='white', fontsize=11)
plt.colorbar(v, shrink=0.5)
Out[30]:
In [ ]: