flopy 3.2.1__zip → 3.2.2__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. {flopy-3.2.1 → flopy-3.2.2}/PKG-INFO +47 -11
  2. {flopy-3.2.1 → flopy-3.2.2}/flopy/mbase.py +307 -17
  3. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mf.py +8 -6
  4. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfbcf.py +2 -2
  5. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfchd.py +1 -1
  6. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfde4.py +2 -2
  7. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfdis.py +11 -94
  8. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfdrn.py +1 -1
  9. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfevt.py +3 -3
  10. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfghb.py +2 -2
  11. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfgmg.py +60 -19
  12. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfhfb.py +7 -7
  13. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mflpf.py +13 -10
  14. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmlt.py +3 -3
  15. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfnwt.py +1 -1
  16. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfoc.py +26 -20
  17. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfoc88.py +9 -9
  18. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpar.py +15 -9
  19. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfparbc.py +7 -7
  20. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpcg.py +2 -2
  21. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpcgn.py +3 -3
  22. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpks.py +1 -1
  23. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfrch.py +4 -4
  24. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfriv.py +6 -4
  25. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfsip.py +2 -2
  26. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfsor.py +3 -3
  27. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfswi2.py +34 -34
  28. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfswr1.py +4 -4
  29. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfupw.py +4 -4
  30. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfuzf1.py +5 -5
  31. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfwel.py +1 -2
  32. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfzon.py +2 -2
  33. {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/mp.py +7 -5
  34. {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/mpbas.py +1 -1
  35. {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/mpsim.py +18 -16
  36. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mt.py +1 -1
  37. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtbtn.py +3 -3
  38. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtssm.py +7 -6
  39. {flopy-3.2.1 → flopy-3.2.2}/flopy/plot/__init__.py +1 -1
  40. {flopy-3.2.1 → flopy-3.2.2}/flopy/plot/crosssection.py +73 -103
  41. flopy-3.2.2/flopy/plot/map.py +647 -0
  42. flopy-3.2.2/flopy/plot/plotutil.py +1205 -0
  43. {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/__init__.py +3 -1
  44. {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/binaryfile.py +91 -364
  45. {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/binaryhydmodfile.py +3 -3
  46. {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/binaryswrfile.py +21 -21
  47. flopy-3.2.2/flopy/utils/datafile.py +476 -0
  48. flopy-3.2.2/flopy/utils/flopy_io.py +128 -0
  49. flopy-3.2.2/flopy/utils/formattedfile.py +366 -0
  50. flopy-3.2.2/flopy/utils/modpathfile.py +421 -0
  51. flopy-3.2.2/flopy/utils/reference.py +386 -0
  52. {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/util_array.py +512 -83
  53. {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/util_list.py +234 -13
  54. flopy-3.2.2/flopy/version.py +4 -0
  55. {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/PKG-INFO +47 -11
  56. {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/SOURCES.txt +5 -0
  57. {flopy-3.2.1 → flopy-3.2.2}/setup.py +2 -6
  58. flopy-3.2.1/flopy/plot/map.py +0 -592
  59. flopy-3.2.1/flopy/plot/plotutil.py +0 -512
  60. flopy-3.2.1/flopy/version.py +0 -4
  61. flopy-3.2.1/requirements.txt +0 -2
  62. {flopy-3.2.1 → flopy-3.2.2}/flopy/__init__.py +0 -0
  63. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/__init__.py +0 -0
  64. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfaddoutsidefile.py +0 -0
  65. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfbas.py +0 -0
  66. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfbct.py +0 -0
  67. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mflmt.py +0 -0
  68. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmnw1.py +0 -0
  69. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmnw2.py +0 -0
  70. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmnwi.py +0 -0
  71. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpbc.py +0 -0
  72. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpval.py +0 -0
  73. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfsms.py +0 -0
  74. {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfswi.py +0 -0
  75. {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/__init__.py +0 -0
  76. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/__init__.py +0 -0
  77. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtadv.py +0 -0
  78. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtdsp.py +0 -0
  79. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtgcg.py +0 -0
  80. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtphc.py +0 -0
  81. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtrct.py +0 -0
  82. {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mttob.py +0 -0
  83. {flopy-3.2.1 → flopy-3.2.2}/flopy/seawat/__init__.py +0 -0
  84. {flopy-3.2.1 → flopy-3.2.2}/flopy/seawat/swt.py +0 -0
  85. {flopy-3.2.1 → flopy-3.2.2}/flopy/seawat/swtvdf.py +0 -0
  86. {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/mfreadnam.py +0 -0
  87. {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/dependency_links.txt +0 -0
  88. {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/requires.txt +0 -0
  89. {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/top_level.txt +0 -0
  90. {flopy-3.2.1 → flopy-3.2.2}/setup.cfg +0 -0
@@ -0,0 +1,1205 @@
1
+ """
2
+ Module containing helper functions for plotting model data
3
+ using ModelMap and ModelCrossSection. Functions for plotting
4
+ shapefiles are also included.
5
+ """
6
+ from __future__ import print_function
7
+ import os
8
+ import sys
9
+ import math
10
+ import numpy as np
11
+ from matplotlib.colors import LinearSegmentedColormap
12
+
13
+
14
+ bc_color_dict = {'default': 'black', 'WEL': 'red', 'DRN': 'yellow',
15
+ 'RIV': 'green', 'GHB': 'cyan', 'CHD': 'navy'}
16
+
17
+
18
+ def _plot_array_helper(plotarray, model=None, sr=None, axes=None,
19
+ names=None, filenames=None, fignum=None,
20
+ mflay=None, **kwargs):
21
+ try:
22
+ import matplotlib.pyplot as plt
23
+ except:
24
+ s = 'Could not import matplotlib. Must install matplotlib ' +\
25
+ ' in order to plot LayerFile data.'
26
+ raise Exception(s)
27
+
28
+ import flopy.plot.map as map
29
+
30
+
31
+ # reshape 2d arrays to 3d for convenience
32
+ if len(plotarray.shape) == 2:
33
+ plotarray = plotarray.reshape((1, plotarray.shape[0],
34
+ plotarray.shape[1]))
35
+
36
+ # parse keyword arguments
37
+ if 'figsize' in kwargs:
38
+ figsize = kwargs.pop('figsize')
39
+ else:
40
+ figsize = None
41
+
42
+ if 'masked_values' in kwargs:
43
+ masked_values = kwargs.pop('masked_values')
44
+ else:
45
+ masked_values = None
46
+
47
+ if 'pcolor' in kwargs:
48
+ pcolor = kwargs.pop('pcolor')
49
+ else:
50
+ pcolor = True
51
+
52
+ if 'inactive' in kwargs:
53
+ inactive = kwargs.pop('inactive')
54
+ else:
55
+ inactive = True
56
+
57
+ if 'contour' in kwargs:
58
+ contourdata = kwargs.pop('contour')
59
+ else:
60
+ contourdata = False
61
+
62
+ if 'clabel' in kwargs:
63
+ clabel = kwargs.pop('clabel')
64
+ else:
65
+ clabel = False
66
+
67
+ if 'colorbar' in kwargs:
68
+ cb = kwargs.pop('colorbar')
69
+ else:
70
+ cb = False
71
+
72
+ if 'grid' in kwargs:
73
+ grid = kwargs.pop('grid')
74
+ else:
75
+ grid = False
76
+
77
+ if 'levels' in kwargs:
78
+ levels = kwargs.pop('levels')
79
+ else:
80
+ levels = None
81
+
82
+ if 'colors' in kwargs:
83
+ colors = kwargs.pop('colors')
84
+ else:
85
+ colors = 'black'
86
+
87
+ if 'dpi' in kwargs:
88
+ dpi = kwargs.pop('dpi')
89
+ else:
90
+ dpi = None
91
+
92
+ if 'fmt' in kwargs:
93
+ fmt = kwargs.pop('fmt')
94
+ else:
95
+ fmt = '%1.3f'
96
+
97
+ if mflay is not None:
98
+ i0 = int(mflay)
99
+ if i0+1 >= plotarray.shape[0]:
100
+ i0 = plotarray.shape[0] - 1
101
+ i1 = i0 + 1
102
+ else:
103
+ i0 = 0
104
+ i1 = plotarray.shape[0]
105
+
106
+ if names is not None:
107
+ if not isinstance(names, list):
108
+ names = [names]
109
+ assert len(names) == plotarray.shape[0]
110
+
111
+ if filenames is not None:
112
+ if not isinstance(filenames, list):
113
+ filenames = [filenames]
114
+ assert len(filenames) == (i1 - i0)
115
+
116
+ if fignum is not None:
117
+ if not isinstance(fignum, list):
118
+ fignum = [fignum]
119
+ assert len(fignum) == (i1 - i0)
120
+ # check for existing figures
121
+ f0 = fignum[0]
122
+ for i in plt.get_fignums():
123
+ if i >= f0:
124
+ f0 = i + 1
125
+ finc = f0 - fignum[0]
126
+ for idx in range(len(fignum)):
127
+ fignum[idx] += finc
128
+ else:
129
+ #fignum = np.arange(i0, i1)
130
+ # check for existing figures
131
+ f0 = 0
132
+ for i in plt.get_fignums():
133
+ if i >= f0:
134
+ f0 += 1
135
+ f1 = f0 + (i1 - i0)
136
+ fignum = np.arange(f0, f1)
137
+
138
+
139
+ if axes is not None:
140
+ if not isinstance(axes, list):
141
+ axes = [axes]
142
+ assert len(axes) == plotarray.shape[0]
143
+ # prepare some axis objects for use
144
+ else:
145
+ axes = []
146
+ for idx, k in enumerate(range(i0, i1)):
147
+ fig = plt.figure(figsize=figsize, num=fignum[idx])
148
+ ax = plt.subplot(1, 1, 1, aspect='equal')
149
+ if names is not None:
150
+ title = names[k]
151
+ else:
152
+ klay = k
153
+ if mflay is not None:
154
+ klay = int(mflay)
155
+ title = '{} Layer {}'.format('data', klay+1)
156
+ ax.set_title(title)
157
+ axes.append(ax)
158
+
159
+ for idx, k in enumerate(range(i0, i1)):
160
+ fig = plt.figure(num=fignum[idx])
161
+ mm = map.ModelMap(ax=axes[idx], model=model, sr=sr, layer=k)
162
+ if pcolor:
163
+ cm = mm.plot_array(plotarray[k], masked_values=masked_values,
164
+ ax=axes[idx], **kwargs)
165
+ if cb:
166
+ plt.colorbar(cm, ax=axes[idx], shrink=0.5)
167
+
168
+ if contourdata:
169
+ cl = mm.contour_array(plotarray[k], masked_values=masked_values,
170
+ ax=axes[idx], colors=colors, levels=levels, **kwargs)
171
+ if clabel:
172
+ axes[idx].clabel(cl, fmt=fmt,**kwargs)
173
+
174
+ if grid:
175
+ mm.plot_grid(ax=axes[idx])
176
+
177
+ if inactive:
178
+ try:
179
+ ib = model.bas6.getibound()
180
+ mm.plot_inactive(ibound=ib, ax=axes[idx])
181
+ except:
182
+ pass
183
+
184
+ if len(axes) == 1:
185
+ axes = axes[0]
186
+ if filenames is not None:
187
+ for idx, k in enumerate(range(i0, i1)):
188
+ fig = plt.figure(num=fignum[idx])
189
+ fig.savefig(filenames[idx], dpi=dpi)
190
+ print(' created...{}'.format(os.path.basename(filenames[idx])))
191
+ # there will be nothing to return when done
192
+ axes = None
193
+ plt.close('all')
194
+ return axes
195
+
196
+
197
+ def _plot_bc_helper(package, kper,
198
+ axes=None, names=None, filenames=None, fignum=None,
199
+ mflay=None, **kwargs):
200
+ try:
201
+ import matplotlib.pyplot as plt
202
+ except:
203
+ s = 'Could not import matplotlib. Must install matplotlib ' +\
204
+ ' in order to plot boundary condition data.'
205
+ raise Exception(s)
206
+
207
+ import flopy.plot.map as map
208
+
209
+ # reshape 2d arrays to 3d for convenience
210
+ ftype = package.name[0]
211
+
212
+ nlay = package.parent.nlay
213
+
214
+ # parse keyword arguments
215
+ if 'figsize' in kwargs:
216
+ figsize = kwargs.pop('figsize')
217
+ else:
218
+ figsize = None
219
+
220
+ if 'inactive' in kwargs:
221
+ inactive = kwargs.pop('inactive')
222
+ else:
223
+ inactive = True
224
+
225
+ if 'grid' in kwargs:
226
+ grid = kwargs.pop('grid')
227
+ else:
228
+ grid = False
229
+
230
+ if 'dpi' in kwargs:
231
+ dpi = kwargs.pop('dpi')
232
+ else:
233
+ dpi = None
234
+
235
+ if 'masked_values' in kwargs:
236
+ kwargs.pop('masked_values ')
237
+
238
+ if mflay is not None:
239
+ i0 = int(mflay)
240
+ if i0+1 >= nlay:
241
+ i0 = nlay - 1
242
+ i1 = i0 + 1
243
+ else:
244
+ i0 = 0
245
+ i1 = nlay
246
+
247
+ if names is not None:
248
+ if not isinstance(names, list):
249
+ names = [names]
250
+ assert len(names) == nlay
251
+
252
+ if filenames is not None:
253
+ if not isinstance(filenames, list):
254
+ filenames = [filenames]
255
+ assert len(filenames) == (i1 - i0)
256
+
257
+ if fignum is not None:
258
+ if not isinstance(fignum, list):
259
+ fignum = [fignum]
260
+ assert len(fignum) == (i1 - i0)
261
+ # check for existing figures
262
+ f0 = fignum[0]
263
+ for i in plt.get_fignums():
264
+ if i >= f0:
265
+ f0 = i + 1
266
+ finc = f0 - fignum[0]
267
+ for idx in range(len(fignum)):
268
+ fignum[idx] += finc
269
+ else:
270
+ #fignum = np.arange(i0, i1)
271
+ # check for existing figures
272
+ f0 = 0
273
+ for i in plt.get_fignums():
274
+ if i >= f0:
275
+ f0 += 1
276
+ f1 = f0 + (i1 - i0)
277
+ fignum = np.arange(f0, f1)
278
+
279
+ if axes is not None:
280
+ if not isinstance(axes, list):
281
+ axes = [axes]
282
+ assert len(axes) == plotarray.shape[0]
283
+ # prepare some axis objects for use
284
+ else:
285
+ axes = []
286
+ for idx, k in enumerate(range(i0, i1)):
287
+ fig = plt.figure(figsize=figsize, num=fignum[idx])
288
+ ax = plt.subplot(1, 1, 1, aspect='equal')
289
+ if names is not None:
290
+ title = names[k]
291
+ else:
292
+ klay = k
293
+ if mflay is not None:
294
+ klay = int(mflay)
295
+ title = '{} Layer {}'.format('data', klay+1)
296
+ ax.set_title(title)
297
+ axes.append(ax)
298
+
299
+ for idx, k in enumerate(range(i0, i1)):
300
+ mm = map.ModelMap(ax=axes[idx], model=package.parent, layer=k)
301
+ fig = plt.figure(num=fignum[idx])
302
+ qm = mm.plot_bc(ftype=ftype, package=package, kper=kper, ax=axes[idx])
303
+
304
+ if grid:
305
+ mm.plot_grid(ax=axes[idx])
306
+
307
+ if inactive:
308
+ try:
309
+ ib = package.parent.bas6.getibound()
310
+ mm.plot_inactive(ibound=ib, ax=axes[idx])
311
+ except:
312
+ pass
313
+
314
+ if len(axes) == 1:
315
+ axes = axes[0]
316
+
317
+ if filenames is not None:
318
+ for idx, k in enumerate(range(i0, i1)):
319
+ fig = plt.figure(num=fignum[idx])
320
+ fig.savefig(filenames[idx], dpi=dpi)
321
+ plt.close(fignum[idx])
322
+ print(' created...{}'.format(os.path.basename(filenames[idx])))
323
+ # there will be nothing to return when done
324
+ axes = None
325
+ plt.close('all')
326
+ return axes
327
+
328
+
329
+ class SwiConcentration():
330
+ """
331
+ The binary_header class is a class to create headers for MODFLOW
332
+ binary files
333
+ """
334
+ def __init__(self, model=None, botm=None, istrat=1, nu=None):
335
+ if model is None:
336
+ if isinstance(botm, list):
337
+ botm = np.array(botm)
338
+ self.__botm = botm
339
+ if isinstance(nu, list):
340
+ nu = np.array(nu)
341
+ self.__nu = nu
342
+ self.__istrat = istrat
343
+ if istrat == 1:
344
+ self.__nsrf = self.nu.shape - 1
345
+ else:
346
+ self.__nsrf = self.nu.shape - 2
347
+ else:
348
+ try:
349
+ dis = model.get_package('DIS')
350
+ except:
351
+ sys.stdout.write('Error: DIS package not available.\n')
352
+ self.__botm = np.zeros((dis.nlay+1, dis.nrow, dis.ncol), np.float)
353
+ self.__botm[0, :, :] = dis.top.array
354
+ self.__botm[1:, :, :] = dis.botm.array
355
+ try:
356
+ swi = model.get_package('SWI2')
357
+ self.__nu = swi.nu.array
358
+ self.__istrat = swi.istrat
359
+ self.__nsrf = swi.nsrf
360
+ except:
361
+ sys.stdout.write('Error: SWI2 package not available...\n')
362
+ self.__nlay = self.__botm.shape[0] - 1
363
+ self.__nrow = self.__botm[0, :, :].shape[0]
364
+ self.__ncol = self.__botm[0, :, :].shape[1]
365
+ self.__b = self.__botm[0:-1, :, :] - self.__botm[1:, :, :]
366
+
367
+ def calc_conc(self, zeta, layer=None):
368
+ """
369
+ Calculate concentrations for a given time step using passed zeta.
370
+
371
+ Parameters
372
+ ----------
373
+ zeta : dictionary of numpy arrays
374
+ Dictionary of zeta results. zeta keys are zero-based zeta surfaces.
375
+ layer : int
376
+ Concentration will be calculated for the specified layer. If layer
377
+ is None, then the concentration will be calculated for all layers.
378
+ (default is None).
379
+
380
+ Returns
381
+ -------
382
+ conc : numpy array
383
+ Calculated concentration.
384
+
385
+ Examples
386
+ --------
387
+
388
+ >>> import flopy
389
+ >>> m = flopy.modflow.Modflow.load('test')
390
+ >>> c = flopy.plot.SwiConcentration(model=m)
391
+ >>> conc = c.calc_conc(z, layer=0)
392
+
393
+ """
394
+ conc = np.zeros((self.__nlay, self.__nrow, self.__ncol), np.float)
395
+
396
+ pct = {}
397
+ for isrf in range(self.__nsrf):
398
+ z = zeta[isrf]
399
+ pct[isrf] = (self.__botm[:-1, :, :] - z[:, :, :]) / self.__b[:, :, :]
400
+ for isrf in range(self.__nsrf):
401
+ p = pct[isrf]
402
+ if self.__istrat == 1:
403
+ conc[:, :, :] += self.__nu[isrf] * p[:, :, :]
404
+ if isrf+1 == self.__nsrf:
405
+ conc[:, :, :] += self.__nu[isrf+1] * (1. - p[:, :, :])
406
+ #TODO linear option
407
+ if layer is None:
408
+ return conc
409
+ else:
410
+ return conc[layer, :, :]
411
+
412
+ def shapefile_get_vertices(shp):
413
+ """
414
+ Get vertices for the features in a shapefile
415
+
416
+ Parameters
417
+ ----------
418
+ shp : string
419
+ Name of the shapefile to extract shapefile feature vertices.
420
+
421
+ Returns
422
+ -------
423
+ vertices : list
424
+ Vertices is a list with vertices for each feature in the shapefile.
425
+ Individual feature vertices are x, y tuples and contained in a list.
426
+ A list with a single x, y tuple is returned for point shapefiles. A
427
+ list with multiple x, y tuples is returned for polyline and polygon
428
+ shapefiles.
429
+
430
+ Examples
431
+ --------
432
+
433
+ >>> import flopy
434
+ >>> fshp = 'myshapefile'
435
+ >>> lines = flopy.plot.plotutil.shapefile_get_vertices(fshp)
436
+
437
+ """
438
+ try:
439
+ import shapefile
440
+ except:
441
+ s = 'Could not import shapefile. Must install pyshp in order to plot shapefiles.'
442
+ raise Exception(s)
443
+ sf = shapefile.Reader(shp)
444
+ shapes = sf.shapes()
445
+ nshp = len(shapes)
446
+ vertices = []
447
+ for n in range(nshp):
448
+ st = shapes[n].shapeType
449
+ if st in [1, 8, 11, 21]:
450
+ #points
451
+ for p in shapes[n].points:
452
+ vertices.append([(p[0], p[1])])
453
+ elif st in [3, 13, 23]:
454
+ #line
455
+ line = []
456
+ for p in shapes[n].points:
457
+ line.append((p[0], p[1]))
458
+ line = np.array(line)
459
+ vertices.append(line)
460
+ elif st in [5, 25, 31]:
461
+ #polygons
462
+ pts = np.array(shapes[n].points)
463
+ prt = shapes[n].parts
464
+ par = list(prt) + [pts.shape[0]]
465
+ for pij in range(len(prt)):
466
+ vertices.append(pts[par[pij]:par[pij+1]])
467
+ return vertices
468
+
469
+
470
+ def shapefile_to_patch_collection(shp, radius=500.):
471
+ """
472
+ Create a patch collection from the shapes in a shapefile
473
+
474
+ Parameters
475
+ ----------
476
+ shp : string
477
+ Name of the shapefile to convert to a PatchCollection.
478
+ radius : float
479
+ Radius of circle for points in the shapefile. (Default is 500.)
480
+
481
+ """
482
+ try:
483
+ import shapefile
484
+ except:
485
+ s = 'Could not import shapefile. Must install pyshp in order to plot shapefiles.'
486
+ raise Exception(s)
487
+ from matplotlib.patches import Polygon, Circle, Path, PathPatch
488
+ from matplotlib.collections import PatchCollection
489
+ sf = shapefile.Reader(shp)
490
+ shapes = sf.shapes()
491
+ nshp = len(shapes)
492
+ ptchs = []
493
+ for n in range(nshp):
494
+ st = shapes[n].shapeType
495
+ if st in [1, 8, 11, 21]:
496
+ #points
497
+ for p in shapes[n].points:
498
+ ptchs.append(Circle( (p[0], p[1]), radius=radius))
499
+ elif st in [3, 13, 23]:
500
+ #line
501
+ vertices = []
502
+ for p in shapes[n].points:
503
+ vertices.append([p[0], p[1]])
504
+ vertices = np.array(vertices)
505
+ path = Path(vertices)
506
+ ptchs.append(PathPatch(path, fill=False))
507
+ elif st in [5, 25, 31]:
508
+ #polygons
509
+ pts = np.array(shapes[n].points)
510
+ prt = shapes[n].parts
511
+ par = list(prt) + [pts.shape[0]]
512
+ for pij in range(len(prt)):
513
+ ptchs.append(Polygon(pts[par[pij]:par[pij+1]]))
514
+ pc = PatchCollection(ptchs)
515
+ return pc
516
+
517
+ def plot_shapefile(shp, ax=None, radius=500., cmap='Dark2',
518
+ edgecolor='scaled', facecolor='scaled', **kwargs):
519
+ """
520
+ Generic function for plotting a shapefile.
521
+
522
+ Parameters
523
+ ----------
524
+ shp : string
525
+ Name of the shapefile to plot.
526
+ radius : float
527
+ Radius of circle for points. (Default is 500.)
528
+ linewidth : float
529
+ Width of all lines. (default is 1)
530
+ cmap : string
531
+ Name of colormap to use for polygon shading (default is 'Dark2')
532
+ edgecolor : string
533
+ Color name. (Default is 'scaled' to scale the edge colors.)
534
+ facecolor : string
535
+ Color name. (Default is 'scaled' to scale the face colors.)
536
+ kwargs : dictionary
537
+ Keyword arguments that are passed to PatchCollection.set(**kwargs).
538
+ Some common kwargs would be 'linewidths', 'linestyles', 'alpha', etc.
539
+
540
+ Returns
541
+ -------
542
+ pc : matplotlib.collections.PatchCollection
543
+
544
+ Examples
545
+ --------
546
+
547
+ """
548
+
549
+ try:
550
+ import shapefile
551
+ except:
552
+ s = 'Could not import shapefile. Must install pyshp in order to plot shapefiles.'
553
+ raise Exception(s)
554
+ import numpy as np
555
+ import matplotlib.pyplot as plt
556
+
557
+ if ax is None:
558
+ ax = plt.gca()
559
+ cm = plt.get_cmap(cmap)
560
+ pc = shapefile_to_patch_collection(shp, radius=radius)
561
+ nshp = len(pc.get_paths())
562
+ cccol = cm(1. * np.arange(nshp) / nshp)
563
+ if facecolor == 'scaled':
564
+ pc.set_facecolor(cccol)
565
+ else:
566
+ pc.set_facecolor(facecolor)
567
+ if edgecolor == 'scaled':
568
+ pc.set_edgecolor(cccol)
569
+ else:
570
+ pc.set_edgecolor(edgecolor)
571
+ pc.set(**kwargs)
572
+ ax.add_collection(pc)
573
+ return pc
574
+
575
+ def saturated_thickness(head, top, botm, laytyp, mask_values=None):
576
+ """
577
+ Calculate the saturated thickness.
578
+
579
+ Parameters
580
+ ----------
581
+ head : numpy.ndarray
582
+ head array
583
+ top : numpy.ndarray
584
+ top array of shape (nrow, ncol)
585
+ botm : numpy.ndarray
586
+ botm array of shape (nlay, nrow, ncol)
587
+ laytyp : numpy.ndarray
588
+ confined (0) or convertible (1) of shape (nlay)
589
+ mask_values : list of floats
590
+ If head is one of these values, then set sat to top - bot
591
+
592
+ Returns
593
+ -------
594
+ sat_thk : numpy.ndarray
595
+ Saturated thickness of shape (nlay, nrow, ncol).
596
+
597
+ """
598
+ nlay, nrow, ncol = head.shape
599
+ sat_thk = np.empty(head.shape, dtype=head.dtype)
600
+ for k in range(nlay):
601
+ if k == 0:
602
+ t = top
603
+ else:
604
+ t = botm[k-1, :, :]
605
+ sat_thk[k, :, :] = t - botm[k, :, :]
606
+ for k in range(nlay):
607
+ if laytyp[k] != 0:
608
+ dh = np.zeros((nrow, ncol), dtype=head.dtype)
609
+ s = sat_thk[k, :, :]
610
+
611
+ for mv in mask_values:
612
+ idx = (head[k, :, :] == mv)
613
+ dh[idx] = s[idx]
614
+
615
+ if k == 0:
616
+ t = top
617
+ else:
618
+ t = botm[k-1, :, :]
619
+ t = np.where(head[k, :, :] > t, t, head[k, :, :])
620
+ dh = np.where(dh == 0, t - botm[k, :, :], dh)
621
+ sat_thk[k, :, :] = dh[:, :]
622
+ return sat_thk
623
+
624
+
625
+ def centered_specific_discharge(Qx, Qy, Qz, delr, delc, sat_thk):
626
+ """
627
+ Using the MODFLOW discharge, calculate the cell centered specific discharge
628
+ by dividing by the flow width and then averaging to the cell center.
629
+
630
+ Parameters
631
+ ----------
632
+ Qx : numpy.ndarray
633
+ MODFLOW 'flow right face'
634
+ Qy : numpy.ndarray
635
+ MODFLOW 'flow front face'. The sign on this array will be flipped
636
+ by this function so that the y axis is positive to north.
637
+ Qz : numpy.ndarray
638
+ MODFLOW 'flow lower face'. The sign on this array will be flipped by
639
+ this function so that the z axis is positive in the upward direction.
640
+ delr : numpy.ndarray
641
+ MODFLOW delr array
642
+ delc : numpy.ndarray
643
+ MODFLOW delc array
644
+ sat_thk : numpy.ndarray
645
+ Saturated thickness for each cell
646
+
647
+ Returns
648
+ -------
649
+ (qx, qy, qz) : tuple of numpy.ndarrays
650
+ Specific discharge arrays that have been interpolated to cell centers.
651
+
652
+ """
653
+ qx = None
654
+ qy = None
655
+ qz = None
656
+
657
+ if Qx is not None:
658
+
659
+ nlay, nrow, ncol = Qx.shape
660
+ qx = np.zeros(Qx.shape, dtype=Qx.dtype)
661
+
662
+ for k in range(nlay):
663
+ for j in range(ncol-1):
664
+ area = delc[:] * 0.5 * (sat_thk[k, :, j] + sat_thk[k, :, j + 1])
665
+ qx[k, :, j] = Qx[k, :, j] / area
666
+
667
+ qx[:, :, 1:] = 0.5 * (qx[:, :, 0:ncol-1] + qx[:, :, 1:ncol])
668
+ qx[:, :, 0] = 0.5 * qx[:, :, 0]
669
+
670
+ if Qy is not None:
671
+
672
+ nlay, nrow, ncol = Qy.shape
673
+ qy = np.zeros(Qy.shape, dtype=Qy.dtype)
674
+
675
+ for k in range(nlay):
676
+ for i in range(nrow-1):
677
+ area = delr[:] * 0.5 * (sat_thk[k, i, :] + sat_thk[k, i + 1, :])
678
+ qy[k, i, :] = Qy[k, i, :] / area
679
+
680
+ qy[:, 1:, :] = 0.5 * (qy[:, 0:nrow-1, :] + qy[:, 1:nrow, :])
681
+ qy[:, 0, :] = 0.5 * qy[:, 0, :]
682
+ qy = -qy
683
+
684
+
685
+ if Qz is not None:
686
+ qz = np.zeros(Qz.shape, dtype=Qz.dtype)
687
+ dr = delr.reshape((1, delr.shape[0]))
688
+ dc = delc.reshape((delc.shape[0], 1))
689
+ area = dr * dc
690
+ for k in range(nlay):
691
+ qz[k, :, :] = qz[k, :, :] / area[:, :]
692
+ qz[1:, :, :] = 0.5 * (qz[0:nlay-1, :, :] + qz[1:nlay, :, :])
693
+ qz[0, :, :] = 0.5 * qz[0, :, :]
694
+ qz = -qz
695
+
696
+
697
+ return (qx, qy, qz)
698
+
699
+
700
+
701
+ def findrowcolumn(pt, xedge, yedge):
702
+ '''
703
+ Find the MODFLOW cell containing the x- and y- point provided.
704
+
705
+ Parameters
706
+ ----------
707
+ pt : list or tuple
708
+ A list or tuple containing a x- and y- coordinate
709
+ xedge : numpy.ndarray
710
+ x-coordinate of the edge of each MODFLOW column. xedge is dimensioned
711
+ to NCOL + 1. If xedge is not a numpy.ndarray it is converted to a
712
+ numpy.ndarray.
713
+ yedge : numpy.ndarray
714
+ y-coordinate of the edge of each MODFLOW row. yedge is dimensioned
715
+ to NROW + 1. If yedge is not a numpy.ndarray it is converted to a
716
+ numpy.ndarray.
717
+
718
+ Returns
719
+ -------
720
+ irow, jcol : int
721
+ Row and column location containing x- and y- point passed to function.
722
+
723
+ Examples
724
+ --------
725
+ >>> import flopy
726
+ >>> irow, jcol = flopy.plotutil.findrowcolumn(pt, xedge, yedge)
727
+
728
+ '''
729
+
730
+ # make sure xedge and yedge are numpy arrays
731
+ if not isinstance(xedge, np.ndarray):
732
+ xedge = np.array(xedge)
733
+ if not isinstance(yedge, np.ndarray):
734
+ yedge = np.array(yedge)
735
+
736
+ # find column
737
+ jcol = -100
738
+ for jdx, xmf in enumerate(xedge):
739
+ if xmf > pt[0]:
740
+ jcol = jdx - 1
741
+ break
742
+
743
+ # find row
744
+ irow = -100
745
+ for jdx, ymf in enumerate(yedge):
746
+ if ymf < pt[1]:
747
+ irow = jdx - 1
748
+ break
749
+ return irow, jcol
750
+
751
+
752
+ def line_intersect_grid(ptsin, xedge, yedge, returnvertices=False):
753
+ '''
754
+ Intersect a list of polyline vertices with a rectilinear MODFLOW
755
+ grid. Vertices at the intersection of the polyline with the grid
756
+ cell edges is returned. Optionally the original polyline vertices
757
+ are returned.
758
+
759
+ Parameters
760
+ ----------
761
+ ptsin : list
762
+ A list of x, y points defining the vertices of a polyline that will be
763
+ intersected with the rectilinear MODFLOW grid
764
+ xedge : numpy.ndarray
765
+ x-coordinate of the edge of each MODFLOW column. xedge is dimensioned
766
+ to NCOL + 1. If xedge is not a numpy.ndarray it is converted to a
767
+ numpy.ndarray.
768
+ yedge : numpy.ndarray
769
+ y-coordinate of the edge of each MODFLOW row. yedge is dimensioned
770
+ to NROW + 1. If yedge is not a numpy.ndarray it is converted to a
771
+ numpy.ndarray.
772
+ returnvertices: bool
773
+ Return the original polyline vertices in the list of numpy.ndarray
774
+ containing vertices resulting from intersection of the provided
775
+ polygon and the MODFLOW model grid if returnvertices=True.
776
+ (default is False).
777
+
778
+ Returns
779
+ -------
780
+ (x, y, dlen) : numpy.ndarray of tuples
781
+ numpy.ndarray of tuples containing the x, y, and segment length of the
782
+ intersection of the provided polyline with the rectilinear MODFLOW
783
+ grid.
784
+
785
+ Examples
786
+ --------
787
+ >>> import flopy
788
+ >>> ptsout = flopy.plotutil.line_intersect_grid(ptsin, xedge, yedge)
789
+
790
+ '''
791
+
792
+ small_value = 1.0e-1
793
+
794
+ # make sure xedge and yedge are numpy arrays
795
+ if not isinstance(xedge, np.ndarray):
796
+ xedge = np.array(xedge)
797
+ if not isinstance(yedge, np.ndarray):
798
+ yedge = np.array(yedge)
799
+
800
+ # build list of points along current line
801
+ pts = []
802
+ npts = len(ptsin)
803
+ dlen = 0.
804
+ for idx in range(1, npts):
805
+ x0 = ptsin[idx - 1][0]
806
+ x1 = ptsin[idx][0]
807
+ y0 = ptsin[idx - 1][1]
808
+ y1 = ptsin[idx][1]
809
+ a = x1 - x0
810
+ b = y1 - y0
811
+ c = math.sqrt(math.pow(a, 2.) + math.pow(b, 2.))
812
+ # find cells with (x0, y0) and (x1, y1)
813
+ irow0, jcol0 = findrowcolumn((x0, y0), xedge, yedge)
814
+ irow1, jcol1 = findrowcolumn((x1, y1), xedge, yedge)
815
+ # determine direction to go in the x- and y-directions
816
+ jx = 0
817
+ incx = abs(small_value * a / c)
818
+ iy = 0
819
+ incy = -abs(small_value * b / c)
820
+ if a == 0.:
821
+ incx = 0.
822
+ # go to the right
823
+ elif a > 0.:
824
+ jx = 1
825
+ incx *= -1.
826
+ if b == 0.:
827
+ incy = 0.
828
+ # go down
829
+ elif b < 0.:
830
+ iy = 1
831
+ incy *= -1.
832
+ # process data
833
+ if irow0 >= 0 and jcol0 >= 0:
834
+ iadd = True
835
+ if idx > 1 and returnvertices:
836
+ iadd = False
837
+ if iadd:
838
+ pts.append((x0, y0, dlen))
839
+ icnt = 0
840
+ while True:
841
+ icnt += 1
842
+ dx = xedge[jcol0 + jx] - x0
843
+ dlx = 0.
844
+ if a != 0.:
845
+ dlx = c * dx / a
846
+ dy = yedge[irow0 + iy] - y0
847
+ dly = 0.
848
+ if b != 0.:
849
+ dly = c * dy / b
850
+ if dlx != 0. and dly != 0.:
851
+ if abs(dlx) < abs(dly):
852
+ dy = dx * b / a
853
+ else:
854
+ dx = dy * a / b
855
+ xt = x0 + dx + incx
856
+ yt = y0 + dy + incy
857
+ dl = math.sqrt(math.pow((xt - x0), 2.) + math.pow((yt - y0), 2.))
858
+ dlen += dl
859
+ if not returnvertices:
860
+ pts.append((xt, yt, dlen))
861
+ x0, y0 = xt, yt
862
+ xt = x0 - 2. * incx
863
+ yt = y0 - 2. * incy
864
+ dl = math.sqrt(math.pow((xt - x0), 2.) + math.pow((yt - y0), 2.))
865
+ dlen += dl
866
+ x0, y0 = xt, yt
867
+ irow0, jcol0 = findrowcolumn((x0, y0), xedge, yedge)
868
+ if irow0 >= 0 and jcol0 >= 0:
869
+ if not returnvertices:
870
+ pts.append((xt, yt, dlen))
871
+ elif irow1 < 0 or jcol1 < 0:
872
+ dl = math.sqrt(math.pow((x1 - x0), 2.) + math.pow((y1 - y0), 2.))
873
+ dlen += dl
874
+ break
875
+ if irow0 == irow1 and jcol0 == jcol1:
876
+ dl = math.sqrt(math.pow((x1 - x0), 2.) + math.pow((y1 - y0), 2.))
877
+ dlen += dl
878
+ pts.append((x1, y1, dlen))
879
+ break
880
+ return np.array(pts)
881
+
882
+
883
+ def cell_value_points(pts, xedge, yedge, vdata):
884
+ """
885
+ Intersect a list of polyline vertices with a rectilinear MODFLOW
886
+ grid. Vertices at the intersection of the polyline with the grid
887
+ cell edges is returned. Optionally the original polyline vertices
888
+ are returned.
889
+
890
+ Parameters
891
+ ----------
892
+ pts : list
893
+ A list of x, y points and polyline length to extract defining the
894
+ vertices of a polyline that
895
+ xedge : numpy.ndarray
896
+ x-coordinate of the edge of each MODFLOW column. The shape of xedge is
897
+ (NCOL + 1). If xedge is not a numpy.ndarray it is converted to a
898
+ numpy.ndarray.
899
+ yedge : numpy.ndarray
900
+ y-coordinate of the edge of each MODFLOW row. The shape of yedge is
901
+ (NROW + 1). If yedge is not a numpy.ndarray it is converted to a
902
+ numpy.ndarray.
903
+ vdata : numpy.ndarray
904
+ Data (i.e., head, hk, etc.) for a rectilinear MODFLOW model grid. The
905
+ shape of vdata is (NROW, NCOL). If vdata is not a numpy.ndarray it is
906
+ converted to a numpy.ndarray.
907
+
908
+ Returns
909
+ -------
910
+ vcell : numpy.ndarray
911
+ numpy.ndarray of of data values from the vdata numpy.ndarray at x- and
912
+ y-coordinate locations in pts.
913
+
914
+ Examples
915
+ --------
916
+ >>> import flopy
917
+ >>> vcell = flopy.plotutil.cell_value_points(xpts, xedge, yedge, head[0, :, :])
918
+
919
+ """
920
+
921
+ # make sure xedge and yedge are numpy arrays
922
+ if not isinstance(xedge, np.ndarray):
923
+ xedge = np.array(xedge)
924
+ if not isinstance(yedge, np.ndarray):
925
+ yedge = np.array(yedge)
926
+ if not isinstance(vdata, np.ndarray):
927
+ vdata = np.array(vdata)
928
+
929
+ vcell = []
930
+ for idx, [xt, yt, dlen] in enumerate(pts):
931
+ # find the modflow cell containing point
932
+ irow, jcol = findrowcolumn((xt, yt), xedge, yedge)
933
+ if irow >= 0 and jcol >= 0:
934
+ if np.isnan(vdata[irow, jcol]):
935
+ vcell.append(np.nan)
936
+ else:
937
+ v = np.asarray(vdata[irow, jcol])
938
+ vcell.append(v)
939
+
940
+ return np.array(vcell)
941
+
942
+
943
+
944
+ cm_data = [[ 0.26700401, 0.00487433, 0.32941519],
945
+ [ 0.26851048, 0.00960483, 0.33542652],
946
+ [ 0.26994384, 0.01462494, 0.34137895],
947
+ [ 0.27130489, 0.01994186, 0.34726862],
948
+ [ 0.27259384, 0.02556309, 0.35309303],
949
+ [ 0.27380934, 0.03149748, 0.35885256],
950
+ [ 0.27495242, 0.03775181, 0.36454323],
951
+ [ 0.27602238, 0.04416723, 0.37016418],
952
+ [ 0.2770184 , 0.05034437, 0.37571452],
953
+ [ 0.27794143, 0.05632444, 0.38119074],
954
+ [ 0.27879067, 0.06214536, 0.38659204],
955
+ [ 0.2795655 , 0.06783587, 0.39191723],
956
+ [ 0.28026658, 0.07341724, 0.39716349],
957
+ [ 0.28089358, 0.07890703, 0.40232944],
958
+ [ 0.28144581, 0.0843197 , 0.40741404],
959
+ [ 0.28192358, 0.08966622, 0.41241521],
960
+ [ 0.28232739, 0.09495545, 0.41733086],
961
+ [ 0.28265633, 0.10019576, 0.42216032],
962
+ [ 0.28291049, 0.10539345, 0.42690202],
963
+ [ 0.28309095, 0.11055307, 0.43155375],
964
+ [ 0.28319704, 0.11567966, 0.43611482],
965
+ [ 0.28322882, 0.12077701, 0.44058404],
966
+ [ 0.28318684, 0.12584799, 0.44496 ],
967
+ [ 0.283072 , 0.13089477, 0.44924127],
968
+ [ 0.28288389, 0.13592005, 0.45342734],
969
+ [ 0.28262297, 0.14092556, 0.45751726],
970
+ [ 0.28229037, 0.14591233, 0.46150995],
971
+ [ 0.28188676, 0.15088147, 0.46540474],
972
+ [ 0.28141228, 0.15583425, 0.46920128],
973
+ [ 0.28086773, 0.16077132, 0.47289909],
974
+ [ 0.28025468, 0.16569272, 0.47649762],
975
+ [ 0.27957399, 0.17059884, 0.47999675],
976
+ [ 0.27882618, 0.1754902 , 0.48339654],
977
+ [ 0.27801236, 0.18036684, 0.48669702],
978
+ [ 0.27713437, 0.18522836, 0.48989831],
979
+ [ 0.27619376, 0.19007447, 0.49300074],
980
+ [ 0.27519116, 0.1949054 , 0.49600488],
981
+ [ 0.27412802, 0.19972086, 0.49891131],
982
+ [ 0.27300596, 0.20452049, 0.50172076],
983
+ [ 0.27182812, 0.20930306, 0.50443413],
984
+ [ 0.27059473, 0.21406899, 0.50705243],
985
+ [ 0.26930756, 0.21881782, 0.50957678],
986
+ [ 0.26796846, 0.22354911, 0.5120084 ],
987
+ [ 0.26657984, 0.2282621 , 0.5143487 ],
988
+ [ 0.2651445 , 0.23295593, 0.5165993 ],
989
+ [ 0.2636632 , 0.23763078, 0.51876163],
990
+ [ 0.26213801, 0.24228619, 0.52083736],
991
+ [ 0.26057103, 0.2469217 , 0.52282822],
992
+ [ 0.25896451, 0.25153685, 0.52473609],
993
+ [ 0.25732244, 0.2561304 , 0.52656332],
994
+ [ 0.25564519, 0.26070284, 0.52831152],
995
+ [ 0.25393498, 0.26525384, 0.52998273],
996
+ [ 0.25219404, 0.26978306, 0.53157905],
997
+ [ 0.25042462, 0.27429024, 0.53310261],
998
+ [ 0.24862899, 0.27877509, 0.53455561],
999
+ [ 0.2468114 , 0.28323662, 0.53594093],
1000
+ [ 0.24497208, 0.28767547, 0.53726018],
1001
+ [ 0.24311324, 0.29209154, 0.53851561],
1002
+ [ 0.24123708, 0.29648471, 0.53970946],
1003
+ [ 0.23934575, 0.30085494, 0.54084398],
1004
+ [ 0.23744138, 0.30520222, 0.5419214 ],
1005
+ [ 0.23552606, 0.30952657, 0.54294396],
1006
+ [ 0.23360277, 0.31382773, 0.54391424],
1007
+ [ 0.2316735 , 0.3181058 , 0.54483444],
1008
+ [ 0.22973926, 0.32236127, 0.54570633],
1009
+ [ 0.22780192, 0.32659432, 0.546532 ],
1010
+ [ 0.2258633 , 0.33080515, 0.54731353],
1011
+ [ 0.22392515, 0.334994 , 0.54805291],
1012
+ [ 0.22198915, 0.33916114, 0.54875211],
1013
+ [ 0.22005691, 0.34330688, 0.54941304],
1014
+ [ 0.21812995, 0.34743154, 0.55003755],
1015
+ [ 0.21620971, 0.35153548, 0.55062743],
1016
+ [ 0.21429757, 0.35561907, 0.5511844 ],
1017
+ [ 0.21239477, 0.35968273, 0.55171011],
1018
+ [ 0.2105031 , 0.36372671, 0.55220646],
1019
+ [ 0.20862342, 0.36775151, 0.55267486],
1020
+ [ 0.20675628, 0.37175775, 0.55311653],
1021
+ [ 0.20490257, 0.37574589, 0.55353282],
1022
+ [ 0.20306309, 0.37971644, 0.55392505],
1023
+ [ 0.20123854, 0.38366989, 0.55429441],
1024
+ [ 0.1994295 , 0.38760678, 0.55464205],
1025
+ [ 0.1976365 , 0.39152762, 0.55496905],
1026
+ [ 0.19585993, 0.39543297, 0.55527637],
1027
+ [ 0.19410009, 0.39932336, 0.55556494],
1028
+ [ 0.19235719, 0.40319934, 0.55583559],
1029
+ [ 0.19063135, 0.40706148, 0.55608907],
1030
+ [ 0.18892259, 0.41091033, 0.55632606],
1031
+ [ 0.18723083, 0.41474645, 0.55654717],
1032
+ [ 0.18555593, 0.4185704 , 0.55675292],
1033
+ [ 0.18389763, 0.42238275, 0.55694377],
1034
+ [ 0.18225561, 0.42618405, 0.5571201 ],
1035
+ [ 0.18062949, 0.42997486, 0.55728221],
1036
+ [ 0.17901879, 0.43375572, 0.55743035],
1037
+ [ 0.17742298, 0.4375272 , 0.55756466],
1038
+ [ 0.17584148, 0.44128981, 0.55768526],
1039
+ [ 0.17427363, 0.4450441 , 0.55779216],
1040
+ [ 0.17271876, 0.4487906 , 0.55788532],
1041
+ [ 0.17117615, 0.4525298 , 0.55796464],
1042
+ [ 0.16964573, 0.45626209, 0.55803034],
1043
+ [ 0.16812641, 0.45998802, 0.55808199],
1044
+ [ 0.1666171 , 0.46370813, 0.55811913],
1045
+ [ 0.16511703, 0.4674229 , 0.55814141],
1046
+ [ 0.16362543, 0.47113278, 0.55814842],
1047
+ [ 0.16214155, 0.47483821, 0.55813967],
1048
+ [ 0.16066467, 0.47853961, 0.55811466],
1049
+ [ 0.15919413, 0.4822374 , 0.5580728 ],
1050
+ [ 0.15772933, 0.48593197, 0.55801347],
1051
+ [ 0.15626973, 0.4896237 , 0.557936 ],
1052
+ [ 0.15481488, 0.49331293, 0.55783967],
1053
+ [ 0.15336445, 0.49700003, 0.55772371],
1054
+ [ 0.1519182 , 0.50068529, 0.55758733],
1055
+ [ 0.15047605, 0.50436904, 0.55742968],
1056
+ [ 0.14903918, 0.50805136, 0.5572505 ],
1057
+ [ 0.14760731, 0.51173263, 0.55704861],
1058
+ [ 0.14618026, 0.51541316, 0.55682271],
1059
+ [ 0.14475863, 0.51909319, 0.55657181],
1060
+ [ 0.14334327, 0.52277292, 0.55629491],
1061
+ [ 0.14193527, 0.52645254, 0.55599097],
1062
+ [ 0.14053599, 0.53013219, 0.55565893],
1063
+ [ 0.13914708, 0.53381201, 0.55529773],
1064
+ [ 0.13777048, 0.53749213, 0.55490625],
1065
+ [ 0.1364085 , 0.54117264, 0.55448339],
1066
+ [ 0.13506561, 0.54485335, 0.55402906],
1067
+ [ 0.13374299, 0.54853458, 0.55354108],
1068
+ [ 0.13244401, 0.55221637, 0.55301828],
1069
+ [ 0.13117249, 0.55589872, 0.55245948],
1070
+ [ 0.1299327 , 0.55958162, 0.55186354],
1071
+ [ 0.12872938, 0.56326503, 0.55122927],
1072
+ [ 0.12756771, 0.56694891, 0.55055551],
1073
+ [ 0.12645338, 0.57063316, 0.5498411 ],
1074
+ [ 0.12539383, 0.57431754, 0.54908564],
1075
+ [ 0.12439474, 0.57800205, 0.5482874 ],
1076
+ [ 0.12346281, 0.58168661, 0.54744498],
1077
+ [ 0.12260562, 0.58537105, 0.54655722],
1078
+ [ 0.12183122, 0.58905521, 0.54562298],
1079
+ [ 0.12114807, 0.59273889, 0.54464114],
1080
+ [ 0.12056501, 0.59642187, 0.54361058],
1081
+ [ 0.12009154, 0.60010387, 0.54253043],
1082
+ [ 0.11973756, 0.60378459, 0.54139999],
1083
+ [ 0.11951163, 0.60746388, 0.54021751],
1084
+ [ 0.11942341, 0.61114146, 0.53898192],
1085
+ [ 0.11948255, 0.61481702, 0.53769219],
1086
+ [ 0.11969858, 0.61849025, 0.53634733],
1087
+ [ 0.12008079, 0.62216081, 0.53494633],
1088
+ [ 0.12063824, 0.62582833, 0.53348834],
1089
+ [ 0.12137972, 0.62949242, 0.53197275],
1090
+ [ 0.12231244, 0.63315277, 0.53039808],
1091
+ [ 0.12344358, 0.63680899, 0.52876343],
1092
+ [ 0.12477953, 0.64046069, 0.52706792],
1093
+ [ 0.12632581, 0.64410744, 0.52531069],
1094
+ [ 0.12808703, 0.64774881, 0.52349092],
1095
+ [ 0.13006688, 0.65138436, 0.52160791],
1096
+ [ 0.13226797, 0.65501363, 0.51966086],
1097
+ [ 0.13469183, 0.65863619, 0.5176488 ],
1098
+ [ 0.13733921, 0.66225157, 0.51557101],
1099
+ [ 0.14020991, 0.66585927, 0.5134268 ],
1100
+ [ 0.14330291, 0.66945881, 0.51121549],
1101
+ [ 0.1466164 , 0.67304968, 0.50893644],
1102
+ [ 0.15014782, 0.67663139, 0.5065889 ],
1103
+ [ 0.15389405, 0.68020343, 0.50417217],
1104
+ [ 0.15785146, 0.68376525, 0.50168574],
1105
+ [ 0.16201598, 0.68731632, 0.49912906],
1106
+ [ 0.1663832 , 0.69085611, 0.49650163],
1107
+ [ 0.1709484 , 0.69438405, 0.49380294],
1108
+ [ 0.17570671, 0.6978996 , 0.49103252],
1109
+ [ 0.18065314, 0.70140222, 0.48818938],
1110
+ [ 0.18578266, 0.70489133, 0.48527326],
1111
+ [ 0.19109018, 0.70836635, 0.48228395],
1112
+ [ 0.19657063, 0.71182668, 0.47922108],
1113
+ [ 0.20221902, 0.71527175, 0.47608431],
1114
+ [ 0.20803045, 0.71870095, 0.4728733 ],
1115
+ [ 0.21400015, 0.72211371, 0.46958774],
1116
+ [ 0.22012381, 0.72550945, 0.46622638],
1117
+ [ 0.2263969 , 0.72888753, 0.46278934],
1118
+ [ 0.23281498, 0.73224735, 0.45927675],
1119
+ [ 0.2393739 , 0.73558828, 0.45568838],
1120
+ [ 0.24606968, 0.73890972, 0.45202405],
1121
+ [ 0.25289851, 0.74221104, 0.44828355],
1122
+ [ 0.25985676, 0.74549162, 0.44446673],
1123
+ [ 0.26694127, 0.74875084, 0.44057284],
1124
+ [ 0.27414922, 0.75198807, 0.4366009 ],
1125
+ [ 0.28147681, 0.75520266, 0.43255207],
1126
+ [ 0.28892102, 0.75839399, 0.42842626],
1127
+ [ 0.29647899, 0.76156142, 0.42422341],
1128
+ [ 0.30414796, 0.76470433, 0.41994346],
1129
+ [ 0.31192534, 0.76782207, 0.41558638],
1130
+ [ 0.3198086 , 0.77091403, 0.41115215],
1131
+ [ 0.3277958 , 0.77397953, 0.40664011],
1132
+ [ 0.33588539, 0.7770179 , 0.40204917],
1133
+ [ 0.34407411, 0.78002855, 0.39738103],
1134
+ [ 0.35235985, 0.78301086, 0.39263579],
1135
+ [ 0.36074053, 0.78596419, 0.38781353],
1136
+ [ 0.3692142 , 0.78888793, 0.38291438],
1137
+ [ 0.37777892, 0.79178146, 0.3779385 ],
1138
+ [ 0.38643282, 0.79464415, 0.37288606],
1139
+ [ 0.39517408, 0.79747541, 0.36775726],
1140
+ [ 0.40400101, 0.80027461, 0.36255223],
1141
+ [ 0.4129135 , 0.80304099, 0.35726893],
1142
+ [ 0.42190813, 0.80577412, 0.35191009],
1143
+ [ 0.43098317, 0.80847343, 0.34647607],
1144
+ [ 0.44013691, 0.81113836, 0.3409673 ],
1145
+ [ 0.44936763, 0.81376835, 0.33538426],
1146
+ [ 0.45867362, 0.81636288, 0.32972749],
1147
+ [ 0.46805314, 0.81892143, 0.32399761],
1148
+ [ 0.47750446, 0.82144351, 0.31819529],
1149
+ [ 0.4870258 , 0.82392862, 0.31232133],
1150
+ [ 0.49661536, 0.82637633, 0.30637661],
1151
+ [ 0.5062713 , 0.82878621, 0.30036211],
1152
+ [ 0.51599182, 0.83115784, 0.29427888],
1153
+ [ 0.52577622, 0.83349064, 0.2881265 ],
1154
+ [ 0.5356211 , 0.83578452, 0.28190832],
1155
+ [ 0.5455244 , 0.83803918, 0.27562602],
1156
+ [ 0.55548397, 0.84025437, 0.26928147],
1157
+ [ 0.5654976 , 0.8424299 , 0.26287683],
1158
+ [ 0.57556297, 0.84456561, 0.25641457],
1159
+ [ 0.58567772, 0.84666139, 0.24989748],
1160
+ [ 0.59583934, 0.84871722, 0.24332878],
1161
+ [ 0.60604528, 0.8507331 , 0.23671214],
1162
+ [ 0.61629283, 0.85270912, 0.23005179],
1163
+ [ 0.62657923, 0.85464543, 0.22335258],
1164
+ [ 0.63690157, 0.85654226, 0.21662012],
1165
+ [ 0.64725685, 0.85839991, 0.20986086],
1166
+ [ 0.65764197, 0.86021878, 0.20308229],
1167
+ [ 0.66805369, 0.86199932, 0.19629307],
1168
+ [ 0.67848868, 0.86374211, 0.18950326],
1169
+ [ 0.68894351, 0.86544779, 0.18272455],
1170
+ [ 0.69941463, 0.86711711, 0.17597055],
1171
+ [ 0.70989842, 0.86875092, 0.16925712],
1172
+ [ 0.72039115, 0.87035015, 0.16260273],
1173
+ [ 0.73088902, 0.87191584, 0.15602894],
1174
+ [ 0.74138803, 0.87344918, 0.14956101],
1175
+ [ 0.75188414, 0.87495143, 0.14322828],
1176
+ [ 0.76237342, 0.87642392, 0.13706449],
1177
+ [ 0.77285183, 0.87786808, 0.13110864],
1178
+ [ 0.78331535, 0.87928545, 0.12540538],
1179
+ [ 0.79375994, 0.88067763, 0.12000532],
1180
+ [ 0.80418159, 0.88204632, 0.11496505],
1181
+ [ 0.81457634, 0.88339329, 0.11034678],
1182
+ [ 0.82494028, 0.88472036, 0.10621724],
1183
+ [ 0.83526959, 0.88602943, 0.1026459 ],
1184
+ [ 0.84556056, 0.88732243, 0.09970219],
1185
+ [ 0.8558096 , 0.88860134, 0.09745186],
1186
+ [ 0.86601325, 0.88986815, 0.09595277],
1187
+ [ 0.87616824, 0.89112487, 0.09525046],
1188
+ [ 0.88627146, 0.89237353, 0.09537439],
1189
+ [ 0.89632002, 0.89361614, 0.09633538],
1190
+ [ 0.90631121, 0.89485467, 0.09812496],
1191
+ [ 0.91624212, 0.89609127, 0.1007168 ],
1192
+ [ 0.92610579, 0.89732977, 0.10407067],
1193
+ [ 0.93590444, 0.8985704 , 0.10813094],
1194
+ [ 0.94563626, 0.899815 , 0.11283773],
1195
+ [ 0.95529972, 0.90106534, 0.11812832],
1196
+ [ 0.96489353, 0.90232311, 0.12394051],
1197
+ [ 0.97441665, 0.90358991, 0.13021494],
1198
+ [ 0.98386829, 0.90486726, 0.13689671],
1199
+ [ 0.99324789, 0.90615657, 0.1439362 ]]
1200
+
1201
+ viridis = LinearSegmentedColormap.from_list(__file__, cm_data)
1202
+
1203
+
1204
+
1205
+