Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions flopy/modflow/mf.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,9 @@ def load_results(self, **kwargs):
else:
return hdObj, ddObj, bdObj

@staticmethod
@classmethod
def load(
cls,
f,
version="mf2005",
exe_name="mf2005.exe",
Expand Down Expand Up @@ -746,7 +747,7 @@ def load(
os.path.join(model_ws, f)
)

ml = Modflow(
ml = cls(
modelname,
version=version,
exe_name=exe_name,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfag.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ def get_default_dtype(maxells=0, block="well"):

return np.dtype(dtype)

@staticmethod
def load(f, model, nper=0, ext_unit_dict=None):
@classmethod
def load(cls, f, model, nper=0, ext_unit_dict=None):
"""
Method to load the AG package from file

Expand Down Expand Up @@ -891,7 +891,7 @@ def load(f, model, nper=0, ext_unit_dict=None):
"Something went wrong at: {}".format(line)
)

return ModflowAg(
return cls(
model,
options=options,
time_series=time_series,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfbas.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ def write_file(self, check=True):
# Close file
f_bas.close()

@staticmethod
def load(f, model, ext_unit_dict=None, check=True, **kwargs):
@classmethod
def load(cls, f, model, ext_unit_dict=None, check=True, **kwargs):
"""
Load an existing package.

Expand Down Expand Up @@ -398,7 +398,7 @@ def load(f, model, ext_unit_dict=None, check=True, **kwargs):
)

# create bas object and return
bas = ModflowBas(
bas = cls(
model,
ibound=ibound,
strt=strt,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfbcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ def write_file(self, f=None):
f_bcf.write(self.wetdry[k].get_file_entry())
f_bcf.close()

@staticmethod
def load(f, model, ext_unit_dict=None):
@classmethod
def load(cls, f, model, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -529,7 +529,7 @@ def load(f, model, ext_unit_dict=None):
model.add_pop_key_list(ipakcb)

# create instance of bcf object
bcf = ModflowBcf(
bcf = cls(
model,
ipakcb=ipakcb,
intercellt=intercellt,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfde4.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ def write_file(self):
f.write("\n")
f.close()

@staticmethod
def load(f, model, ext_unit_dict=None):
@classmethod
def load(cls, f, model, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -313,7 +313,7 @@ def load(f, model, ext_unit_dict=None):
ext_unit_dict, filetype=ModflowDe4.ftype()
)

de4 = ModflowDe4(
de4 = cls(
model,
itmx=itmx,
mxup=mxup,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,8 @@ def check(self, f=None, verbose=True, level=1, checktype=None):
# if verbose:
# print(txt)

@staticmethod
def load(f, model, ext_unit_dict=None, check=True):
@classmethod
def load(cls, f, model, ext_unit_dict=None, check=True):
"""
Load an existing package.

Expand Down Expand Up @@ -1067,7 +1067,7 @@ def load(f, model, ext_unit_dict=None, check=True):
)

# create dis object instance
dis = ModflowDis(
dis = cls(
model,
nlay=nlay,
nrow=nrow,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfdisu.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ def zcentroids(self):
def ncpl(self):
return self.nodes / self.nlay

@staticmethod
def load(f, model, ext_unit_dict=None, check=False):
@classmethod
def load(cls, f, model, ext_unit_dict=None, check=False):
"""
Load an existing package.

Expand Down Expand Up @@ -798,7 +798,7 @@ def load(f, model, ext_unit_dict=None, check=False):
)

# create dis object instance
disu = ModflowDisU(
disu = cls(
model,
nodes=nodes,
nlay=nlay,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfevt.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ def write_file(self, f=None):
f_evt.write(ievt)
f_evt.close()

@staticmethod
def load(f, model, nper=None, ext_unit_dict=None):
@classmethod
def load(cls, f, model, nper=None, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -417,7 +417,7 @@ def load(f, model, nper=None, ext_unit_dict=None):
args["unitnumber"] = unitnumber
args["filenames"] = filenames

evt = ModflowEvt(model, **args)
evt = cls(model, **args)

# return evt object
return evt
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mffhb.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ def write_file(self):

f.close()

@staticmethod
def load(f, model, nper=None, ext_unit_dict=None):
@classmethod
def load(cls, f, model, nper=None, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -756,7 +756,7 @@ def load(f, model, nper=None, ext_unit_dict=None):
nfhbx1 = 0
nfhbx2 = 0

fhb = ModflowFhb(
fhb = cls(
model,
nbdtim=nbdtim,
nflw=nflw,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfflwob.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ def write_file(self):

return

@staticmethod
def load(f, model, ext_unit_dict=None, check=True):
@classmethod
def load(cls, f, model, ext_unit_dict=None, check=True):
"""
Load an existing package.

Expand Down Expand Up @@ -537,7 +537,7 @@ def load(f, model, ext_unit_dict=None, check=True):
model.add_pop_key_list(iufbobsv)

# create ModflowFlwob object instance
flwob = ModflowFlwob(
flwob = cls(
model,
iufbobsv=iufbobsv,
tomultfb=tomultfb,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfgage.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ def write_file(self):
# close the gage file
f.close()

@staticmethod
def load(f, model, nper=None, ext_unit_dict=None):
@classmethod
def load(cls, f, model, nper=None, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -395,7 +395,7 @@ def load(f, model, nper=None, ext_unit_dict=None):
for file in files:
filenames.append(os.path.basename(file))

gagepak = ModflowGage(
gagepak = cls(
model,
numgage=numgage,
gage_data=gage_data,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfgmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ def write_file(self):
f_gmg.write("{}\n".format(self.relax))
f_gmg.close()

@staticmethod
def load(f, model, ext_unit_dict=None):
@classmethod
def load(cls, f, model, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -411,7 +411,7 @@ def load(f, model, ext_unit_dict=None):
model.add_pop_key_list(iunitmhc)

# create the gmg object
gmg = ModflowGmg(
gmg = cls(
model,
mxiter=mxiter,
iiter=iiter,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfhfb.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def get_default_dtype(structured=True):
def get_sfac_columns():
return ["hydchr"]

@staticmethod
def load(f, model, ext_unit_dict=None):
@classmethod
def load(cls, f, model, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -412,7 +412,7 @@ def load(f, model, ext_unit_dict=None):
ext_unit_dict, filetype=ModflowHfb.ftype()
)

hfb = ModflowHfb(
hfb = cls(
model,
nphfb=0,
mxfb=0,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfhob.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ def write_file(self):

return

@staticmethod
def load(f, model, ext_unit_dict=None, check=True):
@classmethod
def load(cls, f, model, ext_unit_dict=None, check=True):
"""
Load an existing package.

Expand Down Expand Up @@ -492,7 +492,7 @@ def load(f, model, ext_unit_dict=None, check=True):
model.add_pop_key_list(iuhobsv)

# create hob object instance
hob = ModflowHob(
hob = cls(
model,
iuhobsv=iuhobsv,
hobdry=hobdry,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfhyd.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ def get_default_dtype():
)
return dtype

@staticmethod
def load(f, model, ext_unit_dict=None):
@classmethod
def load(cls, f, model, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -367,7 +367,7 @@ def load(f, model, ext_unit_dict=None):
model.add_pop_key_list(ihydun)

# create hyd instance
hyd = ModflowHyd(
hyd = cls(
model,
nhyd=nhyd,
ihydun=ihydun,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mflak.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ def write_file(self):
# close the lak file
f.close()

@staticmethod
def load(f, model, nper=None, ext_unit_dict=None):
@classmethod
def load(cls, f, model, nper=None, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -908,7 +908,7 @@ def load(f, model, nper=None, ext_unit_dict=None):
)
ipos += 1

lakpak = ModflowLak(
lakpak = cls(
model,
options=options,
nlakes=nlakes,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mflmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def write_file(self):

f.close()

@staticmethod
def load(f, model, ext_unit_dict=None):
@classmethod
def load(cls, f, model, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -257,7 +257,7 @@ def load(f, model, ext_unit_dict=None):
ext_unit_dict, filetype=ModflowLmt.ftype()
)

lmt = ModflowLmt(
lmt = cls(
model,
output_file_name=output_file_name,
output_file_unit=output_file_unit,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mflpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ def write_file(self, check=True, f=None):
f.close()
return

@staticmethod
def load(f, model, ext_unit_dict=None, check=True):
@classmethod
def load(cls, f, model, ext_unit_dict=None, check=True):
"""
Load an existing package.

Expand Down Expand Up @@ -723,7 +723,7 @@ def load(f, model, ext_unit_dict=None, check=True):
model.add_pop_key_list(ipakcb)

# create instance of lpf class
lpf = ModflowLpf(
lpf = cls(
model,
ipakcb=ipakcb,
laytyp=laytyp,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfmlt.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ def write_file(self):
"""
pass

@staticmethod
def load(f, model, nrow=None, ncol=None, ext_unit_dict=None):
@classmethod
def load(cls, f, model, nrow=None, ncol=None, ext_unit_dict=None):
"""
Load an existing package.

Expand Down Expand Up @@ -233,7 +233,7 @@ def load(f, model, nrow=None, ncol=None, ext_unit_dict=None):
)

# create mlt dictionary
mlt = ModflowMlt(
mlt = cls(
model,
mult_dict=mult_dict,
unitnumber=unitnumber,
Expand Down
6 changes: 3 additions & 3 deletions flopy/modflow/mfmnw1.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def get_default_dtype(structured=True):
else:
pass

@staticmethod
def load(f, model, nper=None, gwt=False, nsol=1, ext_unit_dict=None):
@classmethod
def load(cls, f, model, nper=None, gwt=False, nsol=1, ext_unit_dict=None):

if model.verbose:
sys.stdout.write("loading mnw1 package file...\n")
Expand Down Expand Up @@ -278,7 +278,7 @@ def load(f, model, nper=None, gwt=False, nsol=1, ext_unit_dict=None):
if openfile:
f.close()

return ModflowMnw1(
return cls(
model,
mxmnw=mxmnw,
ipakcb=ipakcb,
Expand Down
Loading