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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: flopy
3
- Version: 3.2.1
3
+ Version: 3.2.2
4
4
  Summary: FloPy is a Python package to create, run, and post-process MODFLOW-based models.
5
5
  Home-page: https://github.com/modflowpy/flopy/
6
6
  Author: Mark Bakker, Vincent Post, Chris Langevin, Joe Hughes, Jeremy White, Jeff Starn, Mike Fienen, and Alain Frances
@@ -26,22 +26,55 @@ Description: Introduction
26
26
  FloPy3 Changes
27
27
  --------------
28
28
 
29
- Version 3.2
30
- ~~~~~~~~~~~
29
+ Version 3.2.2
30
+ ~~~~~~~~~~~~~
31
+
32
+ - *FloPy3* now supports some simple plotting capabilities for two- and
33
+ three-dimensional model input data array classes and transient
34
+ two-dimensional stress period input data using the ``.plot()``
35
+ methods associated with the data array classes (``util_2d``,
36
+ ``util_3d``, and ``transient_2d``). The model results reader classes
37
+ (``HeadFile``, ``UcnFile``, and ``CellBudgetFile``) have also been
38
+ extended to include a ``.plot()`` method that can be used to create
39
+ simple plots of model output data. See the notebook
40
+ `flopy3\_PlotArrayExample <http://nbviewer.ipython.org/github/modflowpy/flopy/blob/master/examples/Notebooks/flopy3_PlotArrayExample.ipynb>`__.
41
+
42
+ - Added ``.to_shapefile()`` method to two- and three-dimensional model
43
+ input data array classes (``util_2d`` and ``util_3d``), transient
44
+ two-dimensional stress period input data classes (``transient_2d``),
45
+ and model output data classes (``HeadFile``, ``UcnFile``, and
46
+ ``CellBudgetFile``) that allows model data to be exported as polygon
47
+ shapefiles with separate attribute columns for each model layer.
48
+
49
+ - Added support for ASCII model results files.
50
+
51
+ - Added support for reading MODPATH version 6 pathline and endpoint
52
+ output files and plotting MODPATH results using mapping capabilities
53
+ in ``flopy.plot`` submodule.
54
+
55
+ - Added ``load()`` method for MODFLOW GMG solver.
56
+
57
+ - Bug fixes:
58
+
59
+ 1. Multipler in array control record was not being applied to arrays
60
+ 2. vani parameter was not supported
61
+
62
+ Version 3.2.1
63
+ ~~~~~~~~~~~~~
31
64
 
32
65
  - *FloPy3* can now be used with **Python 3.x**
33
66
 
34
- - Revised setters for package class variables stored using the util\_2d
35
- or util\_3d classes.
67
+ - Revised setters for package class variables stored using the
68
+ ``util_2d`` or ``util_3d`` classes.
36
69
 
37
70
  - Added option to load a subset of MODFLOW packages in a MODFLOW model
38
- name file using *load\_only=* keyword.
71
+ name file using ``load_only=`` keyword.
39
72
 
40
73
  Version 3.1
41
74
  ~~~~~~~~~~~
42
75
 
43
76
  - *FloPy3* now supports some simple mapping and cross-section
44
- capabilities through the flopy.plot submodule. See the notebook
77
+ capabilities through the ``flopy.plot`` submodule. See the notebook
45
78
  `flopy3\_MapExample <http://nbviewer.ipython.org/github/modflowpy/flopy/blob/master/examples/Notebooks/flopy3_MapExample.ipynb>`__.
46
79
 
47
80
  - Full support for all Output Control (OC) options including
@@ -52,7 +85,7 @@ Description: Introduction
52
85
 
53
86
  - Added support for standard MULT package FUNCTION and EXPRESSION
54
87
  functionality are supported. MODFLOW parameters are not supported in
55
- *write()* methods.
88
+ ``write()`` methods.
56
89
 
57
90
  Version 3.0
58
91
  ~~~~~~~~~~~
@@ -83,10 +116,10 @@ Description: Introduction
83
116
  - *load()* methods have been developed for all of the standard MODFLOW
84
117
  packages and a few less used packages (*e.g.* SWI2).
85
118
 
86
- - MODFLOW parameter support has been added to the *load()* methods.
119
+ - MODFLOW parameter support has been added to the ``load()`` methods.
87
120
  MULT, PVAL, and ZONE packages are now supported and parameter data
