Esempio n. 1
0
def pwtgas(io_manager, siminfo, uci, ts):
    ''' Estimate water temperature, dissolved oxygen, and carbon dioxide in the outflows
    from a pervious landsegment. calculate associated fluxes through exit gates'''
    simlen = siminfo['steps']

    ui = make_numba_dict(uci)
    ui['simlen'] = siminfo['steps']
    ui['uunits'] = siminfo['units']
    ui['errlen'] = len(ERRMSG)

    u = uci['PARAMETERS']
    if 'IDVFG' in u:
        ts['IDOXP'] = initm(siminfo, uci, u['IDVFG'], 'MONTHLY_IDOXP', u['IDOXP'])
    else:
        ts['IDOXP'] = full(simlen, u['IDOXP'])
    if 'ICVFG' in u:
        ts['ICO2P'] = initm(siminfo, uci, u['ICVFG'], 'MONTHLY_ICO2P', u['ICO2P'])
    else:
        ts['ICO2P'] = full(simlen, u['ICO2P'])
    if 'GDVFG' in u:
        ts['ADOXP'] = initm(siminfo, uci, u['GDVFG'], 'MONTHLY_ADOXP', u['ADOXP'])
    else:
        ts['ADOXP'] = full(simlen, u['ADOXP'])
    if 'GCVFG' in u:
        ts['ACO2P'] = initm(siminfo, uci, u['GCVFG'], 'MONTHLY_ACO2P', u['ACO2P'])
    else:
        ts['ACO2P'] = full(simlen, u['ACO2P'])

    ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float64)

    ############################################################################
    errors = _pwtgas_(ui, ts)  # run PWTGAS simulation code
    ############################################################################

    return errors, ERRMSG
Esempio n. 2
0
def iwtgas(io_manager, siminfo, uci, ts):
	''' Estimate water temperature, dissolved oxygen, and carbon dioxide in the outflows
	from a impervious land segment. calculate associated fluxes through exit gate'''

	simlen = siminfo['steps']

	ui = make_numba_dict(uci)
	ui['simlen'] = siminfo['steps']
	ui['uunits'] = siminfo['units']
	ui['errlen'] = len(ERRMSG)

	u = uci['PARAMETERS']
	if 'WTFVFG' in u:
		ts['AWTF'] = initm(siminfo, uci, u['WTFVFG'], 'MONTHLY_AWTF', u['AWTF'])
		ts['BWTF'] = initm(siminfo, uci, u['WTFVFG'], 'MONTHLY_BWTF', u['BWTF'])
	else:
		ts['AWTF'] = full(simlen, u['AWTF'])
		ts['BWTF'] = full(simlen, u['BWTF'])

	for name in ['AIRTMP', 'WYIELD', 'SURO', 'SURLI']:
		if name not in ts:
			ts[name] = zeros(simlen)

	ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float64)

	############################################################################
	errors = _iwtgas_(ui, ts)  # run IWTGAS simulation code
	############################################################################

	return errors, ERRMSG
Esempio n. 3
0
def sedmnt(io_manager, siminfo, uci, ts):
	''' Produce and remove sediment from the land surface'''

	simlen = siminfo['steps']

	ui = make_numba_dict(uci)  # Note: all values converted to float automatically
	ui['simlen'] = siminfo['steps']
	ui['uunits'] = siminfo['units']
	ui['delt'] = siminfo['delt']
	ui['errlen'] = len(ERRMSG)

	u = uci['PARAMETERS']
	if 'CRVFG' in u:
		ts['COVERI'] = initm(siminfo, uci, u['CRVFG'], 'MONTHLY_COVER', u['COVER'])
	else:
		ts['COVERI'] = full(simlen, u['COVER'])

	if 'VSIVFG' in u:
		ts['NVSI'] = initm(siminfo, uci, u['VSIVFG'], 'MONTHLY_NVSI', u['NVSI'])
	else:
		ts['NVSI'] = full(simlen, u['NVSI'])

	ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float64)

	############################################################################
	errors = _sedmnt_(ui, ts)  # run SEDMNT simulation code
	############################################################################

	return errors, ERRMSG
Esempio n. 4
0
def iwater(io_manager, siminfo, uci, ts):
    ''' Driver for IMPLND IWATER code. CALL: iwater(store, general, ui, ts)
       store is the Pandas/PyTable open store
       general is a dictionary with simulation info (OP_SEQUENCE for example)
       ui is a dictionary with ILS specific HSPF UCI like data
       ts is a dictionary with ILS specific timeseries'''

    # WATIN, WATDIF, IMPS not saved since trival calculation from saved data
    #    WATIN  = SUPY + SURLI
    #    WATDIF = WATIN - (SURO + IMPEV)
    #    IMPS   = RETS + SURS

    steps = siminfo['steps']  # number of simulation points

    # insure defined, but not usable - just in case
    for name in ('AIRTMP', 'PETINP', 'PREC', 'RAINF', 'SNOCOV', 'WYIELD'):
        if name not in ts:
            ts[name] = full(steps, nan, dtype=float64)

    # treat missing flows as zero flow
    for name in ['SURLI']:  # RTLIFG = 1 requires this timeseries
        if name not in ts:
            ts[name] = zeros(steps, dtype=float64)
    # Replace fixed parameters in HSPF with timeseries
    for name in ['PETMAX', 'PETMIN']:
        if name not in ts:
            ts[name] = full(steps, uci['PARAMETERS'][name], dtype=float64)

    # process optional monthly arrays to return interpolated data or constant array
    u = uci['PARAMETERS']
    if 'VRSFG' in u:
        ts['RETSC'] = initm(siminfo, uci, u['VRSFG'], 'MONTHLY_RETSC',
                            u['RETSC'])
        ts['NSUR'] = initm(siminfo, uci, u['VNNFG'], 'MONTHLY_NSUR', u['NSUR'])
    else:
        ts['RETSC'] = full(steps, u['RETSC'])
        ts['NSUR'] = full(steps, u['NSUR'])

    # true the first time and at 1am every day of simulation
    ts['HR1FG'] = hourflag(siminfo, 1, dofirst=True).astype(
        float64)  # numba Dict limitation

    # true the first time and at every hour of simulation
    ts['HRFG'] = hoursval(siminfo, ones(24), dofirst=True).astype(
        float64)  # numba Dict limitation

    ui = make_numba_dict(
        uci)  # Note: all values coverted to float automatically
    ui['steps'] = steps
    ui['delt'] = siminfo['delt']
    ui['errlen'] = len(ERRMSGS)
    ui['uunits'] = siminfo['units']

    ############################################################################
    errors = _iwater_(ui, ts)  # run IWATER simulation code
    ############################################################################

    return errors, ERRMSGS
Esempio n. 5
0
def snow(store, siminfo, uci, ts):
    ''' high level driver for SNOW module
    CALL: snow(store, general, ui, ts)
       store is the Pandas/PyTable open store
       siminfo is a dictionary with simulation level infor (OP_SEQUENCE for example)
       ui is a dictionary with segment specific HSPF UCI like data
       ts is a dictionary with segment specific timeseries'''

    steps = siminfo['steps']  # number of simulation timesteps

    ts['SVP'] = store['TIMESERIES/Saturated_Vapor_Pressure_Table'].to_numpy()
    ts['SEASONS'] = monthval(siminfo, store['TIMESERIES/SEASONS_Table'])

    cloudfg = 'CLOUD' in ts

    # insure defined, but can't be used accidently
    for name in ['AIRTMP', 'CLOUD', 'DTMPG', 'PREC', 'SOLRAD', 'WINMOV']:
        if name not in ts:
            ts[name] = full(steps, nan)

    # Replace fixed parameters in HSPF with time series
    for name in [
            'CCFACT', 'COVIND', 'MGMELT', 'MWATER', 'SHADE', 'SNOEVP',
            'SNOWCF', 'KMELT'
    ]:
        if name not in ts and name in uci['PARAMETERS']:
            ts[name] = full(steps, uci['PARAMETERS'][name])

    # true the first time and at 6am every day of simulation
    ts['HR6FG'] = hourflag(siminfo, 6, dofirst=True).astype(float)

    # true the first time and at every hour of simulation
    ts['HRFG'] = hoursval(siminfo, ones(24), dofirst=True).astype(float)

    # make ICEFG available to PWATER later.
    siminfo['ICEFG'] = uci['FLAGS']['ICEFG'] if 'ICEFG' in uci['FLAGS'] else 0

    ui = make_numba_dict(
        uci)  # Note: all values coverted to float automatically
    ui['steps'] = steps
    ui['delt'] = siminfo['delt']
    ui['errlen'] = len(ERRMSGS)
    ui['cloudfg'] = cloudfg

    ############################################################################
    errors = _snow_(ui, ts)
    ############################################################################

    if siminfo['delt'] > 360 and int(siminfo['ICEFLG']):
        errors[0] += 1

    return errors, ERRMSGS
Esempio n. 6
0
def solids(io_manager, siminfo, uci, ts):
    '''Accumulate and remove solids from the impervious land segment'''

    simlen = siminfo['steps']

    for name in ['SURO', 'SURS', 'PREC', 'SLSLD']:
        if name not in ts:
            ts[name] = zeros(simlen)

    u = uci['PARAMETERS']
    # process optional monthly arrays to return interpolated data or constant array
    if 'VASDFG' in u:
        ts['ACCSDP'] = initm(siminfo, uci, u['VASDFG'], 'MONTHLY_ACCSDP',
                             u['ACCSDP'])
    else:
        ts['ACCSDP'] = full(simlen, u['ACCSDP'])
    if 'VRSDFG' in u:
        ts['REMSDP'] = initm(siminfo, uci, u['VRSDFG'], 'MONTHLY_REMSDP',
                             u['REMSDP'])
    else:
        ts['REMSDP'] = full(simlen, u['REMSDP'])

    ui = make_numba_dict(
        uci)  # Note: all values converted to float automatically
    ui['uunits'] = siminfo['units']
    ui['simlen'] = siminfo['steps']
    ui['delt60'] = siminfo[
        'delt'] / 60  # delt60 - simulation time interval in hours
    ui['errlen'] = len(ERRMSG)

    ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float64)

    ############################################################################
    errors = _solids_(ui, ts)  # run SOLIDS simulation code
    ############################################################################

    return errors, ERRMSG
Esempio n. 7
0
def htrch(io_manager, siminfo, uci, ts):
    '''Simulate heat exchange and water temperature'''

    advectData = uci['advectData']
    (nexits, vol, VOL, SROVOL, EROVOL, SOVOL, EOVOL) = advectData

    ts['VOL'] = VOL
    ts['SROVOL'] = SROVOL
    ts['EROVOL'] = EROVOL
    for i in range(nexits):
        ts['SOVOL' + str(i + 1)] = SOVOL[:, i]
        ts['EOVOL' + str(i + 1)] = EOVOL[:, i]

    simlen = siminfo['steps']

    ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float64)

    ui = make_numba_dict(uci)
    nexits = int(ui['NEXITS'])
    ui['simlen'] = siminfo['steps']
    ui['uunits'] = siminfo['units']
    ui['delt'] = siminfo['delt']
    ui['delt60'] = siminfo['delt'] / 60
    ui['errlen'] = len(ERRMSGS)
    ui['vol'] = vol

    bedflg = 0
    if 'BEDFLG' in ui:
        bedflg = ui['BEDFLG']
    tgrnd = 59.0
    if bedflg == 1 or bedflg == 2:
        tgrnd = ui['TGRND']
    tstop = 55
    if 'TSTOP' in ui:
        tstop = ui['TSTOP']
    # even though delh and deltt are not ts, numba requires them to be passed as such
    if 'DELH' in ui:
        delh = ui['DELH']
    else:
        delh = zeros(int(tstop))
    ts['DELH'] = delh
    if 'DELTT' in ui:
        deltt = ui['DELTT']
    else:
        deltt = zeros(int(tstop))
    ts['DELTT'] = deltt

    u = uci['PARAMETERS']
    # process optional monthly arrays to return interpolated data or constant array
    if 'TGFLG' in u:
        ts['TGRND'] = initm(siminfo, uci, u['TGFLG'], 'TGRND', tgrnd)
    else:
        ts['TGRND'] = full(simlen, tgrnd)

    ts['LAPSE'] = hoursval(siminfo, mlapse, lapselike=True)

    ############################################################################
    errors = _htrch_(ui, ts)  # run HTRCH simulation code
    ############################################################################

    if nexits > 1:
        u = uci['SAVE']
        key = 'OHEAT'
        for i in range(nexits):
            u[f'{key}{i + 1}'] = u[key]
        del u[key]

    return errors, ERRMSGS
Esempio n. 8
0
def iqual(io_manager, siminfo, uci, ts):
	''' Simulate washoff of quality constituents (other than solids, Heat, dox, and co2)
	using simple relationships with solids And/or water yield'''

	simlen = siminfo['steps']

	nquals = 1
	if 'PARAMETERS' in uci:
		if 'NQUAL' in uci['PARAMETERS']:
			nquals = uci['PARAMETERS']['NQUAL']
	constituents = []
	for index in range(nquals):
		iqual = str(index + 1)
		flags = uci['IQUAL' + iqual + '_FLAGS']
		constituents.append(flags['QUALID'])

	ui = make_numba_dict(uci)
	ui['simlen'] = siminfo['steps']
	ui['delt60'] = siminfo['delt'] / 60  # delt60 - simulation time interval in hours
	ui['nquals'] = nquals
	ui['errlen'] = len(ERRMSGS)
	# constituents = ui['CONSTITUENTS']   # (short) names of constituents
	if 'FLAGS' in uci:
		u = uci['FLAGS']

	index = 0
	for constituent in constituents:  # simulate constituent
		index += 1
		# update UI values for this constituent here!
		ui_flags = uci['IQUAL' + str(index) + '_FLAGS']
		ui_parms = uci['IQUAL' + str(index) + '_PARAMETERS']
		qualid = ui_flags['QUALID']
		qtyid  = ui_flags['QTYID']
		QSDFG  = ui_flags['QSDFG']
		QSOFG  = ui_flags['QSOFG']
		VQOFG  = ui_flags['VQOFG']
		sqo    = ui_parms['SQO']
		wsqop  = ui_parms['WSQOP']
		ui['QSDFG' + str(index)] = QSDFG
		ui['QSOFG' + str(index)] = QSOFG
		ui['VQOFG' + str(index)] = VQOFG
		ui['sqo' + str(index)] = sqo
		ui['wsqop' + str(index)] = wsqop

		# handle monthly tables
		ts['POTFW' + str(index)] = initm(siminfo, uci, ui_flags['VPFWFG'], 'IQUAL' + str(index) + '_MONTHLY/POTFW', ui_parms['POTFW'])
		ts['ACQOP' + str(index)] = initm(siminfo, uci, ui_flags['VQOFG'], 'IQUAL' + str(index) + '_MONTHLY/ACQOP', ui_parms['ACQOP'])
		ts['SQOLIM' + str(index)] = initm(siminfo, uci, ui_flags['VQOFG'], 'IQUAL' + str(index) + '_MONTHLY/SQOLIM', ui_parms['SQOLIM'])

		iqadfgf = 0
		iqadfgc = 0
		ts['IQADFX' + str(index)] = zeros(simlen)
		ts['IQADCN' + str(index)] = zeros(simlen)
		if 'FLAGS' in uci:
			# get atmos dep timeseries
			iqadfgf = u['IQADFG' + str((index * 2) - 1)]
			if iqadfgf > 0:
				ts['IQADFX' + str(index)] = initm(siminfo, uci, iqadfgf, 'IQUAL' + str(index) + '_MONTHLY/IQADFX', 0.0)
			elif iqadfgf == -1:
				ts['IQADFX' + str(index)] = ts['IQADFX' + str(index) + ' 1']
			iqadfgc = u['IQADFG' + str(index * 2)]
			if iqadfgc > 0:
				ts['IQADCN' + str(index)] = initm(siminfo, uci, iqadfgc, 'IQUAL' + str(index) + '_MONTHLY/IQADCN', 0.0)
			elif iqadfgc == -1:
				ts['IQADCN' + str(index)] = ts['IQADCN' + str(index) + ' 1']
		ui['iqadfgf' + str(index)] = iqadfgf
		ui['iqadfgc' + str(index)] = iqadfgc

	for name in ['SLIQSX', 'SLIQO', 'SLIQSP']:
		if name not in ts:
			ts[name] = full(simlen, -1.0E30)

	ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float64)

	############################################################################
	errors = _iqual_(ui, ts)  # run IQUAL simulation code
	############################################################################

	return errors, ERRMSGS
Esempio n. 9
0
def pwater(io_manager, siminfo, uci, ts):
    ''' PERLND WATER module
    CALL: pwater(store, general, ui, ts)
       store is the Pandas/PyTable open store
       general is a dictionary with simulation level info (sim_start for example)
       ui is a dictionary with PLS specific HSPF UCI like data
       ts is a dictionary with PLS specific timeseries '''

    steps = siminfo['steps']  # number of simulation points

    #if RTOPFG == 3 and 'SURTAB' in ui:
    #    surtab = typeT(ui['SURTAB'])   # FTable

    # missing flows are treated as zeros
    for name in ('AGWLI', 'IFWLI', 'LGTMP', 'LZLI', 'PETINP', 'PREC', 'SURLI',
                 'UZLI'):
        if name not in ts:
            ts[name] = zeros(steps)

    # insure defined, but not usable accidently
    for name in ('AIRTMP', 'PACKI', 'PETINP', 'PREC', 'RAINF', 'SNOCOV',
                 'WYIELD'):
        if name not in ts:
            ts[name] = full(steps, nan)

    # Replace fixed parameters with time series if not already present
    for name in ('AGWRC', 'DEEPFR', 'INFILT', 'KVARY', 'LZSN', 'PETMIN',
                 'PETMAX'):
        if name not in ts and name in uci['PARAMETERS']:
            ts[name] = full(steps, uci['PARAMETERS'][name])

    # process optional monthly arrays to return interpolated data or constant array
    u = uci['PARAMETERS']
    if 'VLEFG' in u:
        flag = (u['VLEFG'] == 1) or (u['VLEFG'] == 3)

        ts['LZETP'] = initm(siminfo, uci, flag, 'MONTHLY_LZETP', u['LZETP'])
        ts['CEPSC'] = initm(siminfo, uci, u['VCSFG'], 'MONTHLY_CEPSC',
                            u['CEPSC'])
        ts['INTFW'] = initm(siminfo, uci, u['VIFWFG'], 'MONTHLY_INTFW',
                            u['INTFW'])
        ts['IRC'] = initm(siminfo, uci, u['VIRCFG'], 'MONTHLY_IRC', u['IRC'])
        ts['NSUR'] = initm(siminfo, uci, u['VNNFG'], 'MONTHLY_NSUR', u['NSUR'])
        ts['UZSN'] = initm(siminfo, uci, u['VUZFG'], 'MONTHLY_UZSN', u['UZSN'])
    else:
        ts['LZETP'] = full(steps, u['LZETP'])
        ts['CEPSC'] = full(steps, u['CEPSC'])
        ts['INTFW'] = full(steps, u['INTFW'])
        ts['IRC'] = full(steps, u['IRC'])
        ts['NSUR'] = full(steps, u['NSUR'])
        ts['UZSN'] = full(steps, u['UZSN'])

    # true the first time and at start of every day of simulation
    ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float)

    # true the first time and at every hour of simulation
    ts['HRFG'] = hoursval(siminfo, ones(24), dofirst=True).astype(float)

    ui = make_numba_dict(
        uci)  # Note: all values coverted to float automatically
    ui['steps'] = siminfo['steps']
    ui['delt'] = siminfo['delt']
    ui['errlen'] = len(ERRMSGS)
    ui['uunits'] = siminfo['units']

    # kludge to make ICEFG available from SNOW to PWATER
    ui['ICEFG'] = siminfo['ICEFG'] if 'ICEFG' in siminfo else 0.0

    CSNOFG = 0
    if 'CSNOFG' in ui:
        CSNOFG = int(ui['CSNOFG'])
    # make CSNOFG available to other sections
    u['CSNOFG'] = CSNOFG

    ############################################################################
    errors = _pwater_(ui, ts)  # traditional HSPF HPERWAT
    ############################################################################

    return errors, ERRMSGS
Esempio n. 10
0
def pqual(io_manager, siminfo, uci, ts):
	''' Simulate quality constituents (other than sediment, heat, dox, and co2)
	using simple relationships with sediment and water yield'''

	simlen = siminfo['steps']

	nquals = 1
	if 'PARAMETERS' in uci:
		if 'NQUAL' in uci['PARAMETERS']:
			nquals = uci['PARAMETERS']['NQUAL']
	constituents = []
	for index in range(nquals):
		pqual = str(index + 1)
		flags = uci['PQUAL' + pqual + '_FLAGS']
		constituents.append(flags['QUALID'])

	ui = make_numba_dict(uci)
	ui['simlen'] = siminfo['steps']
	ui['delt60'] = siminfo['delt'] / 60  # delt60 - simulation time interval in hours
	ui['nquals'] = nquals
	ui['errlen'] = len(ERRMSGS)
	# constituents = ui['CONSTITUENTS']   # (short) names of constituents
	if 'FLAGS' in uci:
		u = uci['FLAGS']

	index = 0
	for constituent in constituents:  # simulate constituent
		index += 1
		# update UI values for this constituent here!
		ui_flags = uci['PQUAL' + str(index) + '_FLAGS']
		ui_parms = uci['PQUAL' + str(index) + '_PARAMETERS']

		qualid = ui_flags['QUALID']
		qtyid  = ui_flags['QTYID']
		QSDFG  = ui_flags['QSDFG']
		QSOFG  = ui_flags['QSOFG']
		QIFWFG = ui_flags['QIFWFG']
		QAGWFG = ui_flags['QAGWFG']
		sqo    = ui_parms['SQO']
		wsqop  = ui_parms['WSQOP']

		ui['QSDFG' + str(index)] = QSDFG
		ui['QSOFG' + str(index)] = QSOFG
		ui['QIFWFG' + str(index)] = QIFWFG
		ui['QAGWFG' + str(index)] = QAGWFG
		ui['SQO' + str(index)] = sqo
		ui['WSQOP' + str(index)] = wsqop
		ui['VIQCFG' + str(index)] = ui_flags['VIQCFG']
		ui['VAQCFG' + str(index)] = ui_flags['VAQCFG']

		ts['POTFW' + str(index)] = initm(siminfo, uci, ui_flags['VPFWFG'], 'PQUAL' + str(index) + '_MONTHLY/POTFW', ui_parms['POTFW'])
		ts['POTFS' + str(index)] = initm(siminfo, uci, ui_flags['VPFSFG'], 'PQUAL' + str(index) + '_MONTHLY/POTFS', ui_parms['POTFS'])
		ts['ACQOP' + str(index)] = initm(siminfo, uci, ui_flags['VQOFG'], 'PQUAL' + str(index) + '_MONTHLY/ACQOP', ui_parms['ACQOP'])
		ts['SQOLIM' + str(index)] = initm(siminfo, uci, ui_flags['VQOFG'], 'PQUAL' + str(index) + '_MONTHLY/SQOLIM', ui_parms['SQOLIM'])
		ts['IOQCP' + str(index)] = initm(siminfo, uci, ui_flags['VIQCFG'], 'PQUAL' + str(index) + '_MONTHLY/IOQC', ui_parms['IOQC'])
		ts['AOQCP' + str(index)] = initm(siminfo, uci, ui_flags['VAQCFG'], 'PQUAL' + str(index) + '_MONTHLY/AOQC', ui_parms['AOQC'])

		pqadfgf = 0
		pqadfgc = 0
		ts['PQADFX' + str(index)] = zeros(simlen)
		ts['PQADCN' + str(index)] = zeros(simlen)
		if 'FLAGS' in uci:
			# get atmos dep timeseries
			pqadfgf = u['PQADFG' + str((index * 2) - 1)]
			if pqadfgf > 0:
				ts['PQADFX' + str(index)] = initm(siminfo, uci, pqadfgf, 'PQUAL' + str(index) + '_MONTHLY/PQADFX', 0.0)
			elif pqadfgf == -1:
				ts['PQADFX' + str(index)] = ts['PQADFX' + str(index) + ' 1']
			pqadfgc = u['PQADFG' + str(index * 2)]
			if pqadfgc > 0:
				ts['PQADCN' + str(index)] = initm(siminfo, uci, pqadfgc, 'PQUAL' + str(index) + '_MONTHLY/PQADCN', 0.0)
			elif pqadfgc == -1:
				ts['PQADCN' + str(index)] = ts['PQADCN' + str(index) + ' 1']
		ui['pqadfgf' + str(index)] = pqadfgf
		ui['pqadfgc' + str(index)] = pqadfgc

	for name in ['SLIQSP', 'ILIQC', 'ALIQC']:
		if name not in ts:
			ts[name] = zeros(simlen)

	ts['DAYFG'] = hourflag(siminfo, 0, dofirst=True).astype(float64)

	for name in ['SURO', 'IFWO', 'AGWO', 'PERO', 'WSSD', 'SCRSD']:
		if name not in ts:
			ts[name] = zeros(simlen)

	############################################################################
	errors = _pqual_(ui, ts)  # run PQUAL simulation code
	############################################################################

	return errors, ERRMSGS