FloPy

MNW2 package example


In [1]:
import sys
import os
import numpy as np
try:
    import pandas as pd
except:
    pass
import flopy

print(sys.version)
print('numpy version: {}'.format(np.__version__))
try:
    print('pandas version: {}'.format(pd.__version__))
except:
    pass
print('flopy version: {}'.format(flopy.__version__))


3.6.0 |Anaconda 4.3.0 (x86_64)| (default, Dec 23 2016, 13:19:00) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
numpy version: 1.11.3
pandas version: 0.19.2
flopy version: 3.2.6

Make an MNW2 package from scratch


In [2]:
m = flopy.modflow.Modflow('mnw2example', model_ws='temp')
dis = flopy.modflow.ModflowDis(nrow=5, ncol=5, nlay=3, nper=3, top=10, botm=0, model=m)

MNW2 information by node

(this could be prepared externally from well reconds and read in from a csv or excel file)

  • this table has two multi-node wells, the first (well1) consisting of two nodes that are manually specified (where the variable rw is specified by node)
  • node that some variables that are constant for the whole well are also included (losstype, zpump, etc.)

In [3]:
node_data = pd.DataFrame([[1, 1, 9.5, 7.1, 'well1', 'skin', -1, 0, 0, 0, 1., 2., 5., 6.2],
                   [1, 1, 7.1, 5.1, 'well1', 'skin', -1, 0, 0, 0, 0.5, 2., 5., 6.2],
 [3, 3, 9.1, 3.7, 'well2', 'skin', -1, 0, 0, 0, 1., 2., 5., 4.1]], 
             columns=['i', 'j', 'ztop', 'zbotm', 'wellid', 'losstype', 'pumploc', 'qlimit', 'ppflag', 'pumpcap', 
                    'rw', 'rskin', 'kskin', 'zpump'])
node_data


Out[3]:
i j ztop zbotm wellid losstype pumploc qlimit ppflag pumpcap rw rskin kskin zpump
0 1 1 9.5 7.1 well1 skin -1 0 0 0 1.0 2.0 5.0 6.2
1 1 1 7.1 5.1 well1 skin -1 0 0 0 0.5 2.0 5.0 6.2
2 3 3 9.1 3.7 well2 skin -1 0 0 0 1.0 2.0 5.0 4.1

convert the DataFrame to a rec array for compatibility with flopy


In [4]:
node_data = node_data.to_records()
node_data


Out[4]:
rec.array([(0, 1, 1, 9.5, 7.1, 'well1', 'skin', -1, 0, 0, 0, 1.0, 2.0, 5.0, 6.2),
 (1, 1, 1, 7.1, 5.1, 'well1', 'skin', -1, 0, 0, 0, 0.5, 2.0, 5.0, 6.2),
 (2, 3, 3, 9.1, 3.7, 'well2', 'skin', -1, 0, 0, 0, 1.0, 2.0, 5.0, 4.1)], 
          dtype=[('index', '<i8'), ('i', '<i8'), ('j', '<i8'), ('ztop', '<f8'), ('zbotm', '<f8'), ('wellid', 'O'), ('losstype', 'O'), ('pumploc', '<i8'), ('qlimit', '<i8'), ('ppflag', '<i8'), ('pumpcap', '<i8'), ('rw', '<f8'), ('rskin', '<f8'), ('kskin', '<f8'), ('zpump', '<f8')])

Stress period information

(could also be developed externally)


In [5]:
stress_period_data = pd.DataFrame([[0, 'well1', 0],
                          [1, 'well1', 100.0],
                          [0, 'well2', 0],
                          [1, 'well2', 1000.]], columns=['per', 'wellid', 'qdes'])
stress_period_data


Out[5]:
per wellid qdes
0 0 well1 0.0
1 1 well1 100.0
2 0 well2 0.0
3 1 well2 1000.0

In [6]:
pers = stress_period_data.groupby('per')
stress_period_data = {i: pers.get_group(i).to_records() for i in [0, 1]}
stress_period_data


Out[6]:
{0: rec.array([(0, 0, 'well1', 0.0), (2, 0, 'well2', 0.0)], 
           dtype=[('index', '<i8'), ('per', '<i8'), ('wellid', 'O'), ('qdes', '<f8')]),
 1: rec.array([(1, 1, 'well1', 100.0), (3, 1, 'well2', 1000.0)], 
           dtype=[('index', '<i8'), ('per', '<i8'), ('wellid', 'O'), ('qdes', '<f8')])}

Make ModflowMnw2 package object

  • note that extraneous columns in node_data and stress_period_data are ignored
  • if itmp is positive, it must equal the number of active wells being specified in stress_period_data, otherwise the package class will raise an error.

In [7]:
mnw2 = flopy.modflow.ModflowMnw2(model=m, mnwmax=2,
                 node_data=node_data, 
                 stress_period_data=stress_period_data, 
                 itmp=[2, 2, -1], # reuse second per pumping for last stress period
                 )

In [8]:
# "nodtot" is computed automatically
mnw2.nodtot


Out[8]:
3

In [9]:
pd.DataFrame(mnw2.node_data)


Out[9]:
k i j ztop zbotm wellid losstype pumploc qlimit ppflag ... hlim qcut qfrcmn qfrcmx hlift liftq0 liftqmax hwtol liftn qn
0 0 1 1 7.1 5.1 well1 skin -1 0 0 ... 0.0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 0 1 1 9.5 7.1 well1 skin -1 0 0 ... 0.0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 0 3 3 9.1 3.7 well2 skin -1 0 0 ... 0.0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

3 rows × 33 columns


In [10]:
pd.DataFrame(mnw2.stress_period_data[0])


Out[10]:
k i j wellid qdes capmult cprime hlim qcut qfrcmn qfrcmx
0 0 1 1 well1 0.0 0 0.0 0.0 0 0.0 0.0
1 0 3 3 well2 0.0 0 0.0 0.0 0 0.0 0.0

In [11]:
pd.DataFrame(mnw2.stress_period_data[1])


Out[11]:
k i j wellid qdes capmult cprime hlim qcut qfrcmn qfrcmx
0 0 1 1 well1 100.0 0 0.0 0.0 0 0.0 0.0
1 0 3 3 well2 1000.0 0 0.0 0.0 0 0.0 0.0

In [12]:
tmp = flopy.modflow.ModflowMnw2(model=m,
                 itmp=[1, 1, -1], # reuse second per pumping for last stress period
                 )


WARNING: unit 34 of package MNW2 already in use
****Warning -- two packages of the same type:  <class 'flopy.modflow.mfmnw2.ModflowMnw2'> <class 'flopy.modflow.mfmnw2.ModflowMnw2'>
replacing existing Package...

empty node_data and stress_period_data tables can also be generated by the package class, and then filled


In [13]:
node_data = tmp.get_empty_node_data(3)
node_data