88
- are converted to arrays in the *load()* methods. MODFLOW parameters
89
- are not supported in *write()* methods.
121
+ are converted to arrays in the ``load()`` methods. MODFLOW parameters
122
+ are not supported in ``write()`` methods.
90
123
 
91
124
  Installation
92
125
  ------------
@@ -227,6 +260,9 @@ Description: Introduction
227
260
 
228
261
  - An overview of the *FloPy3* `map and cross-section plotting
229
262
  capabilities <http://nbviewer.ipython.org/github/modflowpy/flopy/blob/master/examples/Notebooks/flopy3_MapExample.ipynb>`__.
263
+ - An overview of the *FloPy3* `model input and output data ``plot()``
264
+ method
265
+ capabilities <http://nbviewer.ipython.org/github/modflowpy/flopy/blob/master/examples/Notebooks/flopy3_PlotArrayExample.ipynb>`__
230
266
 
231
267
  Additional MODFLOW examples
232
268
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -5,6 +5,7 @@ mbase module
5
5
 
6
6
  """
7
7
 
8
+ from __future__ import print_function
8
9
  import numpy as np
9
10
  from numpy.lib.recfunctions import stack_arrays
10
11
  import sys
@@ -334,7 +335,7 @@ class BaseModel(object):
334
335
  # --reset the model workspace
335
336
  self.model_ws = new_pth
336
337
  sys.stdout.write('\nchanging model workspace...\n {}\n'.format(new_pth))
337
- #--reset the paths for each package
338
+ # reset the paths for each package
338
339
  for pp in (self.packagelist):
339
340
  pp.fn_path = os.path.join(self.model_ws, pp.file_name[0])
340
341
 
@@ -431,7 +432,7 @@ class BaseModel(object):
431
432
  break
432
433
  if self.verbose:
433
434
  print(' ')
434
- #--write name file
435
+ # write name file
435
436
  self.write_name_file()
436
437
  #os.chdir(org_dir)
437
438
  return
@@ -495,6 +496,119 @@ class BaseModel(object):
495
496
  self.pop_key_list.append(key)
496
497
 
497
498
 
499
+ def plot(self, SelPackList=None, **kwargs):
500
+ """
501
+ Plot 2-D, 3-D, transient 2-D, and stress period list (mflist)
502
+ model input data
503
+
504
+ Parameters
505
+ ----------
506
+ SelPackList : bool or list
507
+ List of of packages to plot. If SelPackList=None all packages
508
+ are plotted. (default is None)
509
+ **kwargs : dict
510
+ filename_base : str
511
+ Base file name that will be used to automatically generate file
512
+ names for output image files. Plots will be exported as image
513
+ files if file_name_base is not None. (default is None)
514
+ file_extension : str
515
+ Valid matplotlib.pyplot file extension for savefig(). Only used
516
+ if filename_base is not None. (default is 'png')
517
+ mflay : int
518
+ MODFLOW zero-based layer number to return. If None, then all
519
+ all layers will be included. (default is None)
520
+ kper : int
521
+ MODFLOW zero-based stress period number to return. (default is zero)
522
+ key : str
523
+ mflist dictionary key. (default is None)
524
+
525
+ Returns
526
+ ----------
527
+ axes : list
528
+ Empty list is returned if filename_base is not None. Otherwise
529
+ a list of matplotlib.pyplot.axis are returned.
530
+
531
+ See Also
532
+ --------
533
+
534
+ Notes
535
+ -----
536
+
537
+ Examples
538
+ --------
539
+ >>> import flopy
540
+ >>> ml = flopy.modflow.Modflow.load('test.nam')
541
+ >>> ml.plot()
542
+
543
+ """
544
+ # valid keyword arguments
545
+ if 'kper' in kwargs:
546
+ kper = int(kwargs.pop('kper'))
547
+ else:
548
+ kper = 0
549
+
550
+ if 'mflay' in kwargs:
551
+ mflay = kwargs.pop('mflay')
552
+ else:
553
+ mflay = None
554
+
555
+ if 'filename_base' in kwargs:
556
+ fileb = kwargs.pop('filename_base')
557
+ else:
558
+ fileb = None
559
+
560
+ if 'file_extension' in kwargs:
561
+ fext = kwargs.pop('file_extension')
562
+ fext = fext.replace('.', '')
563
+ else:
564
+ fext = 'png'
565
+
566
+ if 'key' in kwargs:
567
+ key = kwargs.pop('key')
568
+ else:
569
+ key = None
570
+
571
+ if self.verbose:
572
+ print('\nPlotting Packages')
573
+
574
+ axes = []
575
+ ifig = 0
576
+ if SelPackList is None:
577
+ for p in self.packagelist:
578
+ caxs = p.plot(initial_fig=ifig,
579
+ filename_base=fileb, file_extension=fext,
580
+ kper=kper, mflay=mflay, key=key)
581
+ # unroll nested lists of axes into a single list of axes
582
+ if isinstance(caxs, list):
583
+ for c in caxs:
584
+ axes.append(c)
585
+ else:
586
+ axes.append(caxs)
587
+ # update next active figure number
588
+ ifig = len(axes) + 1
589
+ else:
590
+ for pon in SelPackList:
591
+ for i, p in enumerate(self.packagelist):
592
+ if pon in p.name:
593
+ if self.verbose:
594
+ print(' Plotting Package: ', p.name[0])
595
+ caxs = p.plot(initial_fig=ifig,
596
+ filename_base=fileb, file_extension=fext,
597
+ kper=kper, mflay=mflay, key=key)
598
+ # unroll nested lists of axes into a single list of axes
599
+ if isinstance(caxs, list):
600
+ for c in caxs:
601
+ axes.append(c)
602
+ else:
603
+ axes.append(caxs)
604
+ # update next active figure number
605
+ ifig = len(axes) + 1
606
+ break
607
+ if self.verbose:
608
+ print(' ')
609
+ return axes
610
+
611
+
498
612
  class Package(object):
499
613
  """
