Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _parse8(line):
iuzrow = None
iuzcol = None
iuzopt = 0
line = line_parse(line)
if((len(line) > 1 and not int(line[0]) < 0) or
(len(line) > 1 and line[1].isdigit())):
iuzrow = pop_item(line, int) - 1
iuzcol = pop_item(line, int) - 1
iftunit = pop_item(line, int)
iuzopt = pop_item(line, int)
else:
iftunit = pop_item(line, int)
return iuzrow, iuzcol, iftunit, iuzopt
Parameters
----------
line
Returns
-------
"""
qfrcmn = 0
qfrcmx = 0
line = line_parse(line)
hlim = pop_item(line, float)
qcut = pop_item(line, int)
if qcut != 0:
qfrcmn = pop_item(line, float)
qfrcmx = pop_item(line, float)
return hlim, qcut, qfrcmn, qfrcmx
"""
# dataset 2a
line = line_parse(get_next_line(f))
if len(line) > 2:
warnings.warn('MNW2: {}\n'.format(line) +
'Extra items in Dataset 2a!' +
'Check for WELLIDs with space ' +
'but not enclosed in quotes.')
wellid = pop_item(line).lower()
nnodes = pop_item(line, int)
# dataset 2b
line = line_parse(get_next_line(f))
losstype = pop_item(line)
pumploc = pop_item(line, int)
qlimit = pop_item(line, int)
ppflag = pop_item(line, int)
pumpcap = pop_item(line, int)
# dataset 2c
names = ['ztop', 'zbotm', 'k', 'i', 'j', 'rw', 'rskin', 'kskin', 'B', 'C',
'P', 'cwc', 'pp']
d2d = {n: [] for n in names} # dataset 2d; dict of lists for each variable
# set default values of 0 for all 2c items
d2dw = dict(
zip(['rw', 'rskin', 'kskin', 'B', 'C', 'P', 'cwc'], [0] * 7))
if losstype.lower() != 'none':
# update d2dw items
d2dw.update(
_parse_2c(get_next_line(f), losstype)) # dict of values for well
for k, v in d2dw.items():
if v > 0:
d2d[k].append(v)
Parameters
----------
line
Returns
-------
"""
qfrcmn = 0
qfrcmx = 0
line = line_parse(line)
hlim = pop_item(line, float)
qcut = pop_item(line, int)
if qcut != 0:
qfrcmn = pop_item(line, float)
qfrcmx = pop_item(line, float)
return hlim, qcut, qfrcmn, qfrcmx
liftq0 = pop_item(line, float)
liftqmax = pop_item(line, float)
hwtol = pop_item(line, float)
# dataset 2h
liftn = None
qn = None
if pumpcap > 0:
# Enter data in order of decreasing lift
# (that is, start with the point corresponding
# to the highest value of total dynamic head) and increasing discharge.
# The discharge value for the last data point in the sequence
# must be less than the value of LIFTqmax.
for i in range(len(pumpcap)):
line = line_parse(get_next_line(f))
liftn = pop_item(line, float)
qn = pop_item(line, float)
return Mnw(wellid,
nnodes=nnodes,
losstype=losstype, pumploc=pumploc, qlimit=qlimit,
ppflag=ppflag, pumpcap=pumpcap,
k=d2d['k'], i=d2d['i'], j=d2d['j'], ztop=d2d['ztop'],
zbotm=d2d['zbotm'],
rw=d2d['rw'], rskin=d2d['rskin'], kskin=d2d['kskin'],
B=d2d['B'], C=d2d['C'], P=d2d['P'], cwc=d2d['cwc'],
pp=d2d['pp'],
pumplay=pumplay, pumprow=pumprow, pumpcol=pumpcol, zpump=zpump,
hlim=hlim, qcut=qcut, qfrcmn=qfrcmn, qfrcmx=qfrcmx,
hlift=hlift, liftq0=liftq0, liftqmax=liftqmax, hwtol=hwtol,
liftn=liftn, qn=qn)
line.remove('mn')
if 'multi' in line:
multi = True
mntxt = 'multi'
line.remove('multi')
if mn and not multi:
multi = True
# "The alphanumeric flags MN and DD can appear anywhere
# between columns 41 and 256, inclusive."
dd = ''
if 'dd' in line:
line.remove('dd')
dd = 'dd'
qwval = pop_item(line, float)
rw = pop_item(line, float)
skin = pop_item(line, float)
hlim = pop_item(line, float)
href = pop_item(line, float)
iqwgrp = pop_item(line)
cpc = ''
if 'cp:' in linetxt:
cpc = re.findall(r'\d+', line.pop(0))
# in case there is whitespace between cp: and the value
if len(cpc) == 0:
cpc = pop_item(line)
cpc = 'cp:' + cpc
qcut = ''
qfrcmn = 0.
# dataset 2a
line = line_parse(get_next_line(f))
if len(line) > 2:
warnings.warn('MNW2: {}\n'.format(line) +
'Extra items in Dataset 2a!' +
'Check for WELLIDs with space ' +
'but not enclosed in quotes.')
wellid = pop_item(line).lower()
nnodes = pop_item(line, int)
# dataset 2b
line = line_parse(get_next_line(f))
losstype = pop_item(line)
pumploc = pop_item(line, int)
qlimit = pop_item(line, int)
ppflag = pop_item(line, int)
pumpcap = pop_item(line, int)
# dataset 2c
names = ['ztop', 'zbotm', 'k', 'i', 'j', 'rw', 'rskin', 'kskin', 'B', 'C',
'P', 'cwc', 'pp']
d2d = {n: [] for n in names} # dataset 2d; dict of lists for each variable
# set default values of 0 for all 2c items
d2dw = dict(
zip(['rw', 'rskin', 'kskin', 'B', 'C', 'P', 'cwc'], [0] * 7))
if losstype.lower() != 'none':
# update d2dw items
d2dw.update(
_parse_2c(get_next_line(f), losstype)) # dict of values for well
for k, v in d2dw.items():
if v > 0:
d2d[k].append(v)
# dataset 2d
else:
zpump = pop_item(line, float)
# dataset 2f
hlim = None
qcut = None
qfrcmx = None
qfrcmn = None
if qlimit > 0:
# Only specify dataset 2f if the value of Qlimit in dataset 2b is positive.
# Do not enter fractions as percentages.
line = line_parse(get_next_line(f))
hlim = pop_item(line, float)
qcut = pop_item(line, int)
if qcut != 0:
qfrcmn = pop_item(line, float)
qfrcmx = pop_item(line, float)
# dataset 2g
hlift = None
liftq0 = None
liftqmax = None
hwtol = None
if pumpcap > 0:
# The number of additional data points on the curve (and lines in dataset 2h)
# must correspond to the value of PUMPCAP for this well (where PUMPCAP <= 25).
line = line_parse(get_next_line(f))
hlift = pop_item(line, float)
liftq0 = pop_item(line, float)
liftqmax = pop_item(line, float)
hwtol = pop_item(line, float)
# dataset 2h
liftn = None
qn = None
def _parse_1(line):
"""
Parameters
----------
line
Returns
-------
"""
line = line_parse(line)
mnwmax = pop_item(line, int)
nodtot = None
if mnwmax < 0:
nodtot = pop_item(line, int)
ipakcb = pop_item(line, int)
mnwprint = pop_item(line, int)
option = [] # aux names
if len(line) > 0:
option += [line[i] for i in np.arange(1, len(line)) if
'aux' in line[i - 1].lower()]
return mnwmax, nodtot, ipakcb, mnwprint, option
cwc=d2dw['cwc'])
# append only the returned items
for k, v in d2di.items():
d2d[k].append(v)
if ppflag > 0 and nnodes > 0:
d2d['pp'].append(pop_item(line, float))
# dataset 2e
pumplay = None
pumprow = None
pumpcol = None
zpump = None
if pumploc != 0:
line = line_parse(get_next_line(f))
if pumploc > 0:
pumplay = pop_item(line, int)
pumprow = pop_item(line, int)
pumpcol = pop_item(line, int)
else:
zpump = pop_item(line, float)
# dataset 2f
hlim = None
qcut = None
qfrcmx = None
qfrcmn = None
if qlimit > 0:
# Only specify dataset 2f if the value of Qlimit in dataset 2b is positive.
# Do not enter fractions as percentages.
line = line_parse(get_next_line(f))
hlim = pop_item(line, float)
qcut = pop_item(line, int)
if qcut != 0: