Exemple #1
0
postprocessor = Postprocessor(hspfmodel, process_dates, comid = comid)

# make the figure canvas

fig = pyplot.figure(figsize = (15,9))

# font sizes

titlesize = 14
axissize = 12
ticksize = 11

# get the monthly flows

otimes, m_oflow = postprocessor.get_obs_flow(tstep = 'monthly')
stimes, m_sflow = postprocessor.get_sim_flow(comid, tstep = 'monthly')

# plot the monthly simulated versus the observed

ax3 = pyplot.subplot2grid((2,3), (0,1), aspect = 'equal')

ax3.set_title('Monthly Flow Parity Plot', size = titlesize)
ax3.set_xlabel('Observed Monthly Flows (m\u00B3/s)', size = axissize)
ax3.set_ylabel('Simulated Monthly Flows (m\u00B3/s)', size = axissize)

# get the max value for the limits

maxflow = max(max(m_oflow), max(m_sflow))

# add plot for the data
d = {v: k for k, v in list(hspfmodel.subbasin_timeseries['flowgage'].items())}
comid = d[NWISgage]

# make an instance of the postprocessor for the thiry-year

start = datetime.datetime(1981, 1, 1)
end = datetime.datetime(2011, 1, 1)

ds = start, end

postprocessor = Postprocessor(hspfmodel, ds)

# get the flows from the 30-year model

ttimes, tflow = postprocessor.get_sim_flow(comid, dates=ds)

# close the processor

postprocessor.close()

# iterate through each two-year and make the plot

for y in range(1981, 2010, 2):

    print(('reading year', y, 'data'))

    # path to the two-year model

    p = '{}/{}/two_year/{}_{}/{}'.format(directory, HUC8, y, y + 2, NWISgage)
    
d = {v:k for k, v in hspfmodel.subbasin_timeseries['flowgage'].items()}
comid = d[NWISgage]

# make an instance of the postprocessor for the thiry-year
    
start = datetime.datetime(1981, 1, 1)
end   = datetime.datetime(2011, 1, 1)

ds = start, end

postprocessor = Postprocessor(hspfmodel, ds)

# get the flows from the 30-year model

ttimes, tflow = postprocessor.get_sim_flow(comid, dates = ds)

# close the processor

postprocessor.close()

# iterate through each two-year and make the plot

for y in range(1981, 2010, 2):

    print('reading year', y, 'data')

    # path to the two-year model
    
    p = '{}/{}/two_year/{}_{}/{}'.format(directory, HUC8, y, y + 2, NWISgage)
    
Exemple #4
0
        
        runoff             = suro / area / (end - start).days * 365.25
        interflow          = ifwo / area / (end - start).days * 365.25
        baseflow           = agwo / area / (end - start).days * 365.25
        evapotranspiration = evap / area / (end - start).days * 365.25

        # use the postprocessor to get the simulation stats

        dates = start,end
        postprocessor = Postprocessor(hspfmodel, dates, comid = comid)

        # get the NSE during the calibration period

        d = datetime.datetime(y, 1, 1), datetime.datetime(y + 2 , 1, 1)
        
        stimes, sflow = postprocessor.get_sim_flow(comid, tstep = 'daily',
                                                   dates = d)
        otimes, oflow = postprocessor.get_obs_flow(tstep = 'daily',
                                                   dates = d)

        NSEcalibration = (1 - sum((numpy.array(sflow)-numpy.array(oflow))**2) /
                          sum((numpy.array(oflow) - numpy.mean(oflow))**2))

        # get the total precipitation during the calibration period

        ptimes, precip = postprocessor.get_precipitation(comid, dates = d)

        precipitation = sum(precip) / (d[1] - d[0]).days * 365.25

        # get the validation NSE

        stimes, sflow = postprocessor.get_sim_flow(comid, tstep = 'daily')
Exemple #5
0
postprocessor = Postprocessor(hspfmodel, process_dates, comid=comid)

# make the figure canvas

fig = pyplot.figure(figsize=(15, 9))

# font sizes

titlesize = 14
axissize = 12
ticksize = 11

# get the monthly flows

otimes, m_oflow = postprocessor.get_obs_flow(tstep='monthly')
stimes, m_sflow = postprocessor.get_sim_flow(comid, tstep='monthly')

# plot the monthly simulated versus the observed

ax3 = pyplot.subplot2grid((2, 3), (0, 1), aspect='equal')

ax3.set_title('Monthly Flow Parity Plot', size=titlesize)
ax3.set_xlabel('Observed Monthly Flows (m\u00B3/s)', size=axissize)
ax3.set_ylabel('Simulated Monthly Flows (m\u00B3/s)', size=axissize)

# get the max value for the limits

maxflow = max(max(m_oflow), max(m_sflow))

# add plot for the data