500
614
  Base package class from which most other packages are derived.
@@ -630,6 +744,190 @@ class Package(object):
630
744
  newdtype = np.dtype(newdtype)
631
745
  return newdtype
632
746
 
747
+ def plot(self, **kwargs):
748
+ """
749
+ Plot 2-D, 3-D, transient 2-D, and stress period list (mflist)
750
+ package input data
751
+
752
+ Parameters
753
+ ----------
754
+ **kwargs : dict
755
+ filename_base : str
756
+ Base file name that will be used to automatically generate file
757
+ names for output image files. Plots will be exported as image
758
+ files if file_name_base is not None. (default is None)
759
+ file_extension : str
760
+ Valid matplotlib.pyplot file extension for savefig(). Only used
761
+ if filename_base is not None. (default is 'png')
762
+ mflay : int
763
+ MODFLOW zero-based layer number to return. If None, then all
764
+ all layers will be included. (default is None)
765
+ kper : int
766
+ MODFLOW zero-based stress period number to return. (default is zero)
767
+ key : str
768
+ mflist dictionary key. (default is None)
769
+
770
+ Returns
771
+ ----------
772
+ axes : list
773
+ Empty list is returned if filename_base is not None. Otherwise
774
+ a list of matplotlib.pyplot.axis are returned.
775
+
776
+ See Also
777
+ --------
778
+
779
+ Notes
780
+ -----
781
+
782
+ Examples
783
+ --------
784
+ >>> import flopy
785
+ >>> ml = flopy.modflow.Modflow.load('test.nam')
786
+ >>> ml.dis.plot()
787
+
788
+ """
789
+
790
+ # valid keyword arguments
791
+ if 'kper' in kwargs:
792
+ kper = kwargs.pop('kper')
793
+ else:
794
+ kper = 0
795
+
796
+ if 'filename_base' in kwargs:
797
+ fileb = kwargs.pop('filename_base')
798
+ else:
799
+ fileb = None
800
+
801
+ if 'mflay' in kwargs:
802
+ mflay = kwargs.pop('mflay')
803
+ else:
804
+ mflay = None
805
+
806
+ if 'file_extension' in kwargs:
807
+ fext = kwargs.pop('file_extension')
808
+ fext = fext.replace('.', '')
809
+ else:
810
+ fext = 'png'
811
+
812
+ if 'key' in kwargs:
813
+ key = kwargs.pop('key')
814
+ else:
815
+ key = None
816
+
817
+ if 'initial_fig' in kwargs:
818
+ ifig = int(kwargs.pop('initial_fig'))
819
+ else:
820
+ ifig = 0
821
+
822
+ inc = self.parent.nlay
823
+ if mflay is not None:
824
+ inc = 1
825
+
826
+
827
+ axes = []
828
+ for item, value in self.__dict__.items():
829
+ caxs = []
830
+ if isinstance(value, utils.mflist):
831
+ if self.parent.verbose:
832
+ print('plotting {} package mflist instance: {}'.format(self.name[0], item))
833
+ if key is None:
834
+ names = ['{} location stress period {} layer {}'.format(self.name[0], kper+1, k+1)
835
+ for k in range(self.parent.nlay)]
836
+ else:
837
+ names = ['{} {} data stress period {} layer {}'.format(self.name[0], key, kper+1, k+1)
838
+ for k in range(self.parent.nlay)]
839
+
840
+ fignum = list(range(ifig, ifig+inc))
841
+ ifig = fignum[-1] + 1
842
+ caxs.append(value.plot(key, names, kper,
843
+ filename_base=fileb, file_extension=fext, mflay=mflay,
844
+ fignum=fignum, colorbar=True))
845
+
846
+ elif isinstance(value, utils.util_3d):
847
+ if self.parent.verbose:
848
+ print('plotting {} package util_3d instance: {}'.format(self.name[0], item))
849
+ fignum = list(range(ifig, ifig+inc))
850
+ ifig = fignum[-1] + 1
851
+ caxs.append(value.plot(filename_base=fileb, file_extension=fext, mflay=mflay,
852
+ fignum=fignum, colorbar=True))
853
+ elif isinstance(value, utils.util_2d):
854
+ if len(value.shape) == 2:
855
+ if self.parent.verbose:
856
+ print('plotting {} package util_2d instance: {}'.format(self.name[0], item))
857
+ fignum = list(range(ifig, ifig+1))
858
+ ifig = fignum[-1] + 1
859
+ caxs.append(value.plot(filename_base=fileb, file_extension=fext,
860
+ fignum=fignum, colorbar=True))
861
+ elif isinstance(value, utils.transient_2d):
862
+ if self.parent.verbose:
863
+ print('plotting {} package transient_2d instance: {}'.format(self.name[0], item))
864
+ fignum = list(range(ifig, ifig+inc))
865
+ ifig = fignum[-1] + 1
866
+ caxs.append(value.plot(filename_base=fileb, file_extension=fext, kper=kper,
867
+ fignum=fignum, colorbar=True))
868
+ elif isinstance(value, list):
869
+ for v in value:
870
+ if isinstance(v, utils.util_3d):
871
+ if self.parent.verbose:
872
+ print('plotting {} package util_3d instance: {}'.format(self.name[0], item))
873
+ fignum = list(range(ifig, ifig+inc))
874
+ ifig = fignum[-1] + 1
875
+ caxs.append(v.plot(filename_base=fileb, file_extension=fext, mflay=mflay,
876
+ fignum=fignum, colorbar=True))
877
+ else:
878
+ pass
879
+
880
+ # unroll nested lists os axes into a single list of axes
881
+ if isinstance(caxs, list):
882
+ for c in caxs:
883
+ if isinstance(c, list):
884
+ for cc in c:
885
+ axes.append(cc)
886
+ else:
887
+ axes.append(c)
888
+ else:
889
+ axes.append(caxs)
890
+
891
+ return axes
892
+
893
+
894
+ def to_shapefile(self, filename, **kwargs):
895
+ """
896
+ Export 2-D, 3-D, and transient 2-D model data to shapefile (polygons). Adds an
897
+ attribute for each layer in each data array
898
+
899
+ Parameters
900
+ ----------
901
+ filename : str
902
+ Shapefile name to write
903
+
904
+ Returns
905
+ ----------
906
+ None
907
+
908
+ See Also
909
+ --------
910
+
911
+ Notes
912
+ -----
913
+
914
+ Examples
915
+ --------
916
+ >>> import flopy
917
+ >>> ml = flopy.modflow.Modflow.load('test.nam')
918
+ >>> ml.lpf.to_shapefile('test_hk.shp')
919
+ """
920
+
921
+ s = 'to_shapefile() method not implemented for {} Package'.format(self.name)
922
+ raise Exception(s)
923
+
924
+ # try:
925
+ # if isinstance(self.stress_period_data, utils.mflist):
926
+ # self.stress_period_data.to_shapefile(*args, **kwargs)
927
+ # except:
928
+ # pass
929
+
930
+
633
931
  def webdoc(self):
