Пример #1
0
dirSel = os.path.join(kPath.dirData, 'USGS', 'inventory', 'siteSel')
with open(os.path.join(dirSel, 'dictRB_Y30N5.json')) as f:
    dictSite = json.load(f)

codeLst = sorted(usgs.newC)
ep = 500
reTest = False
dataName = 'rbWN5'
siteNoLst = dictSite['comb']
nSite = len(siteNoLst)

# load all sequence
if False:
    importlib.reload(wq.wqLoad)
    outNameLSTM = '{}-{}-{}-{}'.format('rbWN5', 'comb', 'QTFP_C', 'comb-B10')
    dictLSTM, dictWRTDS, dictObs = wq.loadModel(
        siteNoLst, outNameLSTM, codeLst)
    corrMat, rmseMat = wq.dictErr(dictLSTM, dictWRTDS, dictObs, codeLst)
    # load basin attributes
    dfG = gageII.readData(siteNoLst=siteNoLst)
    dfG = gageII.updateRegion(dfG)
    dfG = gageII.updateCode(dfG)

t = dictObs[siteNoLst[0]].index.values
tt = np.datetime64('2010-01-01')
t0 = np.datetime64('1980-01-01')
ind1 = np.where((t < tt) & (t >= t0))[0]
ind2 = np.where(t >= tt)[0]

# caluculate interval
if False:
    intMatC = np.full([len(siteNoLst), len(codeLst), 4], np.nan)
Пример #2
0
yO, ycO = basinFull.getObs(outName, testSet, DM=dm)

indT = np.where(dm.t == np.datetime64('2010-01-01'))[0][0]
importlib.reload(utils.stat)
siteNoLst = dm.siteNoLst
corrMat = np.ndarray([len(siteNoLst), len(varY), 2])
for k in range(len(varY)):
    corr1 = utils.stat.calCorr(yP[:indT, :, k], yO[:indT, :, k])
    corr2 = utils.stat.calCorr(yP[indT:, :, k], yO[indT:, :, k])
    corrMat[:, k, 0] = corr1
    corrMat[:, k, 1] = corr2

# load previous result
if True:
    outNameLSTM = '{}-{}-{}-{}'.format('rbWN5', 'comb', 'QTFP_C', 'comb-B10')
    dictLSTM, dictWRTDS, dictObs = wq.loadModel(siteNoLst, outNameLSTM,
                                                varY[1:])
    corrMatO, rmseMatO = wq.dictErr(dictLSTM, dictWRTDS, dictObs, varY[1:])

# plot box
label1 = varY[1:]
label2 = ['train', 'test']
dataBox = list()
for k in range(1, len(varY)):
    # dataBox.append([corrMat[:, k, 1], corrMatO[:, k, 1]])
    dataBox.append([corrMat[:, k, 1], corrMatO[:, k - 1, 1]])

fig = figplot.boxPlot(dataBox,
                      widths=0.5,
                      cLst='br',
                      label1=label1,
                      label2=label2,