Out[13]:
rec.array([ (0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
 (0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
 (0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)], 
          dtype=[('k', '<i8'), ('i', '<i8'), ('j', '<i8'), ('ztop', '<f4'), ('zbotm', '<f4'), ('wellid', 'O'), ('losstype', 'O'), ('pumploc', '<i8'), ('qlimit', '<i8'), ('ppflag', '<i8'), ('pumpcap', '<i8'), ('rw', '<f4'), ('rskin', '<f4'), ('kskin', '<f4'), ('B', '<f4'), ('C', '<f4'), ('P', '<f4'), ('cwc', '<f4'), ('pp', '<f4'), ('pumplay', '<i8'), ('pumprow', '<i8'), ('pumpcol', '<i8'), ('zpump', '<f4'), ('hlim', '<f4'), ('qcut', '<i8'), ('qfrcmn', '<f4'), ('qfrcmx', '<f4'), ('hlift', '<f4'), ('liftq0', '<f4'), ('liftqmax', '<f4'), ('hwtol', '<f4'), ('liftn', '<f4'), ('qn', '<f4')])

Mnw objects

at the base of the flopy mnw2 module is the Mnw object class, which describes a single multi-node well. A list or dict of Mnw objects can be used to build a package (using the example above):

flopy.modflow.ModflowMnw2(model=m, mnwmax=2,
                 mnw=<dict or list of Mnw objects>,
                 itmp=[1, 1, -1], # reuse second per pumping for last stress period
                 )

or if node_data and stress_period_data are supplied, the Mnw objects are created on initialization of the ModflowMnw2 class instance, and assigned to the .mnw attribute, as items in a dictionary keyed by wellid.


In [14]:
mnw2.mnw


Out[14]:
{'well1': <flopy.modflow.mfmnw2.Mnw at 0x10c120c50>,
 'well2': <flopy.modflow.mfmnw2.Mnw at 0x10c1204e0>}

In [15]:
mnw2.mnw['well1'].__dict__


Out[15]:
{'B': [None],
 'C': [0],
 'P': [2.0],
 'aux': [],
 'cwc': [None],
 'hlift': None,
 'hlim': None,
 'hwtol': None,
 'i': [1, 1],
 'j': [1, 1],
 'k': [0],
 'kskin': [5.0, 5.0],
 'liftn': None,
 'liftq0': None,
 'liftqmax': None,
 'losstype': 'skin',
 'mnwpackage': 
     Multi-Node Well 2 Package Class
 
     Parameters
     ----------
     model : model object
         The model object (of type :class:'flopy.modflow.mf.Modflow') to which
         this package will be added.
     mnwmax : int
         The absolute value of MNWMAX is the maximum number of multi-node wells (MNW) to be simulated.
         If MNWMAX is a negative number, NODTOT is read.
     nodtot : int
         Maximum number of nodes.
         The code automatically estimates the maximum number of nodes (NODTOT)
         as required for allocation of arrays. However, if a large number of horizontal wells
         are being simulated, or possibly for other reasons, this default estimate proves to be inadequate,
         a new input option has been added to allow the user to directly specify a value for NODTOT.
         If this is a desired option, then it can be implemented by specifying a negative value for
         "MNWMAX"--the first value listed in Record 1 (Line 1) of the MNW2 input data file.
         If this is done, then the code will assume that the very next value on that line
         will be the desired value of "NODTOT". The model will then reset "MNWMAX" to its absolute value.
         The value of "ipakcb" will become the third value on that line, etc.
     ipakcb : int
         is a flag and a unit number:
             if ipakcb > 0, then it is the unit number to which MNW cell-by-cell flow terms
                 will be recorded whenever cell-by-cell budget data are written to a file
                 (as determined by the outputcontrol options of MODFLOW).
             if ipakcb = 0, then MNW cell-by-cell flow terms will not be printed or recorded.
             if ipakcb < 0, then well injection or withdrawal rates and water levels in the well
                 and its multiple cells will be printed in the main MODFLOW listing (output) file
                 whenever cell-by-cell budget data are written to a file
                 (as determined by the output control options of MODFLOW).
     mnwprnt : integer
         Flag controlling the level of detail of information about multi-node wells to be written to the
         main MODFLOW listing (output) file. If MNWPRNT = 0, then only basic well information will be
         printed in the main MODFLOW output file; increasing the value of MNWPRNT yields more information,
         up to a maximum level of detail corresponding with MNWPRNT = 2.
         (default is 0)
     aux : list of strings
         (listed as "OPTION" in MNW2 input instructions)
         is an optional list of character values in the style of "AUXILIARY abc" or "AUX abc"
         where "abc" is the name of an auxiliary parameter to be read for each multi-node well
         as part of dataset 4a. Up to 20 parameters can be specified,
         each of which must be preceded by "AUXILIARY" or "AUX."
         These parameters will not be used by the MNW2 Package,
         but they will be available for use by other packages.
         (default is None)
     node_data : numpy record array
         master table describing multi-node wells in package. Same format as node_data tables for each
         Mnw object. See Mnw class documentation for more information.
     mnw : list or dict of Mnw objects
         Can be supplied instead of node_data and stress_period_data tables (in which case the tables
         are constructed from the Mnw objects). Otherwise the a dict of Mnw objects (keyed by wellid)
         is constructed from the tables.
     stress_period_data : dict of numpy record arrays
         master dictionary of record arrays (keyed by stress period) containing transient input
         for multi-node wells. Format is the same as stress period data for individual Mnw objects,
         except the 'per' column is replaced by 'wellid' (containing wellid for each MNW).
         See Mnw class documentation for more information.
     itmp : list of ints
         is an integer value for reusing or reading multi-node well data; it can change each stress period.
         ITMP must be >= 0 for the first stress period of a simulation.
         if ITMP > 0, then ITMP is the total number of active multi-node wells simulated during the stress period,
             and only wells listed in dataset 4a will be active during the stress period. Characteristics of each well
             are defined in datasets 2 and 4.
         if ITMP = 0, then no multi-node wells are active for the stress period and the following dataset is skipped.
         if ITMP < 0, then the same number of wells and well information will be reused from the
         previous stress period and dataset 4 is skipped.
     extension : string
         Filename extension (default is 'mnw2')
     unitnumber : int
         File unit number (default is None).
     filenames : str or list of str
         Filenames to use for the package and the output files. If
         filenames=None the package name will be created using the model name
         and package extension and the cbc output name will be created using
         the model name and .cbc extension (for example, modflowtest.cbc),
         if ipakcbc is a number greater than zero. If a single string is passed
         the package will be set to the string and cbc output names will be
         created using the model name and .cbc extension, if ipakcbc is a
         number greater than zero. To define the names for all package files
         (input and output) the length of the list of strings should be 2.
         Default is None.
     gwt : boolean
         Flag indicating whether GW transport process is active
 
     Attributes
     ----------
 
     Methods
     -------
 
     See Also
     --------
 
     Notes
     -----
 
     Examples
     --------
 
     >>> import flopy
     >>> ml = flopy.modflow.Modflow()
     >>> mnw2 = flopy.modflow.ModflowMnw2(ml, ...)
 
      acceptable_dtypes (list, items = 3
  allowDuplicates = False ('bool)
  aux (list, items = 0
  extra = 
  file_name = mnw2example.mnw2
  fn_path = temp/mnw2example.mnw2 ('str)
  gwt = False ('bool)
  ipakcb = 0 ('int)
  itmp (list, items = 3
  mnw = {'well1': <flopy.modflow.mfmnw2.Mnw object at 0x10c120c50>, 'well2': <flopy.modflow.mfmnw2.Mnw object at 0x10c1204e0>} ('dict)
  mnwmax = 2 ('int)
  mnwprnt = 0 ('int)
  node_data (array, shape = 3,)
  nodtot = 3 ('int)
  nper = 3 ('int)
  stress_period_data = <flopy.utils.util_list.MfList object at 0x103711a58> ('flopy.utils.util_list.MfList)
  structured = True ('bool)
  unit_number = 34,
 'nnodes': -2,
 'node_data': rec.array([ (0, 1, 1, 7.099999904632568, 5.099999904632568, 'well1', 'skin', -1, 0, 0, 0, 0.5, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 6.199999809265137, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
  (0, 1, 1, 9.5, 7.099999904632568, 'well1', 'skin', -1, 0, 0, 0, 1.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 6.199999809265137, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)], 
           dtype=[('k', '<i8'), ('i', '<i8'), ('j', '<i8'), ('ztop', '<f4'), ('zbotm', '<f4'), ('wellid', 'O'), ('losstype', 'O'), ('pumploc', '<i8'), ('qlimit', '<i8'), ('ppflag', '<i8'), ('pumpcap', '<i8'), ('rw', '<f4'), ('rskin', '<f4'), ('kskin', '<f4'), ('B', '<f4'), ('C', '<f4'), ('P', '<f4'), ('cwc', '<f4'), ('pp', '<f4'), ('pumplay', '<i8'), ('pumprow', '<i8'), ('pumpcol', '<i8'), ('zpump', '<f4'), ('hlim', '<f4'), ('qcut', '<i8'), ('qfrcmn', '<f4'), ('qfrcmx', '<f4'), ('hlift', '<f4'), ('liftq0', '<f4'), ('liftqmax', '<f4'), ('hwtol', '<f4'), ('liftn', '<f4'), ('qn', '<f4')]),
 'nper': 3,
 'pp': [1],
 'ppflag': 0,
 'pumpcap': 0,
 'pumpcol': 0,
 'pumplay': 0,
 'pumploc': -1,
 'pumprow': 0,
 'qcut': None,
 'qfrcmn': None,
 'qfrcmx': None,
 'qlimit': 0,
 'qn': None,
 'rskin': [2.0, 2.0],
 'rw': [0.5, 1.0],
 'stress_period_data': rec.array([(0, 1, 1, 0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0),
  (0, 1, 1, 1, 100.0, 0, 0.0, 0.0, 0, 0.0, 0.0),
  (0, 1, 1, 1, 100.0, 0, 0.0, 0.0, 0, 0.0, 0.0)], 
           dtype=[('k', '<i8'), ('i', '<i8'), ('j', '<i8'), ('per', '<i8'), ('qdes', '<f4'), ('capmult', '<i8'), ('cprime', '<f4'), ('hlim', '<f4'), ('qcut', '<i8'), ('qfrcmn', '<f4'), ('qfrcmx', '<f4')]),
 'wellid': 'well1',
 'zbotm': [5.0999999, 7.0999999],
 'zpump': 6.1999998,
 'ztop': [7.0999999, 9.5]}

Note that Mnw object attributes for variables that vary by node are lists (e.g. rw above)

Each Mnw object has its own node_data and stress_period_data


In [16]:
pd.DataFrame(mnw2.mnw['well1'].node_data)


Out[16]:
k i j ztop zbotm wellid losstype pumploc qlimit ppflag ... hlim qcut qfrcmn qfrcmx hlift liftq0 liftqmax hwtol liftn qn
0 0 1 1 7.1 5.1 well1 skin -1 0 0 ... 0.0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 0 1 1 9.5 7.1 well1 skin -1 0 0 ... 0.0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

2 rows × 33 columns

Instead of a dict keyed by stress period, Mnw.stress_period_data is a recarray with pumping data listed by stress period for that well

  • note that data for period 2, where itmp < 1, is shown (was copied from s.p. 1 during construction of the Mnw object)

In [17]:
pd.DataFrame(mnw2.mnw['well2'].stress_period_data)


Out[17]:
k i j per qdes capmult cprime hlim qcut qfrcmn qfrcmx
0 0 3 3 0 0.0 0 0.0 0.0 0 0.0 0.0
1 0 3 3 1 1000.0 0 0.0 0.0 0 0.0 0.0
2 0 3 3 1 1000.0 0 0.0 0.0 0 0.0 0.0

Build the same package using only the Mnw objects


In [18]:
mnw2fromobj = flopy.modflow.ModflowMnw2(model=m, mnwmax=2,
                 mnw=mnw2.mnw,
                 itmp=[2, 2, -1], # reuse second per pumping for last stress period
                 )


WARNING: unit 34 of package MNW2 already in use
****Warning -- two packages of the same type:  <class 'flopy.modflow.mfmnw2.ModflowMnw2'> <class 'flopy.modflow.mfmnw2.ModflowMnw2'>
replacing existing Package...

In [19]:
pd.DataFrame(mnw2fromobj.node_data)


Out[19]:
0
0 [[0, 1, 1, 7.1, 5.1, well1, skin, -1, 0, 0, 0,...
1 [[0, 3, 3, 9.1, 3.7, well2, skin, -1, 0, 0, 0,...

In [20]:
pd.DataFrame(mnw2fromobj.stress_period_data[0])


Out[20]:
k i j wellid qdes capmult cprime hlim qcut qfrcmn qfrcmx
0 0 1 1 well1 0.0 0 0.0 0.0 0 0.0 0.0
1 0 3 3 well2 0.0 0 0.0 0.0 0 0.0 0.0

In [21]:
pd.DataFrame(mnw2fromobj.stress_period_data[1])


Out[21]:
k i j wellid qdes capmult cprime hlim qcut qfrcmn qfrcmx
0 0 1 1 well1 100.0 0 0.0 0.0 0 0.0 0.0
1 0 3 3 well2 1000.0 0 0.0 0.0 0 0.0 0.0

By default, the node_data and stress_period_data tables attached to the ModflowMnw2 package class are definitive

  • on writing of the package output (mnw2.write_file()), the Mnw objects are regenerated from the tables. This setting is controlled by the default argument use_tables=True. To write the package file using the Mnw objects (ignoring the tables), use mnw2.write_file(use_tables=False).

In [22]:
per1 = flopy.modflow.ModflowMnw2.get_empty_stress_period_data(itmp=2)
per1


Out[22]:
rec.array([(0, 0, 0, 0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0),
 (0, 0, 0, 0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0)], 
          dtype=[('k', '<i8'), ('i', '<i8'), ('j', '<i8'), ('wellid', 'O'), ('qdes', '<f4'), ('capmult', '<i8'), ('cprime', '<f4'), ('hlim', '<f4'), ('qcut', '<i8'), ('qfrcmn', '<f4'), ('qfrcmx', '<f4')])

Write an MNW2 package file and inspect the results


In [23]:
mnw2.write_file(os.path.join('temp/test.mnw2'))

In [24]:
junk = [print(l.strip('\n')) for l in open('temp/test.mnw2').readlines()]


# MNW2 package for  MODFLOW-2005, generated by Flopy.
2 0 0
well1 -2
            skin -1 0 0 0
              -1.0000000E+00    2.0000000E+00    5.0000000E+00
               7.0999999E+00    5.0999999E+00 2 2    5.0000000E-01
               9.5000000E+00    7.0999999E+00 2 2    1.0000000E+00
               6.1999998E+00
well2 -1
            skin -1 0 0 0
               1.0000000E+00    2.0000000E+00    5.0000000E+00
               9.1000004E+00    3.7000000E+00 4 4
               4.0999999E+00
2  Stress Period 1
well1    0.0000000E+00
well2    0.0000000E+00
2  Stress Period 2
well1    1.0000000E+02
well2    1.0000000E+03
-1  Stress Period 3

Load some example MNW2 packages


In [25]:
path = os.path.join('..', '..', 'examples', 'data', 'mnw2_examples')
cpth = os.path.join('..', '..', 'autotest', 'temp')
m = flopy.modflow.Modflow('MNW2-Fig28', model_ws=cpth)
dis = flopy.modflow.ModflowDis.load(os.path.join(path, 'MNW2-Fig28.dis'), m)

In [26]:
m.get_package_list()


Out[26]:
['DIS']

In [27]:
mnw2pth = os.path.join(path, 'MNW2-Fig28.mnw2')
mnw2 = flopy.modflow.ModflowMnw2.load(mnw2pth, m)

In [28]:
pd.DataFrame(mnw2.node_data)


Out[28]:
k i j ztop zbotm wellid losstype pumploc qlimit ppflag ... hlim qcut qfrcmn qfrcmx hlift liftq0 liftqmax hwtol liftn qn
0 0 29 40 -5.0 -65.0 Well-A SKIN 0 1 0 ... -7.5 -1 0.1 0.15 0.0 0.0 0.0 0.0 0.0 0.0

1 rows × 33 columns


In [29]:
pd.DataFrame(mnw2.stress_period_data[0])


Out[29]:
k i j wellid qdes capmult cprime hlim qcut qfrcmn qfrcmx
0 0 29 40 Well-A 0.0 0 0.0 0.0 0 0.0 0.0

In [30]:
mnw2.mnw


Out[30]:
{'Well-A': <flopy.modflow.mfmnw2.Mnw at 0x10c16fac8>}

In [31]:
pd.DataFrame(mnw2.mnw['Well-A'].stress_period_data)


Out[31]:
k i j per qdes capmult cprime hlim qcut qfrcmn qfrcmx
0 0 29 40 0 0.0 0 0.0 0.0 0 0.0 0.0
1 0 29 40 1 -10000.0 0 0.0 0.0 0 0.0 0.0
2 0 29 40 2 -10000.0 0 0.0 0.0 0 0.0 0.0

In [32]:
path = os.path.join('..', '..', 'examples', 'data', 'mnw2_examples')
cpth = os.path.join('temp')
m = flopy.modflow.Modflow('br', model_ws=cpth)
mnw2 = flopy.modflow.ModflowMnw2.load(path + '/BadRiver_cal.mnw2', m)

In [33]:
df = pd.DataFrame(mnw2.node_data)
df.loc[:, df.sum(axis=0) != 0]


Out[33]:
i j ztop zbotm wellid losstype pumploc rw rskin kskin zpump
0 294 503 181.630005 161.630005 BR_Birch1 SKIN -1 1.0 2.0 10.0 162.630005
1 295 503 179.119995 159.119995 BR_Birch2 SKIN -1 1.0 2.0 10.0 160.119995
2 174 342 399.119995 312.119995 BR_DIaperville2 SKIN -1 1.0 2.0 10.0 313.119995
3 175 342 400.220001 312.220001 BR_Diaperville1 SKIN -1 1.0 2.0 10.0 313.220001
4 248 454 565.200012 555.200012 BR_Franks1 SKIN -1 1.0 2.0 10.0 556.200012
5 249 453 564.419983 554.419983 BR_Franks2 SKIN -1 1.0 2.0 10.0 555.419983
6 180 396 453.959991 447.959991 BR_Odanah1 SKIN -1 1.0 2.0 10.0 448.959991
7 181 395 450.559998 444.559998 BR_Odanah2 SKIN -1 1.0 2.0 10.0 445.559998
8 181 395 380.489990 371.489990 BR_Odanah3 SKIN -1 1.0 2.0 10.0 372.489990
9 180 396 450.739990 444.739990 BR_Odanah4 SKIN -1 1.0 2.0 10.0 445.739990
10 170 350 475.410004 472.410004 BR_OldSchool SKIN -1 1.0 2.0 10.0 473.410004
11 172 312 377.410004 348.410004 BR_recycle SKIN -1 1.0 2.0 10.0 349.410004
12 216 412 562.200012 542.200012 BR_unspec SKIN -1 1.0 2.0 10.0 543.200012
13 516 424 1079.910034 1072.910034 CFSP_ncp1 SKIN -1 1.0 2.0 10.0 1073.910034
14 515 424 1077.900024 1074.900024 CFSP_ncp2 SKIN -1 1.0 2.0 10.0 1075.900024
15 539 415 1093.010010 1003.010010 CFSP_of SKIN -1 1.0 2.0 10.0 1004.010010
16 360 2 706.330017 699.330017 Hayward_bait_N SKIN -1 1.0 2.0 10.0 700.330017
17 360 6 705.289978 698.289978 Hayward_bait_NE SKIN -1 1.0 2.0 10.0 699.289978
18 362 4 696.979980 689.979980 Hayward_bait_of SKIN -1 1.0 2.0 10.0 690.979980
19 456 699 1352.050049 1342.050049 IronBelt2 SKIN -1 1.0 2.0 10.0 1343.050049
20 456 699 1350.439941 1343.439941 IronBelt3 SKIN -1 1.0 2.0 10.0 1344.439941
21 599 414 1198.839966 1188.839966 Mellen2 SKIN -1 1.0 2.0 10.0 1189.839966
22 576 408 1151.599976 1131.599976 Mellen3 SKIN -1 1.0 2.0 10.0 1132.599976
23 253 149 622.179993 602.179993 Milestone SKIN -1 1.0 2.0 10.0 603.179993
24 208 148 520.119995 500.119995 NSP SKIN -1 1.0 2.0 10.0 501.119995
25 80 162 535.299988 30.299999 Washburn1 SKIN -1 1.0 2.0 10.0 31.299999
26 91 143 541.280029 -67.720001 Washburn2 SKIN -1 1.0 2.0 10.0 -66.720001