634
932
  if self.parent.version == 'mf2k':
635
933
  wb.open('http://water.usgs.gov/nrp/gwsoftware/modflow2000/Guide/' + self.url)
@@ -663,7 +961,7 @@ class Package(object):
663
961
  line = f.readline()
664
962
  if line[0] != '#':
665
963
  break
666
- #--check for parameters
964
+ # check for parameters
667
965
  nppak = 0
668
966
  if "parameter" in line.lower():
669
967
  t = line.strip().split()
@@ -698,7 +996,7 @@ class Package(object):
698
996
  it += 1
699
997
  it += 1
700
998
 
701
- #--set partype
999
+ # set partype
702
1000
  # and read phiramp for modflow-nwt well package
703
1001
  partype = ['cond']
704
1002
  if 'flopy.modflow.mfwel.modflowwel'.lower() in str(pack_type).lower():
@@ -706,10 +1004,9 @@ class Package(object):
706
1004
  specify = False
707
1005
  ipos = f.tell()
708
1006
  line = f.readline()
709
- #--test for specify keyword if a NWT well file - This is a temporary hack
1007
+ # test for specify keyword if a NWT well file - This is a temporary hack
710
1008
  if 'specify' in line.lower():
711
1009
  specify = True
712
- line = f.readline() #ditch line -- possibly save for NWT output
713
1010
  t = line.strip().split()
