示例#1
0
def buildinput(rts, ndays, navgs, lenavgs):
    '''
    buildinput(rts):
    This builds a set of time series each of which is a present or past value of
    the given time series. Some of the values may be obtained by period averaging
    over a week.
    '''
    orts = []
    nrts = ndays+navgs
    # always append rts
    orts.append(rts)
    # append needed previous daily values
    for i in range(ndays): orts.append(rts >> (i+1))
    # adjust by 1 as present point always in average
    avgrts = vutils.mov_avg(rts,lenavgs-1,0)
    # append averaged values
    for i in range(ndays,navgs+ndays):
	shift = (i-ndays)*lenavgs+ndays+1
	orts.append(avgrts >> shift)
    return orts
import vutils
from vutils import *
g=opendss('../testdata/ex3-base.dss')
ref = g[0]
refma = vutils.mov_avg(ref,20,20)
reftd = vutils.tidal_avg(ref)
ref_hour = vutils.per_avg(ref,'1hour')
ref_day = vutils.per_avg(ref,'1day')
plot(ref,refma)
plot(ref,reftd)
plot(ref,ref_hour,ref_day)
vutils.read_dssts('test.dssts')
vutils.read_dssits('test.dssits')