Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor whitespace in NAM file and MFList output files #622

Merged
merged 1 commit into from
Jul 30, 2019
Merged
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
11 changes: 5 additions & 6 deletions flopy/discretization/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,11 @@ def __init__(self, grid_type=None, top=None, botm=None, idomain=None,
# access to basic grid properties
###################################
def __repr__(self):
s = "xll:{0:<.10G}; yll:{1:<.10G}; rotation:{2:<G}; ". \
format(self.xoffset, self.yoffset, self.angrot)
s += "proj4_str:{0}; ".format(self.proj4)
s += "units:{0}; ".format(self.units)
s += "lenuni:{0}; ".format(self.lenuni)
return s
return (
"xll:{0:<.10G}; yll:{1:<.10G}; rotation:{2:<G}; proj4_str:{3}; "
"units:{4}; lenuni:{5}"
.format(self.xoffset, self.yoffset, self.angrot, self.proj4,
self.units, self.lenuni))

@property
def grid_type(self):
Expand Down
11 changes: 7 additions & 4 deletions flopy/mbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,17 @@ def get_name_file_entries(self):
----------

"""
s = ''
lines = []
for p in self.packagelist:
for i in range(len(p.name)):
if p.unit_number[i] == 0:
continue
s += '{:14s} {:5d} '.format(p.name[i], p.unit_number[i]) + \
'{:s} {:s}\n'.format(p.file_name[i], p.extra[i])
return s
s = '{:14s} {:5d} {}'.format(
p.name[i], p.unit_number[i], p.file_name[i])
if p.extra[i]:
s += ' ' + p.extra[i]
lines.append(s)
return '\n'.join(lines) + '\n'

def has_package(self, name):
"""
Expand Down
2 changes: 1 addition & 1 deletion flopy/modflow/mf.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def write_name_file(self):
f_nam.write('{}\n'.format(self.heading))
if self.structured:
f_nam.write('#' + str(self.modelgrid))
f_nam.write(" ;start_datetime:{0}\n".format(self.start_datetime))
f_nam.write("; start_datetime:{0}\n".format(self.start_datetime))
if self.version == 'mf2k':
if self.glo.unit_number[0] > 0:
f_nam.write('{:14s} {:5d} {}\n'.format(self.glo.name[0],
Expand Down
16 changes: 9 additions & 7 deletions flopy/utils/util_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,15 @@ def write_transient(self, f, single_per=None, forceInternal=False):

if kper_vtype == np.recarray:
name = f.name
f.close()
f = open(name, 'ab+')
# print(f)
self.__tofile(f, kper_data)
f.close()
f = open(name, 'a')
# print(f)
if self.__binary:
f.close()
# switch file append mode to binary
with open(name, 'ab+') as f:
self.__tofile(f, kper_data)
# continue back to non-binary
f = open(name, 'a')
else:
self.__tofile(f, kper_data)
elif kper_vtype == str:
f.write(' open/close ' + kper_data)
if self.__binary:
Expand Down