714
1011
  phiramp = np.float32(t[1])
715
1012
  try:
@@ -722,7 +1019,7 @@ class Package(object):
722
1019
  elif 'flopy.modflow.mfchd.modflowchd'.lower() in str(pack_type).lower():
723
1020
  partype = ['shead', 'ehead']
724
1021
 
725
- #--read parameter data
1022
+ # read parameter data
726
1023
  if nppak > 0:
727
1024
  dt = pack_type.get_empty(1, aux_names=aux_names).dtype
728
1025
  pak_parms = mfparbc.load(f, nppak, dt, model.verbose)
@@ -782,7 +1079,7 @@ class Package(object):
782
1079
  t.append(line[istart:istop])
783
1080
  current[ibnd] = tuple(t[:len(current.dtype.names)])
784
1081
 
785
- #--convert indices to zero-based
1082
+ # convert indices to zero-based
786
1083
  current['k'] -= 1
787
1084
  current['i'] -= 1
788
1085
  current['j'] -= 1
@@ -805,16 +1102,12 @@ class Package(object):
805
1102
  iname = 'static'
806
1103
  except:
807
1104
  pass
808
- #print pname, iname
809
1105
  par_dict, current_dict = pak_parms.get(pname)
810
1106
  data_dict = current_dict[iname]
811
- #print par_dict
812
- #print data_dict
813
1107
 
814
1108
  par_current = pack_type.get_empty(par_dict['nlst'], aux_names=aux_names)
815
1109
 
816
- #--
817
- #parval = np.float(par_dict['parval'])
1110
+ # get appropriate parval
818
1111
  if model.mfpar.pval is None:
819
1112
  parval = np.float(par_dict['parval'])
820
1113
  else:
@@ -823,7 +1116,7 @@ class Package(object):
823
1116
  except:
824
1117
  parval = np.float(par_dict['parval'])
825
1118
 
826
- #--fill current parameter data (par_current)
1119
+ # fill current parameter data (par_current)
827
1120
  for ibnd, t in enumerate(data_dict):
828
1121
  par_current[ibnd] = tuple(t[:len(par_current.dtype.names)])
829
1122
 
@@ -842,11 +1135,8 @@ class Package(object):
842
1135
 
843
1136
  if bnd_output is None:
844
1137
  stress_period_data[iper] = itmp
845
- #print 'crap'
846
1138
  else:
847
1139
  stress_period_data[iper] = bnd_output
848
- #print bnd_output.shape
849
- #print bnd_output
850
1140
 
