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
@@ -11,7 +11,7 @@ MODFLOW Guide
11
11
  import sys
12
12
  import numpy as np
13
13
  from flopy.mbase import Package
14
- from flopy.utils import util_2d,util_3d
14
+ from flopy.utils import util_2d,util_3d,reference
15
15
 
16
16
  class ModflowDis(Package):
17
17
  """
@@ -92,7 +92,7 @@ class ModflowDis(Package):
92
92
  def __init__(self, model, nlay=1, nrow=2, ncol=2, nper=1, delr=1.0,
93
93
  delc=1.0, laycbd=0, top=1, botm=0, perlen=1, nstp=1,
94
94
  tsmult=1, steady=True, itmuni=4, lenuni=2, extension='dis',
95
- unitnumber=11):
95
+ unitnumber=11, xul=None, yul=None, rotation=0.0):
96
96
 
97
97
  # Call ancestor's init to set self.parent, extension, name and unit
98
98
  # number
@@ -102,7 +102,7 @@ class ModflowDis(Package):
102
102
  self.ncol = ncol
103
103
  self.nlay = nlay
104
104
  self.nper = nper
105
-
105
+
106
106
  # Set values of all parameters
107
107
  self.heading = '# Discretization file for MODFLOW, generated by Flopy.'
108
108
  self.laycbd = util_2d(model, (self.nlay,), np.int, laycbd,
@@ -124,12 +124,15 @@ class ModflowDis(Package):
124
124
  name='tsmult')
125
125
  self.steady = util_2d(model, (self.nper,), np.bool,
126
126
  steady,name='steady')
127
- self.itmuni = itmuni
128
- self.lenuni = lenuni
127
+ self.itmuni = int(itmuni)
128
+ self.lenuni = int(lenuni)
129
129
  self.parent.add_package(self)
130
130
  self.itmuni_dict = {0: "undefined", 1: "seconds", 2: "minutes",
131
131
  3: "hours", 4: "days", 5: "years"}
132
132
 
133
+ self.sr = reference.SpatialReference(self.delr.array, self.delc.array, self.lenuni, xul=xul,
134
+ yul=yul, rotation=rotation)
135
+
133
136
  def checklayerthickness(self):
134
137
  """
135
138
  Check layer thickness.
@@ -516,100 +519,14 @@ class ModflowDis(Package):
516
519
  tsmult.append(a3)
517
520
  steady.append(a4)
518
521
 
519
- #--create dis object instance
522
+ # create dis object instance
520
523
  dis = ModflowDis(model, nlay, nrow, ncol, nper, delr, delc, laycbd,
521
524
  top, botm, perlen, nstp, tsmult, steady, itmuni,
522
525
  lenuni)
523
- #--return dis object instance
526
+ # return dis object instance
524
527
  return dis
525
528
 
526
529
 
