Пример #1
0
    # dates for the calibration

    start = datetime.datetime(y, 1, 1)
    end = datetime.datetime(y + 2, 1, 1)

    ds = start, end

    # use the postprocessor to get the time series

    postprocessor = Postprocessor(hspfmodel, ds, comid=comid)

    # get the flows and other timeseries from the two-year calibration

    stimes, sflow = postprocessor.get_sim_flow(comid)
    otimes, oflow = postprocessor.get_obs_flow()
    ptimes, precip = postprocessor.get_precipitation(comid)
    etimes, evap = postprocessor.get_evaporation(comid)
    times, pet = postprocessor.get_pet(comid=comid)

    # close this postprocessor

    postprocessor.close()

    # get the flows for the thirty-year model

    i = ttimes.index(start)

    if end in ttimes:
        j = ttimes.index(end)
        thirty = tflow[i:j]
    else:
Пример #2
0
        # 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')
        otimes, oflow = postprocessor.get_obs_flow(tstep = 'daily')
    
        NSEvalidation = (1 - sum((numpy.array(sflow) - numpy.array(oflow))**2) /
                         sum((numpy.array(oflow) - numpy.mean(oflow))**2))
    
        # percent error in runoff
    
        error = (sum(sflow) - sum(oflow)) / sum(oflow)