851
1141
  pak = pack_type(model, ipakcb=ipakcb,
852
1142
  stress_period_data=stress_period_data, \
@@ -119,6 +119,7 @@ class Modflow(BaseModel):
119
119
  self.external_units = []
120
120
  self.external_binflag = []
121
121
  self.external = False
122
+ self.verbose = verbose
122
123
  self.load = load
123
124
  # the starting external data unit number
124
125
  self.__next_ext_unit = 1000
@@ -322,6 +323,7 @@ class Modflow(BaseModel):
322
323
  if item.filetype.lower() == "dis":
323
324
  dis = item
324
325
  dis_key = key
326
+ break
325
327
  try:
326
328
  pck = dis.package.load(dis.filename, ml,
327
329
  ext_unit_dict=ext_unit_dict)
@@ -330,10 +332,10 @@ class Modflow(BaseModel):
330
332
  sys.stdout.write(' {:4s} package load...success\n'
331
333
  .format(pck.name[0]))
332
334
  ext_unit_dict.pop(dis_key)
333
- except:
335
+ except Exception as e:
334
336
  s = 'Could not read discretization package: {}. Stopping...'\
335
337
  .format(os.path.basename(dis.filename))
336
- raise Exception(s)
338
+ raise Exception(s + " " + str(e))
337
339
 
338
340
  if load_only is None:
339
341
  load_only = []
@@ -401,8 +403,8 @@ class Modflow(BaseModel):
401
403
  ml.external_binflag.append("binary"
402
404
  in item.filetype.lower())
403
405
 
404
- #--pop binary output keys and any external file units that are now
405
- #--internal
406
+ # pop binary output keys and any external file units that are now
407
+ # internal
406
408
  for key in ml.pop_key_list:
407
409
  try:
408
410
  ml.remove_external(unit=key)
@@ -412,7 +414,7 @@ class Modflow(BaseModel):
412
414
  sys.stdout.write('Warning: external file unit " +\
413
415
  "{} does not exist in ext_unit_dict.\n'.format(key))
414
416
 
415
- #--write message indicating packages that were successfully loaded
417
+ # write message indicating packages that were successfully loaded
416
418
  if ml.verbose:
417
419
  print(1 * '\n')
418
420
  s = ' The following {0} packages were successfully loaded.'\
@@ -428,5 +430,5 @@ class Modflow(BaseModel):
428
430
  print(' ' + os.path.basename(fname))
429
431
  print('\n')
430
432
 
431
- #--return model object
433
+ # return model object
432
434
  return ml
@@ -268,10 +268,10 @@ class ModflowBcf(Package):
268
268
  t = util_2d.load(f, model, (nrow,ncol), np.float32, 'wetdry', ext_unit_dict)
269
269
  wetdry[k,:,:] = t.array
270
270
 
271
- #--create instance of bcf object
271
+ # create instance of bcf object
272
272
  bcf = ModflowBcf(model, ibcfcb=ibcfcb, intercellt=intercellt, laycon=laycon, trpy=trpy, hdry=hdry,
273
273
  iwdflg=iwdflg, wetfct=wetfct, iwetit=iwetit, ihdwet=ihdwet,
274
274
  tran=tran, hy=hy, vcont=vcont, sf1=sf1, sf2=sf2, wetdry=wetdry)
275
275
 
276
- #--return bcf object
276
+ # return bcf object
277
277
  return bcf
@@ -105,7 +105,7 @@ class ModflowChd(Package):
105
105
  self.dtype = dtype
106
106
  else:
107
107
  self.dtype = self.get_default_dtype(structured=self.parent.structured)
108
- self.stress_period_data = mflist(model, self.dtype, stress_period_data)
108
+ self.stress_period_data = mflist(self, stress_period_data)
109
109
 
110
110
  self.np = 0
111
111
  self.parent.add_package(self)
@@ -206,12 +206,12 @@ class ModflowDe4(Package):
206
206
  if not hasattr(f, 'read'):
207
207
  filename = f
208
208
  f = open(filename, 'r')
209
- #--read dataset 0 -- header
209
+ # read dataset 0 -- header
210
210
  while True:
211
211
  line = f.readline()
212
212
  if line[0] != '#':
213
213
  break
214
- #--read dataset 1
214
+ # read dataset 1
215
215
  ifrfm = model.get_ifrefm()
216
216
  if model.version != 'mf2k':
217
217
  ifrfm = True