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,421 @@
1
+ """
2
+ Module to read MODPATH output files. The module contains three
3
+ important classes that can be accessed by the user.
4
+
5
+ * PathlineFile (Binary head file. Can also be used for drawdown)
6
+
7
+ """
8
+
9
+ import numpy as np
10
+ from collections import OrderedDict
11
+
12
+ class PathlineFile():
13
+ """
14
+ PathlineFile Class.
15
+
16
+ Parameters
17
+ ----------
18
+ filename : string
19
+ Name of the concentration file
20
+ verbose : bool
21
+ Write information to the screen. Default is False.
22
+
23
+ Attributes
24
+ ----------
25
+
26
+ Methods
27
+ -------
28
+
29
+ See Also
30
+ --------
31
+
32
+ Notes
33
+ -----
34
+ The PathlineFile class provides simple ways to retrieve MODPATH 6
35
+ pathline data from a MODPATH 6 ascii pathline file.
36
+
37
+ Examples
38
+ --------
39
+
40
+ >>> import flopy
41
+ >>> pthobj = flopy.utils.PathlineFile('model.mppth')
42
+ >>> p1 = pthobj.get_data(partid=1)
43
+
44
+
45
+ """
46
+ def __init__(self, filename, verbose=False):
47
+ self.fname = filename
48
+ self.dtype, self.outdtype = self._get_dtypes()
49
+ self._build_index()
50
+ self._data = np.loadtxt(self.file, dtype=self.dtype, skiprows=self.skiprows)
51
+ # set number of particle ids
52
+ self.nid = self._data['particleid'].max()
53
+ # convert layer, row, and column indices; particle id and group; and
54
+ # line segment indices to zero-based
55
+ self._data['k'] -= 1
56
+ self._data['i'] -= 1
57
+ self._data['j'] -= 1
58
+ self._data['particleid'] -= 1
59
+ self._data['particlegroup'] -= 1
60
+ self._data['linesegmentindex'] -= 1
61
+ # close the input file
62
+ self.file.close()
63
+ return
64
+
65
+ def _build_index(self):
66
+ """
67
+ Set position of the start of the pathline data.
68
+ """
69
+ self.skiprows = 0
70
+ self.file = open(self.fname, 'r')
71
+ while True:
72
+ line = self.file.readline()
73
+ self.skiprows += 1
74
+ if 'end header' in line.lower():
75
+ break
76
+ self.file.seek(0)
77
+
78
+ def _get_dtypes(self):
79
+ """
80
+ Build numpy dtype for the MODPATH 6 pathline file.
81
+ """
82
+ dtype = np.dtype([("particleid", np.int), ("particlegroup", np.int),
83
+ ("timepointindex", np.int), ("comulativetimestep", np.int),
84
+ ("time", np.float32), ("x", np.float32),
85
+ ("y", np.float32), ("z", np.float32),
86
+ ("k", np.int), ("i", np.int), ("j", np.int),
87
+ ("grid", np.int), ("xloc", np.float32),
88
+ ("yloc", np.float32), ("zloc", np.float32),
89
+ ("linesegmentindex", np.int)])
90
+ outdtype = np.dtype([("x", np.float32), ("y", np.float32), ("z", np.float32),
91
+ ("time", np.float32), ("k", np.int), ("id", np.int)])
92
+ return dtype, outdtype
93
+
94
+
95
+ def get_maxid(self):
96
+ """
97
+ Get the maximum pathline number in the file pathline file
98
+
99
+ Returns
100
+ ----------
101
+ out : int
102
+ Maximum pathline number.
103
+
104
+ """
105
+ return self.maxid
106
+
107
+
108
+ def get_maxtime(self):
109
+ """
110
+ Get the maximum time in pathline file
111
+
112
+ Returns
113
+ ----------
114
+ out : float
115
+ Maximum pathline timer.
116
+
117
+ """
118
+ return self.data['time'].max()
119
+
120
+
121
+ def get_data(self, partid=0, totim=None, ge=True):
122
+ """
123
+ get pathline data from the pathline file for a single pathline.
124
+
125
+ Parameters
126
+ ----------
127
+ partid : int
128
+ The zero-based particle id. The first record is record 0.
129
+ totim : float
130
+ The simulation time. All pathline points for particle partid
131
+ that are greater than or equal to (ge=True) or less than or
132
+ equal to (ge=False) totim will be returned. Default is None
133
+ ge : bool
134
+ Boolean that determines if pathline times greater than or equal
135
+ to or less than or equal to totim is used to create a subset
136
+ of pathlines. Default is True.
137
+
138
+ Returns
139
+ ----------
140
+ ra : numpy record array
141
+ A numpy recarray with the x, y, z, time, k, and particleid for
142
+ pathline partid.
143
+
144
+
145
+ See Also
146
+ --------
147
+
148
+ Notes
149
+ -----
150
+
151
+ Examples
152
+ --------
153
+
154
+ >>> import flopy.utils.modpathfile as mpf
155
+ >>> pthobj = flopy.utils.PathlineFile('model.mppth')
156
+ >>> p1 = pthobj.get_data(partid=1)
157
+
158
+ """
159
+ idx = self._data['particleid'] == partid
160
+ if totim is not None:
161
+ if ge:
162
+ idx = (self._data['time'] >= totim) & (self._data['particleid'] == partid)
163
+ else:
164
+ idx = (self._data['time'] <= totim) & (self._data['particleid'] == partid)
165
+ else:
166
+ idx = self._data['particleid'] == partid
167
+ self._ta = self._data[idx]
168
+ ra = np.rec.fromarrays((self._ta['x'], self._ta['y'], self._ta['z'],
169
+ self._ta['time'], self._ta['k'], self._ta['particleid']), dtype=self.outdtype)
170
+ return ra
171
+
172
+ def get_alldata(self, totim=None, ge=True):
173
+ """
174
+ get pathline data from the pathline file for all pathlines and all times.
175
+
176
+ Parameters
177
+ ----------
178
+ totim : float
179
+ The simulation time. All pathline points for particle partid
180
+ that are greater than or equal to (ge=True) or less than or
181
+ equal to (ge=False) totim will be returned. Default is None
182
+ ge : bool
183
+ Boolean that determines if pathline times greater than or equal
184
+ to or less than or equal to totim is used to create a subset
185
+ of pathlines. Default is True.
186
+
187
+ Returns
188
+ ----------
189
+ plist : a list of numpy record array
190
+ A list of numpy recarrays with the x, y, z, time, k, and particleid for
191
+ all pathlines.
192
+
193
+
194
+ See Also
195
+ --------
196
+
197
+ Notes
198
+ -----
199
+
200
+ Examples
201
+ --------
202
+
203
+ >>> import flopy.utils.modpathfile as mpf
204
+ >>> pthobj = flopy.utils.PathlineFile('model.mppth')
205
+ >>> p = pthobj.get_alldata()
206
+
207
+ """
208
+ plist = []
209
+ for partid in range(self.nid):
210
+ plist.append(self.get_data(partid=partid, totim=totim, ge=ge))
211
+ return plist
212
+
213
+
214
+ class EndpointFile():
215
+ """
216
+ EndpointFile Class.
217
+
218
+ Parameters
219
+ ----------
220
+ filename : string
221
+ Name of the concentration file
222
+ verbose : bool
223
+ Write information to the screen. Default is False.
224
+
225
+ Attributes
226
+ ----------
227
+
228
+ Methods
229
+ -------
230
+
231
+ See Also
232
+ --------
233
+
234
+ Notes
235
+ -----
236
+ The EndpointeFile class provides simple ways to retrieve MODPATH 6
237
+ endpoint data from a MODPATH 6 ascii endpoint file.
238
+
239
+ Examples
240
+ --------
241
+
242
+ >>> import flopy
243
+ >>> endobj = flopy.utils.EndpointFile('model.mpend')
244
+ >>> e1 = endobj.get_data(partid=1)
245
+
246
+
247
+ """
248
+ def __init__(self, filename, verbose=False):
249
+ self.fname = filename
250
+ self.dtype, self.outdtype = self._get_dtypes()
251
+ self._build_index()
252
+ self._data = np.loadtxt(self.file, dtype=self.dtype, skiprows=self.skiprows)
253
+ # set number of particle ids
254
+ self.nid = self._data['particleid'].max()
255
+ # convert layer, row, and column indices; particle id and group; and
256
+ # line segment indices to zero-based
257
+ self._data['k0'] -= 1
258
+ self._data['i0'] -= 1
259
+ self._data['j0'] -= 1
260
+ self._data['k'] -= 1
261
+ self._data['i'] -= 1
262
+ self._data['j'] -= 1
263
+ self._data['particleid'] -= 1
264
+ self._data['particlegroup'] -= 1
265
+ # close the input file
266
+ self.file.close()
267
+ return
268
+
269
+ def _build_index(self):
270
+ """
271
+ Set position of the start of the pathline data.
272
+ """
273
+ self.skiprows = 0
274
+ self.file = open(self.fname, 'r')
275
+ idx = 0
276
+ while True:
277
+ line = self.file.readline()
278
+ self.skiprows += 1
279
+ if idx == 1:
280
+ t = line.strip()
281
+ self.direction = 1
282
+ if int(t[0]) == 2:
283
+ self.direction = -1
284
+ if 'end header' in line.lower():
285
+ break
286
+ self.file.seek(0)
287
+
288
+ def _get_dtypes(self):
289
+ """
290
+ Build numpy dtype for the MODPATH 6 endpoint file.
291
+ """
292
+ dtype = np.dtype([("particleid", np.int), ("particlegroup", np.int),
293
+ ('status', np.int), ('initialtime', np.float32),
294
+ ('finaltime', np.float32), ('initialgrid', np.int),
295
+ ('k0', np.int), ('i0', np.int),
296
+ ('j0', np.int), ('initialcellface', np.int),
297
+ ('initialzone', np.int), ('xloc0', np.float32),
298
+ ('yloc0', np.float32), ('zloc0', np.float32),
299
+ ('x0', np.float32), ('y0', np.float32), ('z0', np.float32),
300
+ ('finalgrid', np.int), ('k', np.int), ('i', np.int),
301
+ ('j', np.int), ('finalcellface', np.int),
302
+ ('finalzone', np.int), ('xloc', np.float32),
303
+ ('yloc', np.float32), ('zloc', np.float32),
304
+ ('x', np.float32), ('y', np.float32), ('z', np.float32),
305
+ ('label', '|S40')])
306
+ outdtype = np.dtype([("x", np.float32), ("y", np.float32), ("z", np.float32),
307
+ ("time", np.float32), ("k", np.int), ("id", np.int)])
308
+ return dtype, outdtype
309
+
310
+
311
+ def get_maxid(self):
312
+ """
313
+ Get the maximum endpoint particle id in the file endpoint file
314
+
315
+ Returns
316
+ ----------
317
+ out : int
318
+ Maximum enpoint particle id.
319
+
320
+ """
321
+ return self.maxid
322
+
323
+
324
+ def get_maxtime(self):
325
+ """
326
+ Get the maximum time in endpoint file
327
+
328
+ Returns
329
+ ----------
330
+ out : float
331
+ Maximum endpoint time.
332
+
333
+ """
334
+ return self.data['finaltime'].max()
335
+
336
+
337
+ def get_data(self, partid=0, final=True):
338
+ """
339
+ get endpoint data from the endpoint file for a single particle.
340
+
341
+ Parameters
342
+ ----------
343
+ partid : int
344
+ The zero-based particle id. The first record is record 0.
345
+ final : bool
346
+ Boolean flag used determine if the initial or final endpoint
347
+ time should be returned, Default is True
348
+
349
+ Returns
350
+ ----------
351
+ ra : numpy record array
352
+ A numpy recarray with the final or initial (final=False)
353
+ x, y, z, time, k, and particleid for endpoint partid.
354
+
355
+
356
+ See Also
357
+ --------
358
+
359
+ Notes
360
+ -----
361
+
362
+ Examples
363
+ --------
364
+
365
+ >>> import flopy
366
+ >>> endobj = flopy.utils.EndpointFile('model.mpend')
367
+ >>> e1 = endobj.get_data(partid=1)
368
+
369
+ """
370
+ idx = self._data['particleid'] == partid
371
+ self._ta = self._data[idx]
372
+ if final:
373
+ ra = np.rec.fromarrays((self._ta['x'], self._ta['y'], self._ta['z'],
374
+ self._ta['finaltime'], self._ta['k'],
375
+ self._ta['particleid']), dtype=self.outdtype)
376
+ else:
377
+ ra = np.rec.fromarrays((self._ta['x0'], self._ta['y0'], self._ta['z0'],
378
+ self._ta['initialtime'], self._ta['k0'],
379
+ self._ta['particleid']), dtype=self.outdtype)
380
+ return ra
381
+
382
+ def get_alldata(self, final=True):
383
+ """
384
+ get endpoint data from the endpoint file for all endpoints.
385
+
386
+ Parameters
387
+ ----------
388
+ final : bool
389
+ Boolean flag used determine if the initial or final endpoint
390
+ time should be returned, Default is True
391
+
392
+ Returns
393
+ ----------
394
+ ra : numpy record array
395
+ A numpy recarray with the final or initial (final=False)
396
+ x, y, z, time, k, and particleid for endpoint partid.
397
+
398
+
399
+ See Also
400
+ --------
401
+
402
+ Notes
403
+ -----
404
+
405
+ Examples
406
+ --------
407
+
408
+ >>> import flopy
409
+ >>> endobj = flopy.utils.EndpointFile('model.mpend')
410
+ >>> e = endobj.get_alldata()
411
+
412
+ """
413
+ if final:
414
+ ra = np.rec.fromarrays((self._data['x'], self._data['y'], self._data['z'],
415
+ self._data['finaltime'], self._data['k'],
416
+ self._data['particleid']), dtype=self.outdtype)
417
+ else:
418
+ ra = np.rec.fromarrays((self._data['x0'], self._data['y0'], self._data['z0'],
419
+ self._data['initialtime'], self._data['k0'],
420
+ self._data['particleid']), dtype=self.outdtype)
421
+ return ra