527
- def plot(self):
528
- try:
529
- import pylab as plt
530
- except Exception as e:
531
- print("error importing pylab: " + str(e))
532
- return
533
-
534
- #get the bas for ibound masking
535
- bas = self.parent.bas6
536
- if bas is not None:
537
- ibnd = bas.getibound()
538
- else:
539
- ibnd = np.ones((self.nlay, self.nrow, self.ncol))
540
-
541
- cmap = plt.cm.winter
542
- cmap.set_bad('w', 1.0)
543
- fs = 5
544
-
545
- #the width and height of each subplot
546
- delt = 2.0
547
- shape = (2, self.nlay+1)
548
- fig = plt.figure(figsize=(delt+(self.nlay*delt), delt * 2.0))
549
- #fig = plt.figure()
550
-
551
- #plot the time stepping info in the upper left corner
552
- ax_time = plt.subplot2grid(shape, (0, 0))
553
- ax_time.set_title("time stepping information", fontsize=fs)
554
- idx = np.arange((self.nper))
555
- width = 0.5
556
- bars = ax_time.bar(idx, self.perlen, width=width, edgecolor="none",
557
- facecolor='b')
558
- for s, b in zip(self.steady, bars):
559
- if s:
560
- b.set_color('b')
561
- else:
562
- b.set_color('c')
563
-
564
- ax_time.set_xticks(idx+(width/2.0))
565
- ax_time.set_xticklabels(idx, fontsize=fs, rotation=90)
566
- ax_time.set_xlabel("stress period", fontsize=fs)
567
- ax_time.set_ylabel("time (" + self.itmuni_dict[self.itmuni] + ")",
568
- fontsize=fs)
569
- ax_time.set_yticklabels(ax_time.get_yticks(), fontsize=fs)
570
-
571
- #plot model top in the lower left
572
- ax_top = plt.subplot2grid(shape, (1, 0),aspect='equal')
573
- top = self.top.array
574
- top = np.ma.masked_where(ibnd[0] == 0, top)
575
- ax_top.set_xlabel("column", fontsize=fs)
576
- ax_top.set_ylabel("row", fontsize=fs)
577
- ax_top.imshow(top, cmap=cmap, alpha=0.7, interpolation="none")
578
- ax_top.set_title("model top - max,min: {0:G},{1:G}"
579
- .format(top.max(), top.min()), fontsize=fs)
580
- ax_top.set_xticklabels(ax_top.get_xticks(), fontsize=fs)
581
- ax_top.set_yticklabels(ax_top.get_yticks(), fontsize=fs)
582
-
583
-
584
- botm = self.botm.array
585
- for k in range(self.nlay):
586
- ax_botm = plt.subplot2grid(shape, (0, k+1), aspect="equal")
587
- ax_thk = plt.subplot2grid(shape, (1, k+1), aspect="equal")
588
- ax_thk.set_xlabel("column", fontsize=fs)
589
- ax_thk.set_xlabel("row", fontsize=fs)
590
- #botm for this layer
591
- b = botm[k]
592
- b = np.ma.masked_where(ibnd[k] == 0, b)
593
- ax_botm.imshow(b,cmap=cmap, alpha=0.7,
594
- interpolation="none")
595
- ax_botm.set_title("botm of layer {0:d} - max,min : {1:G},{2:G}"
596
- .format(k+1, b.max(), b.min()), fontsize=fs)
597
- #thickness of this layer
598
- if k == 0:
599
- t = top - botm[k]
600
- else:
601
- t = botm[k-1] - botm[k]
602
- t = np.ma.masked_where(ibnd[k] == 0, t)
603
- ax_thk.imshow(t,cmap=cmap, alpha=0.7,
604
- interpolation="none")
605
- ax_thk.set_title("thickness of layer {0:d} - max,min : {1:G},{2:G}"
606
- .format(k+1, t.max(), t.min()), fontsize=fs)
607
- ax_thk.set_yticklabels([])
608
- ax_botm.set_yticklabels([])
609
- ax_botm.set_xticklabels([])
610
- ax_thk.set_xlabel("column", fontsize=fs)
611
- ax_thk.set_xticklabels(ax_thk.get_xticks(), fontsize=fs)
612
- plt.tight_layout()
613
- plt.show()
530
+
614
531
 
615
532
 
@@ -108,7 +108,7 @@ class ModflowDrn(Package):
108
108
  self.dtype = dtype
109
109
  else:
110
110
  self.dtype = self.get_default_dtype(structured=self.parent.structured)
111
- self.stress_period_data = mflist(model, self.dtype, stress_period_data)
111
+ self.stress_period_data = mflist(self, stress_period_data)
112
112
  self.parent.add_package(self)
113
113
 
114
114
  def __repr__(self):
@@ -190,7 +190,7 @@ class ModflowEvt(Package):
190
190
  except:
191
191
  pass
192
192
 
193
- #--dataset 3 and 4 - parameters data
193
+ # dataset 3 and 4 - parameters data
194
194
  pak_parms = None
195
195
  if npar > 0:
196
196
  pak_parms = mfparbc.loadarray(f, npar, model.verbose)
@@ -267,9 +267,9 @@ class ModflowEvt(Package):
267
267
  current_ievt = t
268
268
  ievt[iper] = current_ievt
269
269
 
270
- #--create evt object
270
+ # create evt object
271
271
  evt = ModflowEvt(model, nevtop=nevtop, ipakcb=ipakcb,
272
272
  surf=surf, evtr=evtr, exdp=exdp, ievt=ievt)
273
273
 
274
- #--return evt object
274
+ # return evt object
275
275
  return evt
@@ -112,7 +112,7 @@ class ModflowGhb(Package):
112
112
  self.dtype = dtype
113
113
  else:
114
114
  self.dtype = self.get_default_dtype(structured=self.parent.structured)
115
- self.stress_period_data = mflist(model, self.dtype, stress_period_data)
115
+ self.stress_period_data = mflist(self, stress_period_data)
116
116
 
117
117
  def __repr__(self):
118
118
  return 'GHB package class'
@@ -202,6 +202,6 @@ class ModflowGhb(Package):
202
202
  """
203
203
 
204
204
  if model.verbose:
205
- sys.stdout.write('loading gmg package file...\n')
205
+ sys.stdout.write('loading ghb package file...\n')
206
206
 
207
207
  return Package.load(model, ModflowGhb, f, nper)
@@ -4,9 +4,10 @@ from flopy.mbase import Package
4
4
  class ModflowGmg(Package):
5
5
  '''GMG package
6
6
  Only programmed to work with the default values; may need work for other options'''
7
- def __init__(self, model, mxiter=50, iiter=30, iadamp=0, \
8
- hclose=1e-5, rclose=1e-5, relax=1.0, ioutgmg=0, \
9
- ism=0, isc=0, damp=1.0,dup=0.75,dlow=0.01,\
7
+ def __init__(self, model, mxiter=50, iiter=30, iadamp=0,
8
+ hclose=1e-5, rclose=1e-5, relax=1.0,
9
+ ioutgmg=0, iunitmhc=0,
10
+ ism=0, isc=0, damp=1.0, dup=0.75, dlow=0.01,
10
11
  chglimit=1.0,extension='gmg', unitnumber=27):
11
12
  Package.__init__(self, model, extension, 'GMG', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
12
13
  self.heading = '# GMG for MODFLOW, generated by Flopy.'
@@ -24,7 +25,7 @@ class ModflowGmg(Package):
24
25
  self.chglimit = chglimit
25
26
  self.damp = damp
26
27
  self.ioutgmg = ioutgmg
27
- self.iunitmhc = 0
28
+ self.iunitmhc = iunitmhc
28
29
  self.parent.add_package(self)
29
30
 
30
31
  def __repr__( self ):
@@ -34,17 +35,20 @@ class ModflowGmg(Package):
34
35
  # Open file for writing
35
36
  f_gmg = open(self.fn_path, 'w')
36
37
  f_gmg.write('%s\n' % self.heading)
37
- #--ds0
38
- f_gmg.write('{0:9.3e} {1:9d} {2:9.3e} {3:9d}\n'\
39
- .format(self.rclose,self.iiter,self.hclose,self.mxiter))
40
- #--ds1
41
- f_gmg.write('{0:9.3e} {1:9d} {2:9d} {3:9d}\n'\
42
- .format(self.damp,self.iadamp,self.ioutgmg,self.iunitmhc))
43
- #--ds2
44
- f_gmg.write('{0:9d} {1:9d} {2:9.3e} {3:9.3e} {4:9.3e}\n'\
45
- .format(self.ism,self.isc,self.dup,self.dlow,self.chglimit))
46
- #--ds3
47
- f_gmg.write('{0:10.3e}\n'.format(self.relax))
38
+ # dataset 0
39
+ f_gmg.write('{} {} {} {}\n'\
40
+ .format(self.rclose, self.iiter, self.hclose, self.mxiter))
41
+ # dataset 1
42
+ f_gmg.write('{} {} {} {}\n'\
43
+ .format(self.damp, self.iadamp, self.ioutgmg, self.iunitmhc))
44
+ # dataset 2
45
+ f_gmg.write('{} {} '.format(self.ism, self.isc))
46
+ if self.iadamp == 2:
47
+ f_gmg.write('{} {} {}'\
48
+ .format(self.dup, self.dlow, self.chglimit))
49
+ f_gmg.write('\n')
50
+ # dataset 3
51
+ f_gmg.write('{}\n'.format(self.relax))
48
52
  f_gmg.close()
49
53
 
50
54
 
@@ -87,11 +91,48 @@ class ModflowGmg(Package):
87
91
  filename = f
88
92
  f = open(filename, 'r')
89
93
  #dataset 0 -- header
94
+ while True:
95
+ line = f.readline()
96
+ if line[0] != '#':
97
+ break
98
+ #dataset 0
99
+ t = line.strip().split()
100
+ rclose = float(t[0])
101
+ iiter = int(t[1])
102
+ hclose = float(t[2])
103
+ mxiter = int(t[3])
104
+ #dataset 1
105
+ line = f.readline()
106
+ t = line.strip().split()
107
+ damp = float(t[0])
108
+ iadamp = int(t[1])
109
+ ioutgmg = int(t[2])
110
+ try:
111
+ iunitmhc = int(t[3])
112
+ except:
113
+ iunitmhc = 0
114
+ #dataset 2
115
+ line = f.readline()
116
+ t = line.strip().split()
117
+ ism = int(t[0])
118
+ isc = int(t[1])
119
+ dup, dlow, chglimit = 0.75, 0.01, 1.0
120
+ if iadamp == 2:
121
+ dup = float(t[2])
122
+ dlow = float(t[3])
123
+ chglimit = float(t[4])
124
+ #dataset 3
125
+ line = f.readline()
126
+ t = line.strip().split()
127
+ relax = float(t[0])
90
128
 
91
- print(' Warning: load method not completed. default gmg object created.')
92
-
93
- #--close the open file
129
+ # close the open file
94
130
  f.close()
95
131
 
96
- gmg = ModflowGmg(model)
132
+ # create the gmg object
133
+ gmg = ModflowGmg(model, mxiter=mxiter, iiter=iiter, iadamp=iadamp,
134
+ hclose=hclose, rclose=rclose, relax=relax,
135
+ ioutgmg=ioutgmg, iunitmhc=iunitmhc,
136
+ ism=ism, isc=isc, damp=damp,
137
+ dup=dup, dlow=dlow, chglimit=chglimit)
97
138
  return gmg
@@ -239,7 +239,7 @@ class ModflowHfb(Package):
239
239
  nphfb = int(t[0])
240
240
  mxfb = int(t[1])
241
241
  nhfbnp = int(t[2])
242
- #--check for no-print suppressor
242
+ # check for no-print suppressor
243
243
  options = []
244
244
  aux_names = []
245
245
  if len(t) > 2:
@@ -254,11 +254,11 @@ class ModflowHfb(Package):
254
254
  aux_names.append(t[it + 1].lower())
255
255
  it += 1
256
256
  it += 1
257
- #--data set 2 and 3
257
+ # data set 2 and 3
258
258
  if nphfb > 0:
259
259
  dt = ModflowHfb.get_empty(1).dtype
260
260
  pak_parms = mfparbc.load(f, nphfb, dt, model.verbose)
261
- #--data set 4
261
+ # data set 4
262
262
  bnd_output = None
263
263
  if nhfbnp > 0:
264
264
  specified = ModflowHfb.get_empty(nhfbnp)
@@ -269,7 +269,7 @@ class ModflowHfb(Package):
269
269
  t = line.strip().split()
270
270
  specified[ibnd] = tuple(t[:len(specified.dtype.names)])
271
271
 
272
- #--convert indices to zero-based
272
+ # convert indices to zero-based
273
273
  specified['k'] -= 1
274
274
  specified['irow1'] -= 1
275
275
  specified['icol1'] -= 1
@@ -295,7 +295,7 @@ class ModflowHfb(Package):
295
295
 
296
296
  par_current = ModflowHfb.get_empty(par_dict['nlst'])
297
297
 
298
- #--
298
+ #
299
299
  if model.mfpar.pval is None:
300
300
  parval = np.float(par_dict['parval'])
301
301
  else:
@@ -304,11 +304,11 @@ class ModflowHfb(Package):
304
304
  except:
305
305
  parval = np.float(par_dict['parval'])
306
306
 
307
- #--fill current parameter data (par_current)
307
+ # fill current parameter data (par_current)
308
308
  for ibnd, t in enumerate(data_dict):
309
309
  par_current[ibnd] = tuple(t[:len(par_current.dtype.names)])
310
310
 
311
- #--convert indices to zero-based
311
+ # convert indices to zero-based
312
312
  par_current['k'] -= 1
313
313
  par_current['irow1'] -= 1
314
314
  par_current['icol1'] -= 1
@@ -347,13 +347,13 @@ class ModflowLpf(Package):
347
347
  t = line.strip().split()
348
348
  wetfct, iwetit, ihdwet = float(t[0]), int(t[1]), int(t[2])
349
349
 
350
- #--parameters data
350
+ # parameters data
351
351
  par_types = []
352
352
  if nplpf > 0:
353
353
  par_types, parm_dict = mfpar.load(f, nplpf, model.verbose)
354
354
  #print parm_dict
355
355
 
356
- #--non-parameter data
356
+ # non-parameter data
357
357
  transient = not model.get_package('DIS').steady.all()
358
358
  hk = [0] * nlay
359
359
  hani = [0] * nlay
@@ -385,17 +385,20 @@ class ModflowLpf(Package):
385
385
  if model.verbose:
386
386
  print(' loading vka layer {0:3d}...'.format(k+1))
387
387
  if 'vka' not in par_types and 'vani' not in par_types:
388
- t = util_2d.load(f, model, (nrow,ncol), np.float32, 'vka',
388
+ t = util_2d.load(f, model, (nrow, ncol), np.float32, 'vka',
389
389
  ext_unit_dict)
390
390
  else:
391
391
  line = f.readline()
392
- t = mfpar.parameter_fill(model, (nrow, ncol), 'vka', parm_dict, findlayer=k)
392
+ key = 'vka'
393
+ if 'vani' in par_types:
394
+ key = 'vani'
395
+ t = mfpar.parameter_fill(model, (nrow, ncol), key, parm_dict, findlayer=k)
393
396
  vka[k] = t
394
397
  if transient:
395
398
  if model.verbose:
396
399
  print(' loading ss layer {0:3d}...'.format(k+1))
397
400
  if 'ss' not in par_types:
398
- t = util_2d.load(f, model, (nrow,ncol), np.float32, 'ss',
401
+ t = util_2d.load(f, model, (nrow, ncol), np.float32, 'ss',
399
402
  ext_unit_dict)
400
403
  else:
401
404
  line = f.readline()
@@ -405,7 +408,7 @@ class ModflowLpf(Package):
405
408
  if model.verbose:
406
409
  print(' loading sy layer {0:3d}...'.format(k+1))
407
410
  if 'sy' not in par_types:
408
- t = util_2d.load(f, model, (nrow,ncol), np.float32, 'sy',
411
+ t = util_2d.load(f, model, (nrow, ncol), np.float32, 'sy',
409
412
  ext_unit_dict)
410
413
  else:
411
414
  line = f.readline()
@@ -416,7 +419,7 @@ class ModflowLpf(Package):
416
419
  if model.verbose:
417
420
  print(' loading vkcb layer {0:3d}...'.format(k+1))
418
421
  if 'vkcb' not in par_types:
419
- t = util_2d.load(f, model, (nrow,ncol), np.float32, 'vkcb',
422
+ t = util_2d.load(f, model, (nrow, ncol), np.float32, 'vkcb',
420
423
  ext_unit_dict)
421
424
  else:
422
425
  line = f.readline()
@@ -425,13 +428,13 @@ class ModflowLpf(Package):
425
428
  if (laywet[k] != 0 and laytyp[k] != 0):
426
429
  if model.verbose:
427
430
  print(' loading wetdry layer {0:3d}...'.format(k+1))
428
- t = util_2d.load(f, model, (nrow,ncol), np.float32, 'wetdry',
431
+ t = util_2d.load(f, model, (nrow, ncol), np.float32, 'wetdry',
429
432
  ext_unit_dict)
430
433
  wetdry[k] = t
431
434
 
432
- #--create instance of lpf class
435
+ # create instance of lpf class
433
436
  lpf = ModflowLpf(model, ilpfcb=ilpfcb, laytyp=laytyp, layavg=layavg, chani=chani,
434
- laywet=laywet,hdry=hdry, iwdflg=iwetdry,
437
+ layvka=layvka, laywet=laywet, hdry=hdry, iwdflg=iwetdry,
435
438
  wetfct=wetfct, iwetit=iwetit, ihdwet=ihdwet,
436
439
  hk=hk, hani=hani, vka=vka, ss=ss, sy=sy, vkcb=vkcb,
437
440
  wetdry=wetdry, storagecoefficient=storagecoefficient,
@@ -154,11 +154,11 @@ class ModflowMlt(Package):
154
154
  if 'function' in t[1].lower() or 'expression' in t[1].lower():
155
155
  readArray = False
156
156
  kwrd = t[1].lower()
157
- #--load data
157
+ # load data
158
158
  if readArray:
159
159
  t = util_2d.load(f, model, (nrow, ncol), np.float32, mltnam,
160
160
  ext_unit_dict)
161
- #--add unit number to list of external files in ext_unit_dict to remove.
161
+ # add unit number to list of external files in ext_unit_dict to remove.
162
162
  if t.locat is not None:
163
163
  model.add_pop_key_list(t.locat)
164
164
  else:
@@ -167,7 +167,7 @@ class ModflowMlt(Package):
167
167
  t = ModflowMlt.mult_function(mult_dict, line)
168
168
  mult_dict[mltnam] = t
169
169
 
170
- #--create mlt dictionary
170
+ # create mlt dictionary
171
171
  mlt = ModflowMlt(model, mult_dict=mult_dict)
172
172
 
173
173
  return mlt
@@ -325,7 +325,7 @@ class ModflowNwt(Package):
325
325
 
326
326
  print(' ...load method not completed. default nwt file created.')
327
327
 
328
- #--close the open file
328
+ # close the open file
329
329
  f.close()
330
330
 
331
331
  nwt = ModflowNwt(model)
@@ -203,7 +203,7 @@ class ModflowOc(Package):
203
203
  f_oc = open(self.fn_path, 'w')
204
204
  f_oc.write('{}\n'.format(self.heading))
205
205
 
206
- #--write options
206
+ # write options
207
207
 
208
208
  f_oc.write('HEAD PRINT FORMAT {0:3.0f}\n'\
209
209
  .format(self.ihedfm))
@@ -229,7 +229,10 @@ class ModflowOc(Package):
229
229
  .format(self.unit_number[4]))
230
230
 
231
231
  if self.compact:
232
- f_oc.write('COMPACT BUDGET FILES')
232
+ f_oc.write('COMPACT BUDGET FILES\n')
233
+
234
+ # add a line separator between header and stress
235
+ # period data
233
236
  f_oc.write('\n')
234
237
 
235
238
 
@@ -263,7 +266,7 @@ class ModflowOc(Package):
263
266
  f_oc.write('\n')
264
267
  ddnref = ''
265
268
 
266
- #--close oc file
269
+ # close oc file
267
270
  f_oc.close()
268
271
 
269
272
  @staticmethod
@@ -344,7 +347,7 @@ class ModflowOc(Package):
344
347
  filename = f
345
348
  f = open(filename, 'r')
346
349
 
347
- #--read header
350
+ # read header
348
351
  ipos = f.tell()
349
352
  while True:
350
353
  line = f.readline()
@@ -361,10 +364,10 @@ class ModflowOc(Package):
361
364
  except:
362
365
  f.seek(ipos)
363
366
  pass
364
- #--exit so the remaining data can be read
367
+ # exit so the remaining data can be read
365
368
  # from the file based on numericformat
366
369
  break
367
- #--set pointer to current position in the OC file
370
+ # set pointer to current position in the OC file
368
371
  ipos = f.tell()
369
372
 
370
373
 
@@ -377,16 +380,16 @@ class ModflowOc(Package):
377
380
  lnlst = line.strip().split()
378
381
  incode, ihddfl = int(lnlst[0]), int(lnlst[1])
379
382
  ibudfl, icbcfl = int(lnlst[2]), int(lnlst[3])
380
- #--new print and save flags are needed if incode is not
383
+ # new print and save flags are needed if incode is not
381
384
  # less than 0.
382
385
  if incode >= 0:
383
386
  lines = []
384
- #--use print options from the last time step
387
+ # use print options from the last time step
385
388
  else:
386
389
  if len(lines) > 0:
387
390
  stress_period_data[(iperoc, itsoc)] = list(lines)
388
391
  continue
389
- #--set print and save budget flags
392
+ # set print and save budget flags
390
393
  if ibudfl != 0:
391
394
  lines.append('PRINT BUDGET')
392
395
  if icbcfl != 0:
@@ -494,13 +497,13 @@ class ModflowOc(Package):
494
497
  elif 'PERIOD' in lnlst[0].upper():
495
498
  if len(lines) > 0:
496
499
  if iperoc > 0:
497
- #--create period step tuple
500
+ # create period step tuple
498
501
  kperkstp = (iperoc-1, itsoc-1)
499
- #--save data
502
+ # save data
500
503
  stress_period_data[kperkstp] = lines
501
- #--reset lines
504
+ # reset lines
502
505
  lines = []
503
- #--turn off oc if required
506
+ # turn off oc if required
504
507
  if iperoc > 0:
505
508
  if itsoc==nstp[iperoc-1]:
506
509
  iperoc1 = iperoc + 1
@@ -510,10 +513,13 @@ class ModflowOc(Package):
510
513
  itsoc1 = itsoc + 1
511
514
  else:
512
515
  iperoc1, itsoc1 = iperoc, itsoc
513
- #--update iperoc and itsoc
516
+ # update iperoc and itsoc
514
517
  iperoc = int(lnlst[1])
515
518
  itsoc = int(lnlst[3])
516
- #--add a empty list if necessary
519
+ # do not used data that exceeds nper
520
+ if iperoc > nper:
521
+ break
522
+ # add a empty list if necessary
517
523
  iempty = False
518
524
  if iperoc != iperoc1:
519
525
  iempty = True
@@ -535,11 +541,11 @@ class ModflowOc(Package):
535
541
 
536
542
  #store the last record in word
537
543
  if len(lines) > 0:
538
- #--create period step tuple
544
+ # create period step tuple
539
545
  kperkstp = (iperoc-1, itsoc-1)
540
- #--save data
546
+ # save data
541
547
  stress_period_data[kperkstp] = lines
542
- #--add a empty list if necessary
548
+ # add a empty list if necessary
543
549
  iempty = False
544
550
  if iperoc != iperoc1:
545
551
  iempty = True
@@ -550,7 +556,7 @@ class ModflowOc(Package):
550
556
  kperkstp = (iperoc1-1, itsoc1-1)
551
557
  stress_period_data[kperkstp] = []
552
558
 
553
- #--reset unit numbers
559
+ # reset unit numbers
554
560
  unitnumber=[14, 51, 52, 53]
555
561
  if ihedun > 0:
556
562
  model.add_pop_key_list(ihedun)
@@ -562,7 +568,7 @@ class ModflowOc(Package):
562
568
  cboufm = True
563
569
 
564
570
 
565
- #--create instance of oc class
571
+ # create instance of oc class
566
572
  oc = ModflowOc(model, ihedfm=ihedfm, iddnfm=iddnfm,
567
573
  chedfm=chedfm, cddnfm=cddnfm, cboufm=cboufm,
568
574
  compact=compact,